From 18bdcfe0505d5faaceea2b9e1fb3bac327e3c41f Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Fri, 7 Mar 2025 18:12:05 +0100 Subject: [PATCH] fix lastcode #2438, heating/tapwater for heatpumps from activity #2450 --- src/devices/boiler.cpp | 23 ++++++++++++++--------- src/version.h | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 0929c3f52..5f528888e 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -1482,7 +1482,7 @@ void Boiler::process_UBAMonitorSlow(std::shared_ptr telegram) { */ void Boiler::process_UBAMonitorSlowPlus2(std::shared_ptr telegram) { has_update(telegram, absBurnPow_, 13); // current burner absolute power (percent of rating plate power) - if (model() == EMSdevice::EMS_DEVICE_FLAG_HIU || model() == EMSdevice::EMS_DEVICE_FLAG_HEATPUMP) { + if (model() == EMSdevice::EMS_DEVICE_FLAG_HIU) { uint8_t state = EMS_VALUE_UINT8_NOTSET; boilerState_ = 0; if (telegram->read_value(state, 2)) { @@ -1492,6 +1492,7 @@ void Boiler::process_UBAMonitorSlowPlus2(std::shared_ptr telegra if (telegram->read_value(state, 5)) { boilerState_ |= state == 1 ? 0x0A : 0; // dhw 0/1 } + check_active(); // do a quick check to see if the hot water or heating is active } } @@ -1688,6 +1689,8 @@ void Boiler::process_HpPower(std::shared_ptr telegram) { // has_update(hpCoolingOn_, hpActivity_ == 2 ? 0xFF : 0); // has_update(hpWwOn_, hpActivity_ == 3 ? 0xFF : 0); // has_update(hpPoolOn_, hpActivity_ == 4 ? 0xFF : 0); + boilerState_ = hpActivity_ == 1 ? 0x09 : hpActivity_ == 3 ? 0x0A : 0; + check_active(); // do a quick check to see if the hot water or heating is active } // Heatpump temperatures - type 0x48F @@ -1845,15 +1848,19 @@ void Boiler::process_UBAErrorMessage(std::shared_ptr telegram) { uint32_t date = (year - 2000) * 535680UL + month * 44640UL + day * 1440UL + hour * 60 + min + duration; // check valid https://github.com/emsesp/EMS-ESP32/issues/2189 if (day == 0 || day > 31 || month == 0 || month > 12 || !std::isprint(code[0]) || !std::isprint(code[1])) { + if (!lastCodeDate_) { + char newCode[sizeof(lastCode_)]; + snprintf(newCode, sizeof(lastCode_), "%s(%d)", code, codeNo); + has_update(lastCode_, newCode, sizeof(lastCode_)); + } return; } // store only the newest code from telegrams 10 and 11 - if (date > lastCodeDate_ && lastCodeDate_) { + if (date > lastCodeDate_) { lastCodeDate_ = date; - snprintf(lastCode_, sizeof(lastCode_), "%s(%d) %02d.%02d.%d %02d:%02d (%d min)", code, codeNo, day, month, year, hour, min, duration); - has_update(lastCode_); - } else if (!lastCodeDate_) { // no publish for first read - lastCodeDate_ = 1; + char newCode[sizeof(lastCode_)]; + snprintf(newCode, sizeof(lastCode_), "%s(%d) %02d.%02d.%d %02d:%02d (%d min)", code, codeNo, day, month, year, hour, min, duration); + has_update(lastCode_, newCode, sizeof(lastCode_)); } } @@ -1919,11 +1926,9 @@ void Boiler::process_UBAErrorMessage2(std::shared_ptr telegram) snprintf(&code[3], sizeof(code) - 3, "(%d) @uptime %lu - %lu min", codeNo, starttime, endtime); date = starttime; } - if (date > lastCodeDate_ && lastCodeDate_) { + if (date > lastCodeDate_) { lastCodeDate_ = date; has_update(lastCode_, code, sizeof(lastCode_)); - } else if (!lastCodeDate_) { - lastCodeDate_ = 1; } } diff --git a/src/version.h b/src/version.h index 7452a437a..c5e1f4c7a 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.2-dev.25" +#define EMSESP_APP_VERSION "3.7.2-dev.26"