From f080107d86f417d31f30eef1277470ade745a2b2 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 13 May 2024 07:15:12 +0200 Subject: [PATCH 1/2] fix timout switchoff #1680 --- src/roomcontrol.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/roomcontrol.cpp b/src/roomcontrol.cpp index c30c055ad..ecad897e2 100644 --- a/src/roomcontrol.cpp +++ b/src/roomcontrol.cpp @@ -96,14 +96,13 @@ void Roomctrl::send(uint8_t addr) { return; } - if ((uuid::get_uptime() - receive_time_[hc]) > TIMEOUT) { + if (!switch_off_[hc] && (uuid::get_uptime() - receive_time_[hc]) > TIMEOUT) { remotetemp_[hc] = EMS_VALUE_INT16_NOTSET; switch_off_[hc] = true; - send_time_[hc] = uuid::get_uptime() - SEND_INTERVAL; // send now sendtype_[hc] = SendType::TEMP; EMSESP::logger().warning("remotetemp timeout hc%d, stop sending roomtemperature to thermostat", hc); } - if (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) { if (sendtype_[hc] == SendType::HUMI) { // send humidity if (switch_off_[hc]) { From 0f13449548b270037b49fe47109cab6b378e17ba Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Tue, 14 May 2024 07:37:04 +0200 Subject: [PATCH 2/2] fix missing vacation date #1712 --- src/devices/thermostat.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 46613654b..e7cedaef2 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -1542,18 +1542,18 @@ void Thermostat::process_RC30Vacation(std::shared_ptr telegram) } static uint8_t vacation_telegram[57] = {0}; // make a copy of the whole telegram to access blocks memcpy(&vacation_telegram[telegram->offset], telegram->message_data, telegram->message_length); - for (uint8_t index = 0; index < 8; index++) { + for (uint8_t index = 0, pos = 0; index < 8; index++, pos += 7) { char data[sizeof(vacation[0]) + 4]; // avoid compiler warning snprintf(data, sizeof(data), "%02d.%02d.%04d-%02d.%02d.%04d", - vacation_telegram[1 + 7 * index], - vacation_telegram[2 + 7 * index], - vacation_telegram[3 + 7 * index] + 2000, - vacation_telegram[4 + 7 * index], - vacation_telegram[5 + 7 * index], - vacation_telegram[6 + 7 * index] + 2000); - if (data[1] > '0') { + vacation_telegram[1 + pos], + vacation_telegram[2 + pos], + vacation_telegram[3 + pos] + 2000, + vacation_telegram[4 + pos], + vacation_telegram[5 + pos], + vacation_telegram[6 + pos] + 2000); + if (vacation_telegram[1 + pos]) { // data is set (day > 0) has_update(vacation[index], data, sizeof(vacation[0])); } }