mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 16:59:50 +03:00
rename system info -> settings and report -> info
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
// common words
|
||||
MAKE_PSTR_WORD(exit)
|
||||
MAKE_PSTR_WORD(help)
|
||||
MAKE_PSTR_WORD(settings)
|
||||
MAKE_PSTR_WORD(log)
|
||||
MAKE_PSTR_WORD(logout)
|
||||
MAKE_PSTR_WORD(enabled)
|
||||
@@ -77,8 +76,8 @@ MAKE_PSTR_WORD(data)
|
||||
MAKE_PSTR_WORD(command)
|
||||
MAKE_PSTR_WORD(commands)
|
||||
MAKE_PSTR_WORD(info)
|
||||
MAKE_PSTR_WORD(report)
|
||||
MAKE_PSTR_WORD(test)
|
||||
MAKE_PSTR_WORD(settings)
|
||||
|
||||
// devices
|
||||
MAKE_PSTR_WORD(boiler)
|
||||
|
||||
@@ -200,7 +200,7 @@ void System::start() {
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, settings.ems_bus_id, F_(publish), System::command_publish);
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, settings.ems_bus_id, F_(fetch), System::command_fetch);
|
||||
Command::add_with_json(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info);
|
||||
Command::add_with_json(EMSdevice::DeviceType::SYSTEM, F_(report), System::command_report);
|
||||
Command::add_with_json(EMSdevice::DeviceType::SYSTEM, F_(settings), System::command_settings);
|
||||
|
||||
#if defined(EMSESP_TEST)
|
||||
Command::add(EMSdevice::DeviceType::SYSTEM, settings.ems_bus_id, F_(test), System::command_test);
|
||||
@@ -902,9 +902,9 @@ bool System::check_upgrade() {
|
||||
}
|
||||
|
||||
// export all settings to JSON text
|
||||
// http://ems-esp/api?device=system&cmd=info
|
||||
// http://ems-esp/api?device=system&cmd=settings
|
||||
// value and id are ignored
|
||||
bool System::command_info(const char * value, const int8_t id, JsonObject & json) {
|
||||
bool System::command_settings(const char * value, const int8_t id, JsonObject & json) {
|
||||
#ifdef EMSESP_STANDALONE
|
||||
json["test"] = "testing system info command";
|
||||
#else
|
||||
@@ -977,7 +977,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & json
|
||||
JsonObject node = json.createNestedObject("Settings");
|
||||
node["tx_mode"] = settings.tx_mode;
|
||||
node["ems_bus_id"] = settings.ems_bus_id;
|
||||
node["syslog_enabled"] = settings.syslog_enabled;
|
||||
node["syslog_enabled"] = Helpers::render_boolean(s, settings.syslog_enabled);
|
||||
node["syslog_level"] = settings.syslog_level;
|
||||
node["syslog_mark_interval"] = settings.syslog_mark_interval;
|
||||
node["syslog_host"] = settings.syslog_host;
|
||||
@@ -999,9 +999,9 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & json
|
||||
return true;
|
||||
}
|
||||
|
||||
// export debug information
|
||||
// http://ems-esp/api?device=system&cmd=report
|
||||
bool System::command_report(const char * value, const int8_t id, JsonObject & json) {
|
||||
// export status information including some basic settings
|
||||
// http://ems-esp/api?device=system&cmd=info
|
||||
bool System::command_info(const char * value, const int8_t id, JsonObject & json) {
|
||||
JsonObject node;
|
||||
|
||||
node = json.createNestedObject("System");
|
||||
@@ -1043,6 +1043,7 @@ bool System::command_report(const char * value, const int8_t id, JsonObject & js
|
||||
node["api_enabled"] = Helpers::render_boolean(s, settings.api_enabled);
|
||||
node["bool_format"] = settings.bool_format;
|
||||
node["analog_enabled"] = Helpers::render_boolean(s, settings.analog_enabled);
|
||||
// node["mqtt_enabled"] = Helpers::render_boolean(s, settings.; // TODO
|
||||
});
|
||||
|
||||
node = json.createNestedObject("Status");
|
||||
|
||||
@@ -53,7 +53,7 @@ class System {
|
||||
static bool command_publish(const char * value, const int8_t id);
|
||||
static bool command_fetch(const char * value, const int8_t id);
|
||||
static bool command_info(const char * value, const int8_t id, JsonObject & json);
|
||||
static bool command_report(const char * value, const int8_t id, JsonObject & json);
|
||||
static bool command_settings(const char * value, const int8_t id, JsonObject & json);
|
||||
|
||||
#if defined(EMSESP_TEST)
|
||||
static bool command_test(const char * value, const int8_t id);
|
||||
|
||||
Reference in New Issue
Block a user