Skip to content

Commit

Permalink
support multi devices of same type
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Jan 25, 2025
1 parent 1d3fec2 commit 0953d37
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/emsesp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
// check first for EMS devices
bool found_device = false;

for (const auto & emsdevice : emsdevices) {
if (emsdevice->device_type() == devicetype) {
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)) {
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;
}
}
}
}
Expand Down

0 comments on commit 0953d37

Please sign in to comment.