From 119b2b95149766e4c6d1062147576c8dba347dde Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Thu, 8 Feb 2024 18:51:45 +0100 Subject: [PATCH] RC100H emulation version and telegrams --- src/devices/thermostat.cpp | 10 ++++++++-- src/roomcontrol.cpp | 13 +++++++++---- src/roomcontrol.h | 3 +++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 6a08cf81f..992b738b0 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -715,6 +715,11 @@ void Thermostat::process_RC20Remote(std::shared_ptr telegram) { // e.g. "38 10 FF 00 03 2B 00 D1 08 2A 01" void Thermostat::process_RemoteTemp(std::shared_ptr telegram) { has_update(telegram, tempsensor1_, 0); + uint8_t hc = telegram->type_id - 0x42B; + if (Roomctrl::is_remote(hc)) { + toggle_fetch(0x273 + hc, false); + toggle_fetch(0xA6A + hc, false); + } } // 0x47B, ff - for reading humidity from the RC100H remote thermostat (0x38, 0x39, ..) @@ -1241,6 +1246,7 @@ void Thermostat::process_RC300Floordry(std::shared_ptr telegram) } // 0x291 ff. HP mode +// thermostat(0x10) -W-> Me(0x0B), HPMode(0x0291), data: 01 00 00 03 FF 00 void Thermostat::process_HPMode(std::shared_ptr telegram) { std::shared_ptr hc = heating_circuit(telegram); if (hc == nullptr) { @@ -4639,7 +4645,7 @@ void Thermostat::register_device_values_hc(std::shared_ptrmode, DeviceValueType::ENUM, FL_(enum_mode3), FL_(mode), DeviceValueUOM::NONE, MAKE_CF_CB(set_mode)); register_device_value(tag, &hc->modetype, DeviceValueType::ENUM, FL_(enum_modetype3), FL_(modetype), DeviceValueUOM::NONE); register_device_value( - tag, &hc->daytemp, DeviceValueType::UINT, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(daytemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daytemp), 5, 30); + tag, &hc->daytemp, DeviceValueType::UINT, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(daytemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daytemp), 10, 30); register_device_value(tag, &hc->nighttemp, DeviceValueType::UINT, @@ -4647,7 +4653,7 @@ void Thermostat::register_device_values_hc(std::shared_ptrdesigntemp, DeviceValueType::UINT, FL_(designtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_designtemp), 30, 90); register_device_value(tag, diff --git a/src/roomcontrol.cpp b/src/roomcontrol.cpp index eebace25f..62f10f690 100644 --- a/src/roomcontrol.cpp +++ b/src/roomcontrol.cpp @@ -182,14 +182,19 @@ void Roomctrl::version(uint8_t addr, uint8_t dst) { data[4] = type_; // set RC20 id 113, Ver 02.01 or Junkers FB10 id 109, Ver 16.05, RC100H id 200 ver 40.04 data[5] = type_ == RC20 ? 2 : type_ == FB10 ? 16 : type_ == RC200 ? 41 : 40; data[6] = type_ == RC20 ? 1 : type_ == FB10 ? 5 : type_ == RC200 ? 8 : 4; - if (type_ != RC200) { + if (type_ == RC20 || type_ == FB10) { data[7] = EMSbus::calculate_crc(data, 7); // apppend CRC EMSuart::transmit(data, 8); return; } + data[7] = 0; + data[8] = 0xFF; + if (type_ == RC100H) { + data[9] = EMSbus::calculate_crc(data, 9); // apppend CRC + EMSuart::transmit(data, 10); + return; + } // RC200 adds some extra bytes - data[7] = 0; - data[8] = 0xFF; data[9] = 0; data[10] = 0; data[11] = 0; @@ -242,7 +247,7 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) { data[2] = 0xFF; data[3] = 0; data[4] = 0; - data[5] = 0x23; // count with hc? + data[5] = 0x23; // fixed for all hc data[6] = (uint8_t)(remotetemp_[hc] >> 8); data[7] = (uint8_t)(remotetemp_[hc] & 0xFF); data[8] = EMSbus::calculate_crc(data, 8); // apppend CRC diff --git a/src/roomcontrol.h b/src/roomcontrol.h index 01137815f..443dfa371 100644 --- a/src/roomcontrol.h +++ b/src/roomcontrol.h @@ -29,6 +29,9 @@ class Roomctrl { static void set_remotetemp(const uint8_t type, const uint8_t hc, const int16_t temp); static void set_remotehum(const uint8_t type, const uint8_t hc, const int8_t hum); enum : uint8_t { RC20 = 113, FB10 = 109, RC100H = 200, SENSOR = 0x40, RC200 = 157 }; + static bool is_remote(const uint8_t hc) { + return (hc < 4 && remotetemp_[hc] != EMS_VALUE_SHORT_NOTSET); + } private: static constexpr uint8_t ADDR = 0x18; // address for hc1