From f3f5bbb460d8f1c0398a7a12e1c3b40ec8476454 Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 11 Jul 2024 17:02:10 +0200 Subject: [PATCH] add comment --- src/emsesp.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/emsesp.cpp b/src/emsesp.cpp index ba3bc3547..cc75c491b 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -748,6 +748,7 @@ bool EMSESP::get_device_value_info(JsonObject root, const char * cmd, const int8 // check first for EMS devices for (const auto & emsdevice : emsdevices) { if (emsdevice->device_type() == devicetype) { + // found device, call its device info if (emsdevice->get_value_info(root, cmd, id)) { 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 bool EMSESP::return_not_found(JsonObject output, const char * msg, const char * cmd) { - output.clear(); - char error[100]; - snprintf(error, sizeof(error), "cannot find %s for '%s'", msg, cmd); - output["message"] = error; + // special case for "info" and "values" which are hardcoded + if ((strncmp(cmd, "info", 4)) && strncmp(cmd, "values", 6)) { + output.clear(); + char error[100]; + snprintf(error, sizeof(error), "cannot find %s for '%s'", msg, cmd); + output["message"] = error; + } + return false; // always return false }