Remember state of MQTT availability topics when reconfiguring (#55199)

This commit is contained in:
Erik Montnemery 2021-08-25 12:23:42 +02:00 committed by GitHub
parent ebe48e78b7
commit 3432efddaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -330,7 +330,10 @@ class MqttAvailability(Entity):
self.async_write_ha_state()
self._available = {topic: False for topic in self._avail_topics}
self._available = {
topic: (self._available[topic] if topic in self._available else False)
for topic in self._avail_topics
}
topics = {
f"availability_{topic}": {
"topic": topic,