From 611b1d9aca5741fdd050ef0b6f09cf0f8ad8599d Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Thu, 18 Dec 2025 13:30:41 +0100 Subject: [PATCH] add RC120RF as remote --- src/core/roomcontrol.cpp | 33 +++++++++++++++++++++++++++++---- src/core/roomcontrol.h | 2 +- src/devices/thermostat.cpp | 7 +++++++ 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/core/roomcontrol.cpp b/src/core/roomcontrol.cpp index 4d8fd7bac..de3bacac0 100644 --- a/src/core/roomcontrol.cpp +++ b/src/core/roomcontrol.cpp @@ -88,7 +88,7 @@ uint8_t Roomctrl::get_hc(uint8_t addr) { * if remote control is active send the temperature every 15 seconds */ void Roomctrl::send(uint8_t addr) { - if (addr & 0x80) { + if ((addr & 0x80) || EMSESP::system_.readonly_mode()) { return; } uint8_t hc = get_hc(addr); @@ -108,7 +108,7 @@ void Roomctrl::send(uint8_t addr) { EMSESP::logger().warning("remotetemp timeout hc%d, stop sending roomtemperature to thermostat", hc); } if (switch_off_[hc] || (uuid::get_uptime() - send_time_[hc]) > SEND_INTERVAL) { // check interval - if (type_[hc] == RC100H || type_[hc] == RT800) { + if (type_[hc] == RC100H || type_[hc] == RT800 || type_[hc] == RC120RF) { if (sendtype_[hc] == SendType::HUMI) { // send humidity if (switch_off_[hc]) { remotehum_[hc] = EMS_VALUE_UINT8_NOTSET; @@ -145,6 +145,9 @@ void Roomctrl::send(uint8_t addr) { * check if there is a message for the remote room controller */ void Roomctrl::check(uint8_t addr, const uint8_t * data, const uint8_t length) { + if (EMSESP::system_.readonly_mode()) { + return; + } uint8_t hc = get_hc(addr); if (hc >= HCS || length < 5) { return; @@ -249,6 +252,14 @@ void Roomctrl::version(uint8_t addr, uint8_t dst, uint8_t hc) { data[7] = EMSbus::calculate_crc(data, 7); // append CRC EMSuart::transmit(data, 8); return; + } else if (type_[hc] == RC120RF) { + data[5] = 16; // version 16.02 + data[6] = 2; + data[7] = 0; + data[8] = 0xFF; + data[9] = EMSbus::calculate_crc(data, 9); // append CRC + EMSuart::transmit(data, 10); + return; } } @@ -308,7 +319,7 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) { data[5] = 0x2B + hc; data[6] = (uint8_t)(remotetemp_[hc] >> 8); data[7] = (uint8_t)(remotetemp_[hc] & 0xFF); - uint16_t t1 = remotetemp_[hc] * 10 + 3; + uint16_t t1 = remotetemp_[hc] * 10; data[8] = (uint8_t)(t1 >> 8); data[9] = (uint8_t)(t1 & 0xFF); data[10] = 1; // not sure what this is and if we need it, maybe mode? @@ -339,13 +350,27 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) { data[5] = 0x2B + hc; data[6] = (uint8_t)(remotetemp_[hc] >> 8); data[7] = (uint8_t)(remotetemp_[hc] & 0xFF); - uint16_t t1 = remotetemp_[hc] * 10 + 3; + uint16_t t1 = remotetemp_[hc] * 10; data[8] = (uint8_t)(t1 >> 8); data[9] = (uint8_t)(t1 & 0xFF); data[10] = 1; // not sure what this is and if we need it, maybe mode? data[11] = 9; // not sure what this is and if we need it, maybe mode? data[12] = EMSbus::calculate_crc(data, 12); // append CRC EMSuart::transmit(data, 13); + } else if (type_[hc] == RC120RF) { + data[2] = 0xFF; + data[3] = 0; + data[4] = 3; + data[5] = 0x2B + hc; + data[6] = (uint8_t)(remotetemp_[hc] >> 8); + data[7] = (uint8_t)(remotetemp_[hc] & 0xFF); + uint16_t t1 = remotetemp_[hc] * 10; + data[8] = (uint8_t)(t1 >> 8); + data[9] = (uint8_t)(t1 & 0xFF); + data[10] = 0; // not sure what this is and if we need it + data[11] = 0; // not sure what this is and if we need it + data[12] = EMSbus::calculate_crc(data, 12); // append CRC + EMSuart::transmit(data, 13); } } diff --git a/src/core/roomcontrol.h b/src/core/roomcontrol.h index 939f54353..b7adb5df3 100644 --- a/src/core/roomcontrol.h +++ b/src/core/roomcontrol.h @@ -25,7 +25,7 @@ namespace emsesp { class Roomctrl { public: // Product-Id of the remote - enum RemoteType : uint8_t { NONE = 0, RC20 = 113, FB10 = 109, RC100H = 200, SENSOR = 0x40, RC200 = 157, RC100 = 165, RT800 = 3 }; + enum RemoteType : uint8_t { NONE = 0, RC20 = 113, FB10 = 109, RC100H = 200, SENSOR = 0x40, RC200 = 157, RC100 = 165, RT800 = 3, RC120RF = 249 }; static void send(uint8_t addr); static void check(uint8_t addr, const uint8_t * data, const uint8_t length); diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 98b965a44..30d102465 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -2109,6 +2109,8 @@ bool Thermostat::set_remotetemp(const char * value, const int8_t id) { Roomctrl::set_remotetemp(Roomctrl::RC100H, hc->hc(), hc->remotetemp); // RC100H } else if (hc->control == 2) { // RC100(2) Roomctrl::set_remotetemp(Roomctrl::RC100, hc->hc(), hc->remotetemp); // RC100 + } else if (hc->control == 5) { + Roomctrl::set_remotetemp(Roomctrl::RC120RF, hc->hc(), hc->remotetemp); } else if (hc->control == 6) { Roomctrl::set_remotetemp(Roomctrl::RT800, hc->hc(), hc->remotetemp); } else { @@ -2141,6 +2143,9 @@ bool Thermostat::set_remotehum(const char * value, const int8_t id) { if (hc->control == 3) { Roomctrl::set_remotehum(Roomctrl::RC100H, hc->hc(), hc->remotehum); // RC100H return true; + } else if (hc->control == 5) { + Roomctrl::set_remotehum(Roomctrl::RC120RF, hc->hc(), hc->remotehum); + return true; } else if (hc->control == 6) { Roomctrl::set_remotehum(Roomctrl::RT800, hc->hc(), hc->remotehum); return true; @@ -2310,6 +2315,8 @@ bool Thermostat::set_control(const char * value, const int8_t id) { Roomctrl::set_remotetemp(Roomctrl::RC100, hc->hc(), hc->remotetemp); } else if (ctrl == 3) { Roomctrl::set_remotetemp(Roomctrl::RC100H, hc->hc(), hc->remotetemp); + } else if (ctrl == 5) { + Roomctrl::set_remotetemp(Roomctrl::RC120RF, hc->hc(), hc->remotetemp); // RC120 } else if (ctrl == 6) { Roomctrl::set_remotetemp(Roomctrl::RT800, hc->hc(), hc->remotetemp); } else {