From b0a09747d4ae3017da965beab3be14e4c18a1f1e Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 28 Nov 2021 23:06:55 +0100 Subject: [PATCH 1/9] 3.3.1b0 --- CHANGELOG.md | 62 +++++++++++++++++++++++++++++++++++++++++++++ CHANGELOG_LATEST.md | 54 +-------------------------------------- src/version.h | 2 +- 3 files changed, 64 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e07faec1b..9d24ee944 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,68 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# [3.3.0] - November 28 2021 + +## Added + +- Add system commands for syslog level and watch [#98](https://github.com/emsesp/EMS-ESP32/issues/98) +- Added pool data to telegrams 0x494 & 0x495 [#102](https://github.com/emsesp/EMS-ESP32/issues/102) +- Add RC300 second summermode telegram [#108](https://github.com/emsesp/EMS-ESP32/issues/108) +- Add support for the RC25 thermostat [#106](https://github.com/emsesp/EMS-ESP32/issues/106) +- Add new command 'entities' for a device, e.g. http://ems-esp/api/boiler/entities to show the shortname, description and HA Entity name (if HA enabled) [#116](https://github.com/emsesp/EMS-ESP32/issues/116) +- Support for Junkers program and remote (fb10/fb110) temperature +- Home Assistant `state_class` attribute for Wh, kWh, W and KW [#129](https://github.com/emsesp/EMS-ESP32/issues/129) +- Add current room influence for RC300 [#136](https://github.com/emsesp/EMS-ESP32/issues/136) +- Added Home Assistant device_class to sensor entities +- Added another Buderus RC10 thermostat with Product ID 65 [#160](https://github.com/emsesp/EMS-ESP32/issues/160) +- Added support for mDNS [#161](https://github.com/emsesp/EMS-ESP32/issues/161) +- Added last system ESP32 reset code to log (and `system info` output) +- Firmware Checker in WebUI [#168](https://github.com/emsesp/EMS-ESP32/issues/168) +- Added new MQTT setting for enabling 'response' topic +- Support for non-standard Thermostats like Tado [#174](https://github.com/emsesp/EMS-ESP32/issues/174) +- Include MQTT connection status in 'api/system/info' +- Include Network status in 'api/system/info' and also the MQTT topic `info` [#202](https://github.com/emsesp/EMS-ESP32/issues/202) +- Added Ethernet PHY module as an option in the Board Profile [#210](https://github.com/emsesp/EMS-ESP32/issues/210) + +## Fixed + +- MQTT reconnecting after WiFi reconnect [#99](https://github.com/emsesp/EMS-ESP32/issues/99) +- Manually Controlling Solar Circuit [#107](https://github.com/emsesp/EMS-ESP32/issues/107) +- Fix thermostat commands not defaulting to the master thermostat [#110](https://github.com/emsesp/EMS-ESP32/issues/110) +- Enlarge parse-buffer for long names like `cylinderpumpmodulation` +- MQTT not subscribing to all device entities [#166](https://github.com/emsesp/EMS-ESP32/issues/166) +- Help fix issues with WebUI unable to fully load UI over Ethernet [#177](https://github.com/emsesp/EMS-ESP32/issues/177) +- Shower alert never reset after limit reached when enabled [(PR #185)] +- Remove HA entity entries when a device value goes dormant [#196](https://github.com/emsesp/EMS-ESP32/issues/196) +- deciphering last error code dates on 0xC2 telegram [#204](https://github.com/emsesp/EMS-ESP32/issues/204) + +## Changed + +- Syslog BOM only for utf-8 messages [#91](https://github.com/emsesp/EMS-ESP32/issues/91) +- Check for KM200 by device-id 0x48, remove tx-delay [#90](https://github.com/emsesp/EMS-ESP32/issues/90) +- rename `fastheatupfactor` to `fastheatup` and add percent [#122](https://github.com/emsesp/EMS-ESP32/issues/122) +- "unit" renamed to "uom" in API call to recall a Device Value +- initial backend React changes to replace the class components (HOCs) with React Hooks +- Use program-names instead of numbers +- Boiler's maintenancemessage always published in MQTT (to prevent HA missing entity) +- Unit of Measure 'times' added to MQTT Fails, Rx fails, Rx received, Tx fails, Tx reads & Tx writes +- Improved API. Restful HTTP API works in the same way as MQTT calls +- Removed settings for MQTT subscribe format [#173](https://github.com/emsesp/EMS-ESP32/issues/173) +- Improve Nefit Moduline 200 functionality [#183](https://github.com/emsesp/EMS-ESP32/issues/183) +- `status` in the MQTT heartbeat renamed to `bus_status` +- Layout changes in the WebUI, showing stripped table rows in Dashboard +- Alternative font for log window [#219](https://github.com/emsesp/EMS-ESP32/issues/219) + +## **BREAKING CHANGES** + +- API: "unit" renamed to "uom" in API call to recall a Device Value +- HA: `sensor.boiler_boiler_temperature` renamed to `sensor.actual_boiler_temperature` +- HA: `binary_sensor.boiler_ww_disinfecting` renamed to `binary_sensor.boiler_ww_disinfection` +- HA: # removed from counts in MQTT Fails, Rx fails, Rx received, Tx fails, Tx reads & Tx writes +- `txread` renamed to `txreads` and `txwrite` renamed to `txwrites` in MQTT heartbeat payload +- 'dallas sensors' in api/system/info moved to the "System" section. Renamed "uptime (seconds)" and "reset reason" +- `status` in the MQTT heartbeat renamed to `bus_status` + # [3.2.1] August 8 2021 ## Added diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 345b28a1b..1ebf139d2 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -1,63 +1,11 @@ # Changelog -# [3.3.0] +# [3.3.1] ## Added -- Add system commands for syslog level and watch [#98](https://github.com/emsesp/EMS-ESP32/issues/98) -- Added pool data to telegrams 0x494 & 0x495 [#102](https://github.com/emsesp/EMS-ESP32/issues/102) -- Add RC300 second summermode telegram [#108](https://github.com/emsesp/EMS-ESP32/issues/108) -- Add support for the RC25 thermostat [#106](https://github.com/emsesp/EMS-ESP32/issues/106) -- Add new command 'entities' for a device, e.g. http://ems-esp/api/boiler/entities to show the shortname, description and HA Entity name (if HA enabled) [#116](https://github.com/emsesp/EMS-ESP32/issues/116) -- Support for Junkers program and remote (fb10/fb110) temperature -- Home Assistant `state_class` attribute for Wh, kWh, W and KW [#129](https://github.com/emsesp/EMS-ESP32/issues/129) -- Add current room influence for RC300 [#136](https://github.com/emsesp/EMS-ESP32/issues/136) -- Added Home Assistant device_class to sensor entities -- Added another Buderus RC10 thermostat with Product ID 65 [#160](https://github.com/emsesp/EMS-ESP32/issues/160) -- Added support for mDNS [#161](https://github.com/emsesp/EMS-ESP32/issues/161) -- Added last system ESP32 reset code to log (and `system info` output) -- Firmware Checker in WebUI [#168](https://github.com/emsesp/EMS-ESP32/issues/168) -- Added new MQTT setting for enabling 'response' topic -- Support for non-standard Thermostats like Tado [#174](https://github.com/emsesp/EMS-ESP32/issues/174) -- Include MQTT connection status in 'api/system/info' -- Include Network status in 'api/system/info' and also the MQTT topic `info` [#202](https://github.com/emsesp/EMS-ESP32/issues/202) -- Added Ethernet PHY module as an option in the Board Profile [#210](https://github.com/emsesp/EMS-ESP32/issues/210) - ## Fixed -- MQTT reconnecting after WiFi reconnect [#99](https://github.com/emsesp/EMS-ESP32/issues/99) -- Manually Controlling Solar Circuit [#107](https://github.com/emsesp/EMS-ESP32/issues/107) -- Fix thermostat commands not defaulting to the master thermostat [#110](https://github.com/emsesp/EMS-ESP32/issues/110) -- Enlarge parse-buffer for long names like `cylinderpumpmodulation` -- MQTT not subscribing to all device entities [#166](https://github.com/emsesp/EMS-ESP32/issues/166) -- Help fix issues with WebUI unable to fully load UI over Ethernet [#177](https://github.com/emsesp/EMS-ESP32/issues/177) -- Shower alert never reset after limit reached when enabled [(PR #185)] -- Remove HA entity entries when a device value goes dormant [#196](https://github.com/emsesp/EMS-ESP32/issues/196) -- deciphering last error code dates on 0xC2 telegram [#204](https://github.com/emsesp/EMS-ESP32/issues/204) - ## Changed -- Syslog BOM only for utf-8 messages [#91](https://github.com/emsesp/EMS-ESP32/issues/91) -- Check for KM200 by device-id 0x48, remove tx-delay [#90](https://github.com/emsesp/EMS-ESP32/issues/90) -- rename `fastheatupfactor` to `fastheatup` and add percent [#122](https://github.com/emsesp/EMS-ESP32/issues/122) -- "unit" renamed to "uom" in API call to recall a Device Value -- initial backend React changes to replace the class components (HOCs) with React Hooks -- Use program-names instead of numbers -- Boiler's maintenancemessage always published in MQTT (to prevent HA missing entity) -- Unit of Measure 'times' added to MQTT Fails, Rx fails, Rx received, Tx fails, Tx reads & Tx writes -- Improved API. Restful HTTP API works in the same way as MQTT calls -- Removed settings for MQTT subscribe format [#173](https://github.com/emsesp/EMS-ESP32/issues/173) -- Improve Nefit Moduline 200 functionality [#183](https://github.com/emsesp/EMS-ESP32/issues/183) -- `status` in the MQTT heartbeat renamed to `bus_status` -- Layout changes in the WebUI, showing stripped table rows in Dashboard -- Alternative font for log window [#219](https://github.com/emsesp/EMS-ESP32/issues/219) - ## **BREAKING CHANGES** - -- API: "unit" renamed to "uom" in API call to recall a Device Value -- HA: `sensor.boiler_boiler_temperature` renamed to `sensor.actual_boiler_temperature` -- HA: `binary_sensor.boiler_ww_disinfecting` renamed to `binary_sensor.boiler_ww_disinfection` -- HA: # removed from counts in MQTT Fails, Rx fails, Rx received, Tx fails, Tx reads & Tx writes -- `txread` renamed to `txreads` and `txwrite` renamed to `txwrites` in MQTT heartbeat payload -- 'dallas sensors' in api/system/info moved to the "System" section. Renamed "uptime (seconds)" and "reset reason" -- `status` in the MQTT heartbeat renamed to `bus_status` diff --git a/src/version.h b/src/version.h index 4a86c7c82..37decfc86 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.3.0b11" +#define EMSESP_APP_VERSION "3.3.1b0" From 3c6fd0c83a5a0793ce915cb5b637223176463f47 Mon Sep 17 00:00:00 2001 From: pswid <78219494+pswid@users.noreply.github.com> Date: Fri, 3 Dec 2021 08:58:19 +0100 Subject: [PATCH 2/9] Update boiler.cpp --- src/devices/boiler.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 35a1fdbef..b519967e6 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -815,10 +815,11 @@ void Boiler::process_UBAErrorMessage(std::shared_ptr telegram) { // 0xC2 void Boiler::process_UBAErrorMessage2(std::shared_ptr telegram) { - // not sure why this test is in , so removing - // if (telegram->offset > 0 || telegram->message_length < 14) { - // return; - // } + // for decoding "last error code" we need telegram starting with offset 0 + if (telegram->offset != 0 || telegram->message_length < 14) { + return; + } + char code[4]; uint16_t codeNo; char start_time[17]; From 69976c2cafd98d56cea196586bd3f5f7240e9fe2 Mon Sep 17 00:00:00 2001 From: pswid <78219494+pswid@users.noreply.github.com> Date: Fri, 3 Dec 2021 09:02:36 +0100 Subject: [PATCH 3/9] Update CHANGELOG_LATEST.md --- CHANGELOG_LATEST.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 1ebf139d2..1e0d3f44d 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -5,6 +5,7 @@ ## Added ## Fixed +- lastcode broke MQTT JSON structure [#228] ## Changed From 92da61376b081fa7d3d01c4ce2642175154d0d8a Mon Sep 17 00:00:00 2001 From: pswid <78219494+pswid@users.noreply.github.com> Date: Fri, 3 Dec 2021 09:04:39 +0100 Subject: [PATCH 4/9] Update boiler.cpp --- src/devices/boiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index b519967e6..c942f5009 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -816,7 +816,7 @@ void Boiler::process_UBAErrorMessage(std::shared_ptr telegram) { // 0xC2 void Boiler::process_UBAErrorMessage2(std::shared_ptr telegram) { // for decoding "last error code" we need telegram starting with offset 0 - if (telegram->offset != 0 || telegram->message_length < 14) { + if (telegram->offset != 0 || telegram->message_length < 20) { return; } From 1343bbf6eab9b5883349ca2abbc97c9daf112fe8 Mon Sep 17 00:00:00 2001 From: pswid <78219494+pswid@users.noreply.github.com> Date: Fri, 3 Dec 2021 11:50:52 +0100 Subject: [PATCH 5/9] fix overlapping 0xC2 and overflow of offset --- CHANGELOG_LATEST.md | 2 ++ src/telegram.cpp | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 1e0d3f44d..4403b16b0 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -6,6 +6,8 @@ ## Fixed - lastcode broke MQTT JSON structure [#228] +- overlapping while reading 0xC2 from Boiler +- redundant telegram readings (because of offset overflow) ## Changed diff --git a/src/telegram.cpp b/src/telegram.cpp index f56ac0148..c15b6e730 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -613,7 +613,19 @@ uint16_t TxService::read_next_tx(uint8_t offset) { if (telegram_last_->offset != offset) { return 0; } - add(Telegram::Operation::TX_READ, telegram_last_->dest, telegram_last_->type_id, telegram_last_->offset + 25, message_data, 1, 0, true); + + uint8_t add_offset; + if (telegram_last_->dest == 0x08 && telegram_last_->type_id == 0xC2) { //fix for overlapping 0xC2 telegrams from Boiler. Are other telegrams also affected? + add_offset = 27; + } else { + add_offset = 25; + } + + if (UINT8_MAX - telegram_last_->offset < add_offset) { //stop if new offset would overflow + return 0; + } + + add(Telegram::Operation::TX_READ, telegram_last_->dest, telegram_last_->type_id, telegram_last_->offset + add_offset, message_data, 1, 0, true); return telegram_last_->type_id; } From 9cd20cfc05beb66b54f1210e60d3b9aeb9ca535e Mon Sep 17 00:00:00 2001 From: pswid <78219494+pswid@users.noreply.github.com> Date: Tue, 14 Dec 2021 10:29:15 +0100 Subject: [PATCH 6/9] fix overlaping while reading sequence of EMS1.0 telegrams --- CHANGELOG_LATEST.md | 2 +- src/emsesp.cpp | 2 +- src/telegram.cpp | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 4403b16b0..f29d2b944 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -6,7 +6,7 @@ ## Fixed - lastcode broke MQTT JSON structure [#228] -- overlapping while reading 0xC2 from Boiler +- overlapping while reading sequence of EMS1.0 telegrams - redundant telegram readings (because of offset overflow) ## Changed diff --git a/src/emsesp.cpp b/src/emsesp.cpp index bd7ce5cca..d31849933 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -1191,7 +1191,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { txservice_.send_poll(); // close the bus txservice_.reset_retry_count(); tx_successful = true; - // if telegram is longer read next part with offset + 25 for ems+ + // if telegram is longer read next part with offset +25 for ems+ or +27 for ems1.0 if (length == 32) { if (txservice_.read_next_tx(data[3]) == read_id_) { read_next_ = true; diff --git a/src/telegram.cpp b/src/telegram.cpp index c15b6e730..ed58277d5 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -613,12 +613,19 @@ uint16_t TxService::read_next_tx(uint8_t offset) { if (telegram_last_->offset != offset) { return 0; } +<<<<<<< Updated upstream uint8_t add_offset; if (telegram_last_->dest == 0x08 && telegram_last_->type_id == 0xC2) { //fix for overlapping 0xC2 telegrams from Boiler. Are other telegrams also affected? add_offset = 27; } else { add_offset = 25; +======= + + uint8_t add_offset = 25; //for EMS+ telegram increase offset by 25 + if (telegram_last_->type_id < 0x100) { //but for EMS1.0 by 27 + add_offset = 27; +>>>>>>> Stashed changes } if (UINT8_MAX - telegram_last_->offset < add_offset) { //stop if new offset would overflow From 7f30e8dadc8742adf78a487243899a88909bb9ba Mon Sep 17 00:00:00 2001 From: pswid <78219494+pswid@users.noreply.github.com> Date: Tue, 14 Dec 2021 10:32:31 +0100 Subject: [PATCH 7/9] fix overlaping while reading sequence of EMS1.0 telegrams --- src/telegram.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/telegram.cpp b/src/telegram.cpp index ed58277d5..c4166db8b 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -613,19 +613,10 @@ uint16_t TxService::read_next_tx(uint8_t offset) { if (telegram_last_->offset != offset) { return 0; } -<<<<<<< Updated upstream - - uint8_t add_offset; - if (telegram_last_->dest == 0x08 && telegram_last_->type_id == 0xC2) { //fix for overlapping 0xC2 telegrams from Boiler. Are other telegrams also affected? - add_offset = 27; - } else { - add_offset = 25; -======= uint8_t add_offset = 25; //for EMS+ telegram increase offset by 25 if (telegram_last_->type_id < 0x100) { //but for EMS1.0 by 27 add_offset = 27; ->>>>>>> Stashed changes } if (UINT8_MAX - telegram_last_->offset < add_offset) { //stop if new offset would overflow From 312f9693643b2a9fbf3d48fa22cd75bb560e99b4 Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 14 Dec 2021 21:19:54 +0100 Subject: [PATCH 8/9] add back RC30 - Setting mode on a RC30/Moduline400 via MQTT in HA doesn't work #243 --- CHANGELOG_LATEST.md | 4 +++- src/devices/thermostat.cpp | 14 ++++++++++++++ src/telegram.cpp | 9 +++++---- src/version.h | 2 +- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index f29d2b944..13aeab59e 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -5,9 +5,11 @@ ## Added ## Fixed -- lastcode broke MQTT JSON structure [#228] + +- lastcode broke MQTT JSON structure [#228](https://github.com/emsesp/EMS-ESP32/issues/228) - overlapping while reading sequence of EMS1.0 telegrams - redundant telegram readings (because of offset overflow) +- added missing RC30/Moduline400 [#243](https://github.com/emsesp/EMS-ESP32/issues/243) ## Changed diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 741256cb8..f2e900c15 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -2691,6 +2691,17 @@ void Thermostat::register_device_values() { case EMS_DEVICE_FLAG_RC20: register_device_value(TAG_THERMOSTAT_DATA, &dateTime_, DeviceValueType::STRING, nullptr, FL_(dateTime), DeviceValueUOM::NONE); // can't set datetime break; + case EMS_DEVICE_FLAG_RC30: + register_device_value(TAG_THERMOSTAT_DATA, &dateTime_, DeviceValueType::STRING, nullptr, FL_(dateTime), DeviceValueUOM::NONE); // can't set datetime + register_device_value(TAG_THERMOSTAT_DATA, &ibaMainDisplay_, DeviceValueType::ENUM, FL_(enum_ibaMainDisplay), FL_(ibaMainDisplay), DeviceValueUOM::NONE); + register_device_value(TAG_THERMOSTAT_DATA, &ibaLanguage_, DeviceValueType::ENUM, FL_(enum_ibaLanguage), FL_(ibaLanguage), DeviceValueUOM::NONE); + register_device_value(TAG_THERMOSTAT_DATA, + &ibaClockOffset_, + DeviceValueType::INT, + nullptr, + FL_(ibaClockOffset), + DeviceValueUOM::SECONDS); // offset (in sec) to clock, 0xff=-1s, 0x02=2s + break; case EMS_DEVICE_FLAG_RC30_N: register_device_value(TAG_THERMOSTAT_DATA, &dateTime_, DeviceValueType::STRING, nullptr, FL_(dateTime), DeviceValueUOM::NONE); // can't set datetime register_device_value(TAG_THERMOSTAT_DATA, &ibaMainDisplay_, DeviceValueType::ENUM, FL_(enum_ibaMainDisplay), FL_(ibaMainDisplay), DeviceValueUOM::NONE); @@ -2940,6 +2951,9 @@ void Thermostat::register_device_values_hc(std::shared_ptrsummertemp, DeviceValueType::UINT, nullptr, FL_(summertemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_summertemp)); register_device_value(tag, &hc->summermode, DeviceValueType::BOOL, nullptr, FL_(summermode), DeviceValueUOM::NONE); break; + case EMS_DEVICE_FLAG_RC30: + register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode3), FL_(mode), DeviceValueUOM::NONE, MAKE_CF_CB(set_mode)); + break; case EMS_DEVICE_FLAG_RC30_N: case EMS_DEVICE_FLAG_RC35: register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode3), FL_(mode), DeviceValueUOM::NONE, MAKE_CF_CB(set_mode)); diff --git a/src/telegram.cpp b/src/telegram.cpp index c4166db8b..186430b91 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -607,19 +607,20 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram_last_), true, get_post_send_query()); } +// send a request to read the next block of data from longer telegrams uint16_t TxService::read_next_tx(uint8_t offset) { // add to the top/front of the queue uint8_t message_data[1] = {EMS_MAX_TELEGRAM_LENGTH}; // request all data, 32 bytes if (telegram_last_->offset != offset) { return 0; } - - uint8_t add_offset = 25; //for EMS+ telegram increase offset by 25 - if (telegram_last_->type_id < 0x100) { //but for EMS1.0 by 27 + + uint8_t add_offset = 25; // for EMS+ telegram increase offset by 25 + if (telegram_last_->type_id < 0x100) { // but for EMS1.0 by 27 add_offset = 27; } - if (UINT8_MAX - telegram_last_->offset < add_offset) { //stop if new offset would overflow + if (UINT8_MAX - telegram_last_->offset < add_offset) { // stop if new offset would overflow return 0; } diff --git a/src/version.h b/src/version.h index 37decfc86..5987e4f1f 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.3.1b0" +#define EMSESP_APP_VERSION "3.3.1b1" From e9588cc7a14e0d2b9b9d4b2b7d47db2adb8f85ec Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Thu, 20 Jan 2022 08:33:04 +0100 Subject: [PATCH 9/9] check received status before toggling fetch on empty telegram --- CHANGELOG_LATEST.md | 1 + src/emsdevice.cpp | 13 +++++++------ src/emsdevice.h | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 13aeab59e..90b48d1f8 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -10,6 +10,7 @@ - overlapping while reading sequence of EMS1.0 telegrams - redundant telegram readings (because of offset overflow) - added missing RC30/Moduline400 [#243](https://github.com/emsesp/EMS-ESP32/issues/243) +- check received status before toggling fetch on empty telegram [#268][#282] ## Changed diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index d2c3e0d47..60a3a2d87 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -461,7 +461,7 @@ void EMSdevice::show_mqtt_handlers(uuid::console::Shell & shell) { // register a callback function for a specific telegram type void EMSdevice::register_telegram_type(const uint16_t telegram_type_id, const __FlashStringHelper * telegram_type_name, bool fetch, const process_function_p f) { - telegram_functions_.emplace_back(telegram_type_id, telegram_type_name, fetch, f); + telegram_functions_.emplace_back(telegram_type_id, telegram_type_name, fetch, false, f); } // add to device value library, also know now as a "device entity" @@ -1156,17 +1156,18 @@ const std::string EMSdevice::telegram_type_name(std::shared_ptr // take a telegram_type_id and call the matching handler // return true if match found bool EMSdevice::handle_telegram(std::shared_ptr telegram) { - for (const auto & tf : telegram_functions_) { + for (auto & tf : telegram_functions_) { if (tf.telegram_type_id_ == telegram->type_id) { - // if the data block is empty, assume that this telegram is not recognized by the bus master - // so remove it from the automatic fetch list - if (telegram->message_length == 0 && telegram->offset == 0) { + // if the data block is empty and we have not received data before, assume that this telegram + // is not recognized by the bus master. So remove it from the automatic fetch list + if (telegram->message_length == 0 && telegram->offset == 0 && !tf.received_) { EMSESP::logger().debug(F("This telegram (%s) is not recognized by the EMS bus"), read_flash_string(tf.telegram_type_name_).c_str()); - toggle_fetch(tf.telegram_type_id_, false); + tf.fetch_ = false; return false; } if (telegram->message_length > 0) { + tf.received_ = true; tf.process_function_(telegram); } diff --git a/src/emsdevice.h b/src/emsdevice.h index cea919fb3..dd936ccb1 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -407,12 +407,14 @@ class EMSdevice { uint16_t telegram_type_id_; // it's type_id const __FlashStringHelper * telegram_type_name_; // e.g. RC20Message bool fetch_; // if this type_id be queried automatically + bool received_; process_function_p process_function_; - TelegramFunction(uint16_t telegram_type_id, const __FlashStringHelper * telegram_type_name, bool fetch, const process_function_p process_function) + TelegramFunction(uint16_t telegram_type_id, const __FlashStringHelper * telegram_type_name, bool fetch, bool received, const process_function_p process_function) : telegram_type_id_(telegram_type_id) , telegram_type_name_(telegram_type_name) , fetch_(fetch) + , received_(received) , process_function_(process_function) { } };