Set entities as unavailable in HA if state undefined

This commit is contained in:
iranl
2025-01-22 22:08:27 +01:00
parent c67edb3b5a
commit 13494d69c5
6 changed files with 50 additions and 7 deletions

View File

@@ -347,6 +347,15 @@ void NukiNetworkOpener::publishKeyTurnerState(const NukiOpener::OpenerState& key
publishState(keyTurnerState);
}
}
if(strcmp(str, "undefined") == 0)
{
_nukiPublisher->publishString(mqtt_topic_lock_availability, "offline", true);
}
else
{
_nukiPublisher->publishString(mqtt_topic_lock_availability, "online", true);
}
json["lock_state"] = str;