add RC120RF as remote

This commit is contained in:
MichaelDvP
2025-12-18 13:30:41 +01:00
parent 2821f8e750
commit 611b1d9aca
3 changed files with 37 additions and 5 deletions

View File

@@ -88,7 +88,7 @@ uint8_t Roomctrl::get_hc(uint8_t addr) {
* if remote control is active send the temperature every 15 seconds * if remote control is active send the temperature every 15 seconds
*/ */
void Roomctrl::send(uint8_t addr) { void Roomctrl::send(uint8_t addr) {
if (addr & 0x80) { if ((addr & 0x80) || EMSESP::system_.readonly_mode()) {
return; return;
} }
uint8_t hc = get_hc(addr); 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); 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 (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 (sendtype_[hc] == SendType::HUMI) { // send humidity
if (switch_off_[hc]) { if (switch_off_[hc]) {
remotehum_[hc] = EMS_VALUE_UINT8_NOTSET; 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 * 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) { 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); uint8_t hc = get_hc(addr);
if (hc >= HCS || length < 5) { if (hc >= HCS || length < 5) {
return; 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 data[7] = EMSbus::calculate_crc(data, 7); // append CRC
EMSuart::transmit(data, 8); EMSuart::transmit(data, 8);
return; 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[5] = 0x2B + hc;
data[6] = (uint8_t)(remotetemp_[hc] >> 8); data[6] = (uint8_t)(remotetemp_[hc] >> 8);
data[7] = (uint8_t)(remotetemp_[hc] & 0xFF); 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[8] = (uint8_t)(t1 >> 8);
data[9] = (uint8_t)(t1 & 0xFF); data[9] = (uint8_t)(t1 & 0xFF);
data[10] = 1; // not sure what this is and if we need it, maybe mode? 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[5] = 0x2B + hc;
data[6] = (uint8_t)(remotetemp_[hc] >> 8); data[6] = (uint8_t)(remotetemp_[hc] >> 8);
data[7] = (uint8_t)(remotetemp_[hc] & 0xFF); 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[8] = (uint8_t)(t1 >> 8);
data[9] = (uint8_t)(t1 & 0xFF); data[9] = (uint8_t)(t1 & 0xFF);
data[10] = 1; // not sure what this is and if we need it, maybe mode? 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[11] = 9; // not sure what this is and if we need it, maybe mode?
data[12] = EMSbus::calculate_crc(data, 12); // append CRC data[12] = EMSbus::calculate_crc(data, 12); // append CRC
EMSuart::transmit(data, 13); 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);
} }
} }

View File

@@ -25,7 +25,7 @@ namespace emsesp {
class Roomctrl { class Roomctrl {
public: public:
// Product-Id of the remote // 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 send(uint8_t addr);
static void check(uint8_t addr, const uint8_t * data, const uint8_t length); static void check(uint8_t addr, const uint8_t * data, const uint8_t length);

View File

@@ -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 Roomctrl::set_remotetemp(Roomctrl::RC100H, hc->hc(), hc->remotetemp); // RC100H
} else if (hc->control == 2) { // RC100(2) } else if (hc->control == 2) { // RC100(2)
Roomctrl::set_remotetemp(Roomctrl::RC100, hc->hc(), hc->remotetemp); // RC100 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) { } else if (hc->control == 6) {
Roomctrl::set_remotetemp(Roomctrl::RT800, hc->hc(), hc->remotetemp); Roomctrl::set_remotetemp(Roomctrl::RT800, hc->hc(), hc->remotetemp);
} else { } else {
@@ -2141,6 +2143,9 @@ bool Thermostat::set_remotehum(const char * value, const int8_t id) {
if (hc->control == 3) { if (hc->control == 3) {
Roomctrl::set_remotehum(Roomctrl::RC100H, hc->hc(), hc->remotehum); // RC100H Roomctrl::set_remotehum(Roomctrl::RC100H, hc->hc(), hc->remotehum); // RC100H
return true; return true;
} else if (hc->control == 5) {
Roomctrl::set_remotehum(Roomctrl::RC120RF, hc->hc(), hc->remotehum);
return true;
} else if (hc->control == 6) { } else if (hc->control == 6) {
Roomctrl::set_remotehum(Roomctrl::RT800, hc->hc(), hc->remotehum); Roomctrl::set_remotehum(Roomctrl::RT800, hc->hc(), hc->remotehum);
return true; 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); Roomctrl::set_remotetemp(Roomctrl::RC100, hc->hc(), hc->remotetemp);
} else if (ctrl == 3) { } else if (ctrl == 3) {
Roomctrl::set_remotetemp(Roomctrl::RC100H, hc->hc(), hc->remotetemp); 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) { } else if (ctrl == 6) {
Roomctrl::set_remotetemp(Roomctrl::RT800, hc->hc(), hc->remotetemp); Roomctrl::set_remotetemp(Roomctrl::RT800, hc->hc(), hc->remotetemp);
} else { } else {