fix publish_ha_config, and add clear

This commit is contained in:
MichaelDvP
2021-04-10 13:32:09 +02:00
parent 4cac16093f
commit 015ab649af
3 changed files with 14 additions and 3 deletions

View File

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

View File

@@ -300,6 +300,8 @@ class EMSdevice {
ha_config_done_ = v;
}
void ha_config_clear();
enum Brand : uint8_t {
NO_BRAND = 0, // 0
BOSCH, // 1

View File

@@ -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();
}