From c71034ff12c186fc54480942f1c5ddb39309acf3 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Sat, 7 Jun 2025 11:57:01 +0200 Subject: [PATCH 1/4] analog counter save to nvs on command and update --- src/core/analogsensor.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/analogsensor.cpp b/src/core/analogsensor.cpp index ff3d7baf8..d33131d79 100644 --- a/src/core/analogsensor.cpp +++ b/src/core/analogsensor.cpp @@ -63,7 +63,7 @@ void AnalogSensor::reload(bool get_nvs) { sensors_.clear(); return; } - + changed_ = true; // load the list of analog sensors from the customization service // and store them locally and then activate them EMSESP::webCustomizationService.read([&](WebCustomization & settings) { @@ -74,10 +74,15 @@ void AnalogSensor::reload(bool get_nvs) { for (const auto & sensor : settings.analogCustomizations) { // search customlist if (sensor_.gpio() == sensor.gpio) { // for output sensors set value to new start-value - if ((sensor.type == AnalogType::COUNTER || sensor.type >= AnalogType::DIGITAL_OUT) + if (sensor.type >= AnalogType::DIGITAL_OUT && (sensor_.type() != sensor.type || sensor_.offset() != sensor.offset || sensor_.factor() != sensor.factor)) { sensor_.set_value(sensor.offset); } + if (sensor.type == AnalogType::COUNTER && sensor_.offset() != sensor.offset + && sensor.offset != EMSESP::nvs_.getDouble(sensor.name.c_str(), 0)) { + EMSESP::nvs_.putDouble(sensor.name.c_str(), sensor.offset); + sensor_.set_value(sensor.offset); + } sensor_.set_name(sensor.name); sensor_.set_type(sensor.type); sensor_.set_offset(sensor.offset); @@ -799,7 +804,8 @@ bool AnalogSensor::command_setvalue(const char * value, const int8_t gpio) { // sensor.set_offset(val); sensor.set_value(val); } - if (oldoffset != sensor.offset() && sensor.offset() != EMSESP::nvs_.getDouble(sensor.name().c_str())) { + sensor.set_offset(sensor.value()); + if (sensor.value() != EMSESP::nvs_.getDouble(sensor.name().c_str(), 0)) { EMSESP::nvs_.putDouble(sensor.name().c_str(), sensor.value()); } } else if (sensor.type() == AnalogType::ADC) { From faa2c5f1aa4f70bd4e2c7a46552e8736b288c304 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Sat, 7 Jun 2025 11:57:53 +0200 Subject: [PATCH 2/4] set CS5800iG as gas boiler and HP, #2569 --- src/core/device_library.h | 3 ++- src/core/emsesp.cpp | 17 +++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/core/device_library.h b/src/core/device_library.h index 77cec8d25..f628d8df1 100644 --- a/src/core/device_library.h +++ b/src/core/device_library.h @@ -26,7 +26,7 @@ // Boilers - 0x08 { 8, DeviceType::BOILER, "CS5800i, CS6800i, WLW176i, WLW186i", DeviceFlags::EMS_DEVICE_FLAG_CS6800}, { 12, DeviceType::BOILER, "C1200W", DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{ 16, DeviceType::BOILER, "CS5800iG", DeviceFlags::EMS_DEVICE_FLAG_CS6800}, +{ 16, DeviceType::BOILER, "CS5800iG", DeviceFlags::EMS_DEVICE_FLAG_NONE}, { 64, DeviceType::BOILER, "BK13/BK15, Smartline, GB1*2", DeviceFlags::EMS_DEVICE_FLAG_NONE}, { 72, DeviceType::BOILER, "Logano GB1*5, Logamatic MC10", DeviceFlags::EMS_DEVICE_FLAG_EMS}, { 81, DeviceType::BOILER, "Cascade CM10", DeviceFlags::EMS_DEVICE_FLAG_NONE}, @@ -154,6 +154,7 @@ // Heat Pumps - 0x53 {248, DeviceType::HEATPUMP, "Hybrid Manager HM200", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{16, DeviceType::HEATPUMP, "CSH5800iG", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // Ventilation - 0x51 {231, DeviceType::VENTILATION, "Logavent HRV176", DeviceFlags::EMS_DEVICE_FLAG_NONE}, diff --git a/src/core/emsesp.cpp b/src/core/emsesp.cpp index a5951afea..364525be2 100644 --- a/src/core/emsesp.cpp +++ b/src/core/emsesp.cpp @@ -1002,11 +1002,16 @@ void EMSESP::process_deviceName(std::shared_ptr telegram) { // e.g. 09 0B 02 00 PP V1 V2 void EMSESP::process_version(std::shared_ptr telegram) { // check for valid telegram, just in case - if (telegram->message_length < 3) { - // for empty telegram add device with empty product, version and brand - if (!telegram->message_length) { - (void)add_device(telegram->src, 0, "00.00", 0); - } + if (telegram->offset != 0) { + return; + } + // for empty telegram add device with empty product, version and brand + if (telegram->message_length == 0) { + (void)add_device(telegram->src, 0, "00.00", 0); + return; + } else if (telegram->message_length < 3) { + (void)add_device(telegram->src, telegram->message_data[0], "00.00", 0); + send_read_request(EMSdevice::EMS_TYPE_NAME, telegram->src, 27); return; } @@ -1014,7 +1019,7 @@ void EMSESP::process_version(std::shared_ptr telegram) { uint8_t offset = 0; if (telegram->message_data[0] == 0x00) { // see if we have a 2nd subscriber - if (telegram->message_data[3] != 0x00) { + if (telegram->message_length > 5 && telegram->message_data[3] != 0x00) { offset = 3; } else { return; // ignore whole telegram From 32d7cf4e9ced873938bf532465dbc762facb4f4f Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Wed, 11 Jun 2025 11:35:01 +0200 Subject: [PATCH 3/4] fix possible crash --- src/web/WebSettingsService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/WebSettingsService.cpp b/src/web/WebSettingsService.cpp index 30e2432d5..688318728 100644 --- a/src/web/WebSettingsService.cpp +++ b/src/web/WebSettingsService.cpp @@ -116,7 +116,7 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) { String nvs_boot = EMSESP::nvs_.getString("boot"); if (!nvs_boot.isEmpty()) { #if defined(EMSESP_DEBUG) - EMSESP::logger().debug("Overriding board profile with NVS boot value %s"); + EMSESP::logger().debug("Overriding board profile with NVS boot value %s", nvs_boot.c_str()); #endif settings.board_profile = nvs_boot; } From aca66457f9c4032e7946b8aebcec8e4d369c93f0 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Fri, 13 Jun 2025 08:03:10 +0200 Subject: [PATCH 4/4] fixes crashs: revert to platform 6.10.0 --- CHANGELOG_LATEST.md | 1 + platformio.ini | 4 ++-- src/emsesp_version.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 1de0af73e..cb4900d5b 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -13,6 +13,7 @@ For more details go to [docs.emsesp.org](https://docs.emsesp.org/). - boiler 0xC6 telegram [#1963](https://github.com/emsesp/EMS-ESP32/issues/1963) - CS6800i changes [#2448](https://github.com/emsesp/EMS-ESP32/issues/2448), [#2449](https://github.com/emsesp/EMS-ESP32/issues/2449) - charging pump [#2544](https://github.com/emsesp/EMS-ESP32/issues/2544) +- Hybrid CSH5800iG [#2569](https://github.com/emsesp/EMS-ESP32/issues/2569) ## Fixed diff --git a/platformio.ini b/platformio.ini index d3af983af..0f095e423 100644 --- a/platformio.ini +++ b/platformio.ini @@ -54,7 +54,7 @@ framework = arduino board_build.partitions = partitions/esp32_partition_16M.csv board_upload.flash_size = 16MB board_build.app_partition_name = app0 -platform = espressif32@6.11.0 ; Arduino Core v2.0.17 / IDF v4.4.7 +platform = espressif32@6.10.0 ; Arduino Core v2.0.17 / IDF v4.4.7 ; 32MB Flash variants [espressif32_base_32M] @@ -62,7 +62,7 @@ framework = arduino board_build.partitions = partitions/esp32_partition_32M.csv board_upload.flash_size = 32MB board_build.app_partition_name = app0 -platform = espressif32@6.11.0 ; Arduino Core 2.0.17 / IDF 4.4.7 +platform = espressif32@6.10.0 ; Arduino Core 2.0.17 / IDF 4.4.7 ; use Tasmota's library for 4MB Flash variants. ; Removes libs (like mbedtsl, so no WiFi_secure.h) to increase available heap diff --git a/src/emsesp_version.h b/src/emsesp_version.h index e7604e47b..dae21cbaf 100644 --- a/src/emsesp_version.h +++ b/src/emsesp_version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.3-dev.12" +#define EMSESP_APP_VERSION "3.7.3-dev.13"