diff --git a/src/command.cpp b/src/command.cpp index 196d6b88f..3fc2fd5b9 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -307,7 +307,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * // check if read-only. This also checks for valid tags (e.g. heating circuits) if (cf->cmdfunction_) { - if (EMSESP::cmd_is_readonly(device_type, cmd, id)) { + if (EMSESP::cmd_is_readonly(device_type, device_id, cmd, id)) { return_code = CommandRet::INVALID; // readonly or invalid hc } else { return_code = ((cf->cmdfunction_)(value, id)) ? CommandRet::OK : CommandRet::ERROR; diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index adc32937c..41d4c1bd7 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -214,7 +214,7 @@ std::shared_ptr Thermostat::heating_circuit(const ui return heating_circuit; } } - + LOG_DEBUG("Heating circuit not fond on device 0x%02X", device_id()); return nullptr; // not found } @@ -3244,7 +3244,7 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co write_command(set_typeid, offset, (uint8_t)(temperature * (float)factor), validate_typeid); return true; } - + LOG_DEBUG("temperature mode %d not found", mode); return false; } diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 5ee409283..1be4e0f91 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -105,9 +105,9 @@ void EMSESP::fetch_device_values_type(const uint8_t device_type) { } } -bool EMSESP::cmd_is_readonly(const uint8_t device_type, const char * cmd, const int8_t id) { +bool EMSESP::cmd_is_readonly(const uint8_t device_type, const uint8_t device_id, const char * cmd, const int8_t id) { for (const auto & emsdevice : emsdevices) { - if (emsdevice && (emsdevice->device_type() == device_type)) { + if (emsdevice && (emsdevice->device_type() == device_type) && (!device_id || emsdevice->device_id() == device_id)) { return emsdevice->is_readonly(cmd, id); } } diff --git a/src/emsesp.h b/src/emsesp.h index eed1f7643..0a4c85186 100644 --- a/src/emsesp.h +++ b/src/emsesp.h @@ -129,7 +129,7 @@ class EMSESP { static void send_write_request(const uint16_t type_id, const uint8_t dest, const uint8_t offset, const uint8_t value, const uint16_t validate_typeid); static bool device_exists(const uint8_t device_id); - static bool cmd_is_readonly(const uint8_t device_type, const char * cmd, const int8_t id); + static bool cmd_is_readonly(const uint8_t device_type, const uint8_t device_id, const char * cmd, const int8_t id); static uint8_t count_devices(const uint8_t device_type); static uint8_t count_devices();