diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index d9c2b8718..8e38e2df4 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -126,18 +126,21 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i // JUNKERS/HT3 } else if (model == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) { monitor_typeids = {0x016F, 0x0170, 0x0171, 0x0172}; - set_typeids = {0x0165, 0x0166, 0x0167, 0x0168}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { register_telegram_type(monitor_typeids[i], F("JunkersMonitor"), false, [&](std::shared_ptr t) { process_JunkersMonitor(t); }); - register_telegram_type(set_typeids[i], F("JunkersSet"), false, [&](std::shared_ptr t) { process_JunkersSet(t); }); } - // JUNKERS/HT3 older models - } else if (model == (EMSdevice::EMS_DEVICE_FLAG_JUNKERS | EMSdevice::EMS_DEVICE_FLAG_JUNKERS_2)) { - monitor_typeids = {0x016F, 0x0170, 0x0171, 0x0172}; - set_typeids = {0x0179, 0x017A, 0x017B, 0x017C}; - for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(monitor_typeids[i], F("JunkersMonitor"), false, [&](std::shared_ptr t) { process_JunkersMonitor(t); }); - register_telegram_type(set_typeids[i], F("JunkersSet"), false, [&](std::shared_ptr t) { process_JunkersSet2(t); }); + + if (this->has_flags(EMS_DEVICE_FLAG_JUNKERS_2)) { + // FR120, FR100 + set_typeids = {0x0179, 0x017A, 0x017B, 0x017C}; + for (uint8_t i = 0; i < monitor_typeids.size(); i++) { + register_telegram_type(set_typeids[i], F("JunkersSet"), false, [&](std::shared_ptr t) { process_JunkersSet(t); }); + } + } else { + set_typeids = {0x0165, 0x0166, 0x0167, 0x0168}; + for (uint8_t i = 0; i < monitor_typeids.size(); i++) { + register_telegram_type(set_typeids[i], F("JunkersSet"), false, [&](std::shared_ptr t) { process_JunkersSet2(t); }); + } } } @@ -164,7 +167,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i for (uint8_t i = 0; i < summer_typeids.size(); i++) { EMSESP::send_read_request(summer_typeids[i], device_id); } -} +} // namespace emsesp // prepare data for Web UI void Thermostat::device_info_web(JsonArray & root) { diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index 07e69e8ff..93291df8e 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -110,9 +110,9 @@ class Thermostat : public EMSdevice { bool export_values_main(JsonObject & doc); bool export_values_hc(uint8_t mqtt_format, JsonObject & doc); - // specific thermostat characteristics, stripping the write option at bit 7 + // specific thermostat characteristics, stripping the last 4 bits inline uint8_t model() const { - return (this->flags() & 0x7F); + return (this->flags() & 0x0F); } // each thermostat has a list of heating controller type IDs for reading and writing