diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index bbdb776fb..28f2ab0cc 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -770,8 +770,17 @@ void EMSdevice::publish_mqtt_ha_sensor() { dv.ha |= DeviceValueHA::HA_DONE; } } - // bool ok = publish_ha_config(); - // ha_config_done(ok); // see if it worked + if (!ha_config_done()) { + bool ok = publish_ha_config(); + ha_config_done(ok); // see if it worked + } +} + +void EMSdevice::ha_config_clear() { + for (auto & dv : devicevalues_) { + dv.ha &= ~DeviceValueHA::HA_DONE; + } + ha_config_done(false); } // return the name of the telegram type diff --git a/src/emsdevice.h b/src/emsdevice.h index 70479f8e8..e77d4e079 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -300,6 +300,8 @@ class EMSdevice { ha_config_done_ = v; } + void ha_config_clear(); + enum Brand : uint8_t { NO_BRAND = 0, // 0 BOSCH, // 1 diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 6d966bcd1..0f31a6751 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -423,7 +423,7 @@ void EMSESP::reset_mqtt_ha() { } for (const auto & emsdevice : emsdevices) { - emsdevice->ha_config_done(false); + emsdevice->ha_config_clear(); } dallassensor_.reload(); }