UM SHT: MQTT re-publish values on unit change
This commit is contained in:
parent
ea6d339b9c
commit
f3d52f4932
@ -387,6 +387,7 @@ bool ShtUsermod::readFromConfig(JsonObject &root)
|
|||||||
|
|
||||||
bool oldEnabled = enabled;
|
bool oldEnabled = enabled;
|
||||||
byte oldShtType = shtType;
|
byte oldShtType = shtType;
|
||||||
|
byte oldUnitOfTemp = unitOfTemp;
|
||||||
bool oldHaMqttDiscovery = haMqttDiscovery;
|
bool oldHaMqttDiscovery = haMqttDiscovery;
|
||||||
|
|
||||||
getJsonValue(top[FPSTR(_enabled)], enabled);
|
getJsonValue(top[FPSTR(_enabled)], enabled);
|
||||||
@ -410,6 +411,11 @@ bool ShtUsermod::readFromConfig(JsonObject &root)
|
|||||||
initShtTempHumiditySensor();
|
initShtTempHumiditySensor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oldUnitOfTemp != unitOfTemp) {
|
||||||
|
publishTemperatureAndHumidityViaMqtt();
|
||||||
|
publishHomeAssistantAutodiscovery();
|
||||||
|
}
|
||||||
|
|
||||||
if (oldHaMqttDiscovery != haMqttDiscovery && haMqttDiscovery) {
|
if (oldHaMqttDiscovery != haMqttDiscovery && haMqttDiscovery) {
|
||||||
publishHomeAssistantAutodiscovery();
|
publishHomeAssistantAutodiscovery();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user