From 69d4163b9d6d1375c43f670019484943097d51de Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Sun, 15 Mar 2026 14:12:47 +0100 Subject: [PATCH 1/3] fix device_class #2980 --- src/core/mqtt.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/mqtt.cpp b/src/core/mqtt.cpp index 225c7f56e..b73f4ef25 100644 --- a/src/core/mqtt.cpp +++ b/src/core/mqtt.cpp @@ -1191,7 +1191,11 @@ void Mqtt::add_ha_classes(JsonObject doc, const uint8_t device_type, const uint8 doc[ic_ha] = F_(iconpercent); // set icon } doc[sc_ha] = sc_ha_measurement; - doc[dc_ha] = "power_factor"; + if (entity == FL_(airHumidity)[0] || entity == FL_(remotehum)[0]) { + doc[dc_ha] = "humidity"; + } else if (entity == FL_(battery)[0]) { + doc[dc_ha] = "battery"; + } break; case DeviceValueUOM::SECONDS: case DeviceValueUOM::MINUTES: @@ -1544,8 +1548,8 @@ void Mqtt::add_ha_dev_section(JsonObject doc, const char * name, const bool crea } // add mf (manufacturer/brand), mdl (model), sw (software version) and via_device - dev_json["mf"] = brand != nullptr ? brand : "EMS-ESP"; - dev_json["mdl"] = model != nullptr ? model : "EMS-ESP"; + dev_json["mf"] = brand != nullptr ? brand : "EMS-ESP"; + dev_json["mdl"] = model != nullptr ? model : "EMS-ESP"; dev_json["sw"] = version != nullptr ? version : "v" + std::string(EMSESP_APP_VERSION); dev_json["via_device"] = Mqtt::basename(); } From a9f50d9371772722b22ba1066ea6fa89b99af791 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 16 Mar 2026 12:55:27 +0100 Subject: [PATCH 2/3] update version number fixes #2981 --- src/core/emsdevice.h | 4 ++++ src/core/emsesp.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/emsdevice.h b/src/core/emsdevice.h index eb7e9c2a9..f584e9b58 100644 --- a/src/core/emsdevice.h +++ b/src/core/emsdevice.h @@ -90,6 +90,10 @@ class EMSdevice { return version_; } + void version(const char * version) { + strlcpy(version_, version, sizeof(version_)); + } + uint8_t brand() const { return brand_; } diff --git a/src/core/emsesp.cpp b/src/core/emsesp.cpp index 4b9dae4a4..9286827b5 100644 --- a/src/core/emsesp.cpp +++ b/src/core/emsesp.cpp @@ -1307,9 +1307,16 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const // first check to see if we already have it, if so update the record for (auto it = emsdevices.begin(); it != emsdevices.end(); ++it) { if ((*it) && (*it)->is_device_id(device_id)) { - if (product_id == 0 || (*it)->product_id() != 0) { // update only with valid product_id + if (product_id == 0) { // no product-id, ignore + return false; + } + if ((*it)->product_id() == product_id) { // update version if we have valid product_id + if (!strcmp((*it)->version(), "00.00")) { + (*it)->version(version); + } return true; } + // product-id has changed for this device-id, delete and re-add (*it)->erase_device_values(); emsdevices.erase(it); // erase the old device without product_id and re detect break; From b0157f288ed9e9122fccf5b9d1c56ac95e9d2cfe Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 16 Mar 2026 14:01:45 +0100 Subject: [PATCH 3/3] update changelog, dev10 --- CHANGELOG_LATEST.md | 2 ++ src/emsesp_version.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 68de6dafb..7c69530ce 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -25,3 +25,5 @@ For more details go to [emsesp.org](https://emsesp.org/). - store scheduler active state to nvs [#2946](https://github.com/emsesp/EMS-ESP32/discussions/2946) - translated modes `heat` and `eco` for HA-climate mode-str-tpl - support `minflowtemp` and `baseflowtemp` [#2969](https://github.com/emsesp/EMS-ESP32/discussions/2969) +- update version if it is 00.00 in first read [#2981](https://github.com/emsesp/EMS-ESP32/issues/2981) +- device class for % values [#2980](https://github.com/emsesp/EMS-ESP32/issues/2980) diff --git a/src/emsesp_version.h b/src/emsesp_version.h index 4d8361cf0..f1c420f81 100644 --- a/src/emsesp_version.h +++ b/src/emsesp_version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.8.2-dev.9" +#define EMSESP_APP_VERSION "3.8.2-dev.10"