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;
|
||||
byte oldShtType = shtType;
|
||||
byte oldUnitOfTemp = unitOfTemp;
|
||||
bool oldHaMqttDiscovery = haMqttDiscovery;
|
||||
|
||||
getJsonValue(top[FPSTR(_enabled)], enabled);
|
||||
@ -410,6 +411,11 @@ bool ShtUsermod::readFromConfig(JsonObject &root)
|
||||
initShtTempHumiditySensor();
|
||||
}
|
||||
|
||||
if (oldUnitOfTemp != unitOfTemp) {
|
||||
publishTemperatureAndHumidityViaMqtt();
|
||||
publishHomeAssistantAutodiscovery();
|
||||
}
|
||||
|
||||
if (oldHaMqttDiscovery != haMqttDiscovery && haMqttDiscovery) {
|
||||
publishHomeAssistantAutodiscovery();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user