mqtt-HA-config dynamically

This commit is contained in:
MichaelDvP
2021-04-10 12:19:51 +02:00
parent b77d9d4125
commit 4cac16093f
3 changed files with 25 additions and 14 deletions

View File

@@ -440,8 +440,8 @@ void EMSESP::publish_device_values(uint8_t device_type) {
// group by device type
for (const auto & emsdevice : emsdevices) {
if (emsdevice && (emsdevice->device_type() == device_type)) {
// if we're using HA and it's not already done, send the config topics first. only do this once
if (Mqtt::ha_enabled() && (!emsdevice->ha_config_done())) {
// if we're using HA, if done is checked for each sensor in devices
if (Mqtt::ha_enabled()) {
emsdevice->publish_mqtt_ha_sensor(); // create the configs for each value as a sensor
}