mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
add comment
This commit is contained in:
@@ -748,6 +748,7 @@ bool EMSESP::get_device_value_info(JsonObject root, const char * cmd, const int8
|
|||||||
// check first for EMS devices
|
// check first for EMS devices
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice->device_type() == devicetype) {
|
if (emsdevice->device_type() == devicetype) {
|
||||||
|
// found device, call its device info
|
||||||
if (emsdevice->get_value_info(root, cmd, id)) {
|
if (emsdevice->get_value_info(root, cmd, id)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -784,10 +785,14 @@ bool EMSESP::get_device_value_info(JsonObject root, const char * cmd, const int8
|
|||||||
|
|
||||||
// sends JSON error message, used with API calls
|
// sends JSON error message, used with API calls
|
||||||
bool EMSESP::return_not_found(JsonObject output, const char * msg, const char * cmd) {
|
bool EMSESP::return_not_found(JsonObject output, const char * msg, const char * cmd) {
|
||||||
|
// special case for "info" and "values" which are hardcoded
|
||||||
|
if ((strncmp(cmd, "info", 4)) && strncmp(cmd, "values", 6)) {
|
||||||
output.clear();
|
output.clear();
|
||||||
char error[100];
|
char error[100];
|
||||||
snprintf(error, sizeof(error), "cannot find %s for '%s'", msg, cmd);
|
snprintf(error, sizeof(error), "cannot find %s for '%s'", msg, cmd);
|
||||||
output["message"] = error;
|
output["message"] = error;
|
||||||
|
}
|
||||||
|
|
||||||
return false; // always return false
|
return false; // always return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user