Merge pull request #2985 from MichaelDvP/dev

devcie class #2980 and version update #2981, dev10
This commit is contained in:
Proddy
2026-03-17 20:17:29 +01:00
committed by GitHub
5 changed files with 22 additions and 5 deletions

View File

@@ -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)

View File

@@ -90,6 +90,10 @@ class EMSdevice {
return version_;
}
void version(const char * version) {
strlcpy(version_, version, sizeof(version_));
}
uint8_t brand() const {
return brand_;
}

View File

@@ -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;

View File

@@ -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:

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.8.2-dev.9"
#define EMSESP_APP_VERSION "3.8.2-dev.10"