diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index dd4794682..8706eebe1 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -10,6 +10,7 @@ For more details go to [docs.emsesp.org](https://docs.emsesp.org/). - Flag for HMC310 [#2465](https://github.com/emsesp/EMS-ESP32/issues/2465) - boiler auxheatersource [#2489](https://github.com/emsesp/EMS-ESP32/discussions/2489) - thermostat last error for RC100/300 [#2501](https://github.com/emsesp/EMS-ESP32/issues/2501) +- boiler 0xC6 telegram [#1963](https://github.com/emsesp/EMS-ESP32/issues/1963) ## Fixed @@ -19,6 +20,7 @@ For more details go to [docs.emsesp.org](https://docs.emsesp.org/). - refresh scheduler states [#2502](https://github.com/emsesp/EMS-ESP32/discussions/2502) - also rebuild HA config on mqtt connect for scheduler, custom and shower - FB100 controls the hc, not the master [#2510](https://github.com/emsesp/EMS-ESP32/issues/2510) +- IPM DHW module, [#2524](https://github.com/emsesp/EMS-ESP32/issues/2524) ## Changed diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 956adfc25..8064fe626 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -34,6 +34,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const register_telegram_type(0x10, "UBAErrorMessage1", false, MAKE_PF_CB(process_UBAErrorMessage)); register_telegram_type(0x11, "UBAErrorMessage2", false, MAKE_PF_CB(process_UBAErrorMessage)); register_telegram_type(0xC2, "UBAErrorMessage3", false, MAKE_PF_CB(process_UBAErrorMessage2)); + register_telegram_type(0xC6, "UBAErrorMessage3", false, MAKE_PF_CB(process_UBAErrorMessage3)); register_telegram_type(0x14, "UBATotalUptime", true, MAKE_PF_CB(process_UBATotalUptime)); register_telegram_type(0x15, "UBAMaintenanceData", false, MAKE_PF_CB(process_UBAMaintenanceData)); register_telegram_type(0x1C, "UBAMaintenanceStatus", false, MAKE_PF_CB(process_UBAMaintenanceStatus)); @@ -1063,6 +1064,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const EMSESP::send_read_request(0x15, device_id); // read maintenance data on start (only published on change) EMSESP::send_read_request(0x1C, device_id); // read maintenance status on start (only published on change) EMSESP::send_read_request(0xC2, device_id); // read last errorcode on start (only published on errors) + EMSESP::send_read_request(0xC6, device_id); // read last errorcode on start (only published on errors) if (model() != EMSdevice::EMS_DEVICE_FLAG_HEATPUMP && model() != EMSdevice::EMS_DEVICE_FLAG_HIU) { @@ -1834,6 +1836,7 @@ void Boiler::process_UBAMaintenanceStatus(std::shared_ptr telegr // 0xBF void Boiler::process_ErrorMessage(std::shared_ptr telegram) { EMSESP::send_read_request(0xC2, device_id()); // read last errorcode + EMSESP::send_read_request(0xC6, device_id()); // read last errorcode } // 0x10, 0x11 @@ -1873,13 +1876,11 @@ void Boiler::process_UBAErrorMessage(std::shared_ptr telegram) { // 0xC2, without clock in system it stores 3 bytes uptime in 11 and 16, with clock date in 10-14, and 15-19 // date is marked with 0x80 to year-field -// also C6, C7 https://github.com/emsesp/EMS-ESP32/issues/938#issuecomment-1425813815 void Boiler::process_UBAErrorMessage2(std::shared_ptr telegram) { if (telegram->offset > 0 || telegram->message_length < 20) { return; } - static uint32_t lastCodeDate_ = 0; // last code date uint32_t date = 0; char code[sizeof(lastCode_)] = {0}; uint16_t codeNo = EMS_VALUE_INT16_NOTSET; @@ -1939,6 +1940,72 @@ void Boiler::process_UBAErrorMessage2(std::shared_ptr telegram) } } +// C6, C7 https://github.com/emsesp/EMS-ESP32/issues/938#issuecomment-1425813815 +// as C2, but offset shifted one byte +void Boiler::process_UBAErrorMessage3(std::shared_ptr telegram) { + if (telegram->offset > 0 || telegram->message_length < 21) { + return; + } + + uint32_t date = 0; + char code[sizeof(lastCode_)] = {0}; + uint16_t codeNo = EMS_VALUE_INT16_NOTSET; + code[0] = telegram->message_data[6]; + code[1] = telegram->message_data[7]; + code[2] = telegram->message_data[8]; + code[3] = 0; + telegram->read_value(codeNo, 9); + if (!std::isprint(code[0]) || !std::isprint(code[1]) || !std::isprint(code[2])) { + return; + } + + // check for valid date, https://github.com/emsesp/EMS-ESP32/issues/204 + if (telegram->message_data[11] & 0x80) { + uint16_t start_year = (telegram->message_data[11] & 0x7F) + 2000; + uint8_t start_month = telegram->message_data[12]; + uint8_t start_day = telegram->message_data[14]; + uint8_t start_hour = telegram->message_data[13]; + uint8_t start_min = telegram->message_data[15]; + uint16_t end_year = (telegram->message_data[16] & 0x7F) + 2000; + uint8_t end_month = telegram->message_data[17]; + uint8_t end_day = telegram->message_data[19]; + uint8_t end_hour = telegram->message_data[18]; + uint8_t end_min = telegram->message_data[20]; + + if (telegram->message_data[16] & 0x80) { //valid end date + date = (end_year - 2000) * 535680UL + end_month * 44640UL + end_day * 1440UL + end_hour * 60 + end_min; + snprintf(&code[3], + sizeof(code) - 3, + "(%d) %02d.%02d.%04d %02d:%02d - %02d.%02d.%04d %02d:%02d", + codeNo, + start_day, + start_month, + start_year, + start_hour, + start_min, + end_day, + end_month, + end_year, + end_hour, + end_min); + } else { // no valid end date means error still persists + date = (start_year - 2000) * 535680UL + start_month * 44640UL + start_day * 1440UL + start_hour * 60 + start_min; + snprintf(&code[3], sizeof(code) - 3, "(%d) %02d.%02d.%04d %02d:%02d - now", codeNo, start_day, start_month, start_year, start_hour, start_min); + } + } else { // no clock, the uptime is stored https://github.com/emsesp/EMS-ESP32/issues/121 + uint32_t starttime = 0; + uint32_t endtime = 0; + telegram->read_value(starttime, 12, 3); + telegram->read_value(endtime, 17, 3); + snprintf(&code[3], sizeof(code) - 3, "(%d) @uptime %lu - %lu min", codeNo, starttime, endtime); + date = starttime; + } + if (date > lastCodeDate_) { + lastCodeDate_ = date; + has_update(lastCode_, code, sizeof(lastCode_)); + } +} + // 0x15 maintenance data void Boiler::process_UBAMaintenanceData(std::shared_ptr telegram) { if (telegram->offset > 0 || telegram->message_length < 5) { diff --git a/src/devices/boiler.h b/src/devices/boiler.h index 694374e32..5befbffbf 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -149,6 +149,7 @@ class Boiler : public EMSdevice { char lastCode_[55]; // last error code char serviceCode_[4]; // 3 character status/service code uint16_t serviceCodeNumber_; // error/service code + uint32_t lastCodeDate_ = 0; // last code date uint8_t emergencyOps_; uint8_t emergencyTemp_; uint16_t headertemp_; // see #1317 @@ -355,6 +356,7 @@ class Boiler : public EMSdevice { void process_ErrorMessage(std::shared_ptr telegram); void process_UBAErrorMessage(std::shared_ptr telegram); void process_UBAErrorMessage2(std::shared_ptr telegram); + void process_UBAErrorMessage3(std::shared_ptr telegram); void process_UBAMonitorWWPlus(std::shared_ptr telegram); void process_UBAInformation(std::shared_ptr telegram); void process_UBAEnergySupplied(std::shared_ptr telegram); diff --git a/src/emsesp_version.h b/src/emsesp_version.h index 284d96474..3a453b8c0 100644 --- a/src/emsesp_version.h +++ b/src/emsesp_version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.3-dev.7" +#define EMSESP_APP_VERSION "3.7.3-dev.8"