mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
don't show dallas in system/info as its not an ems device
This commit is contained in:
@@ -614,9 +614,9 @@ void System::commands_init() {
|
|||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), System::command_publish, F("force a MQTT publish"), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), System::command_publish, F("force a MQTT publish"), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, F("refresh all EMS values"), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, F("refresh all EMS values"), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, F("restarts EMS-ESP"), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, F("restarts EMS-ESP"), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add_returns_json(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info, F("system status"));
|
Command::add_json(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info, F("system status"));
|
||||||
Command::add_returns_json(EMSdevice::DeviceType::SYSTEM, F_(settings), System::command_settings, F("list system settings"));
|
Command::add_json(EMSdevice::DeviceType::SYSTEM, F_(settings), System::command_settings, F("list system settings"));
|
||||||
Command::add_returns_json(EMSdevice::DeviceType::SYSTEM, F_(commands), System::command_commands, F("list system commands"));
|
Command::add_json(EMSdevice::DeviceType::SYSTEM, F_(commands), System::command_commands, F("list system commands"));
|
||||||
#if defined(EMSESP_DEBUG)
|
#if defined(EMSESP_DEBUG)
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F("test"), System::command_test, F("run tests"));
|
Command::add(EMSdevice::DeviceType::SYSTEM, F("test"), System::command_test, F("run tests"));
|
||||||
#endif
|
#endif
|
||||||
@@ -775,7 +775,7 @@ bool System::command_commands(const char * value, const int8_t id, JsonObject &
|
|||||||
}
|
}
|
||||||
|
|
||||||
// export all settings to JSON text
|
// export all settings to JSON text
|
||||||
// e.g. http://ems-esp/api?device=system&cmd=settings
|
// http://ems-esp/api/system/settings
|
||||||
// value and id are ignored
|
// value and id are ignored
|
||||||
bool System::command_settings(const char * value, const int8_t id, JsonObject & json) {
|
bool System::command_settings(const char * value, const int8_t id, JsonObject & json) {
|
||||||
JsonObject node;
|
JsonObject node;
|
||||||
@@ -878,8 +878,8 @@ bool System::command_settings(const char * value, const int8_t id, JsonObject &
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export status information including some basic settings
|
// export status information including the device information
|
||||||
// e.g. http://ems-esp/api?device=system&cmd=info
|
// http://ems-esp/api/system/info
|
||||||
bool System::command_info(const char * value, const int8_t id, JsonObject & json) {
|
bool System::command_info(const char * value, const int8_t id, JsonObject & json) {
|
||||||
JsonObject node;
|
JsonObject node;
|
||||||
|
|
||||||
@@ -934,12 +934,12 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & json
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonArray devices2 = json.createNestedArray("Devices");
|
// show EMS devices
|
||||||
|
JsonArray devices = json.createNestedArray("Devices");
|
||||||
for (const auto & device_class : EMSFactory::device_handlers()) {
|
for (const auto & device_class : EMSFactory::device_handlers()) {
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
if ((emsdevice) && (emsdevice->device_type() == device_class.first)) {
|
if ((emsdevice) && (emsdevice->device_type() == device_class.first)) {
|
||||||
JsonObject obj = devices2.createNestedObject();
|
JsonObject obj = devices.createNestedObject();
|
||||||
obj["type"] = emsdevice->device_type_name();
|
obj["type"] = emsdevice->device_type_name();
|
||||||
obj["name"] = emsdevice->to_string();
|
obj["name"] = emsdevice->to_string();
|
||||||
char result[200];
|
char result[200];
|
||||||
@@ -947,11 +947,6 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & json
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (EMSESP::sensor_devices().size()) {
|
|
||||||
JsonObject obj = devices2.createNestedObject();
|
|
||||||
obj["type"] = F_(Dallassensor);
|
|
||||||
obj["name"] = F_(Dallassensor);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user