diff --git a/src/command.cpp b/src/command.cpp index 588b9fe49..2686c3b7e 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -271,7 +271,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * #if defined(EMSESP_DEBUG) LOG_DEBUG("[DEBUG] Calling %s command '%s' to retrieve attributes", dname, cmd); #endif - return EMSESP::get_device_value_info(output, cmd, id, device_type) ? CommandRet::OK : CommandRet::ERROR; // entity = cmd + return EMSESP::get_device_value_info(output, cmd, id, device_type, device_id) ? CommandRet::OK : CommandRet::ERROR; // entity = cmd } } diff --git a/src/emsesp.cpp b/src/emsesp.cpp index f314bbeaf..a976e80bf 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -640,9 +640,9 @@ void EMSESP::publish_response(std::shared_ptr telegram) { } // builds json with the detail of each value, for a specific EMS device type or the dallas sensor -bool EMSESP::get_device_value_info(JsonObject & root, const char * cmd, const int8_t id, const uint8_t devicetype) { +bool EMSESP::get_device_value_info(JsonObject & root, const char * cmd, const int8_t id, const uint8_t devicetype, const uint8_t device_id) { for (const auto & emsdevice : emsdevices) { - if (emsdevice->device_type() == devicetype) { + if (emsdevice->device_type() == devicetype && emsdevice->device_id() == device_id) { return emsdevice->get_value_info(root, cmd, id); } } diff --git a/src/emsesp.h b/src/emsesp.h index f5fcf8214..10f559d91 100644 --- a/src/emsesp.h +++ b/src/emsesp.h @@ -136,7 +136,7 @@ class EMSESP { static uint8_t count_devices(); static uint8_t device_index(const uint8_t device_type, const uint8_t unique_id); - static bool get_device_value_info(JsonObject & root, const char * cmd, const int8_t id, const uint8_t devicetype); + static bool get_device_value_info(JsonObject & root, const char * cmd, const int8_t id, const uint8_t devicetype, const uint8_t device_id); static void show_device_values(uuid::console::Shell & shell); static void show_sensor_values(uuid::console::Shell & shell);