diff --git a/usermods/sht/usermod_sht.h b/usermods/sht/usermod_sht.h index 88daeb43..652bdfde 100644 --- a/usermods/sht/usermod_sht.h +++ b/usermods/sht/usermod_sht.h @@ -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(); }