mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
support multi devices of same type
This commit is contained in:
@@ -766,11 +766,16 @@ void EMSESP::publish_response(std::shared_ptr<const Telegram> telegram) {
|
|||||||
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) {
|
||||||
// check first for EMS devices
|
// check first for EMS devices
|
||||||
bool found_device = false;
|
bool found_device = false;
|
||||||
|
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice->device_type() == devicetype) {
|
if (emsdevice->device_type() == devicetype) {
|
||||||
found_device = true;
|
found_device = true;
|
||||||
|
// we may have multiple devices of the same type, so we need to check the id (e.g. id could be a hc number)
|
||||||
if (emsdevice->get_value_info(root, cmd, id)) {
|
if (emsdevice->get_value_info(root, cmd, id)) {
|
||||||
return true;
|
// if we have no values, keep going traversing the devices, it may be a thermostat with multiple hc's
|
||||||
|
if (root.size()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user