Fix reconfiguring of Tasmota lights (#42288)
This commit is contained in:
1 parent
15f46392d2
commit
bfb603fe78
4 files changed
+41
-5
No files matched your search
@@ -80,10 +80,11 @@ class TasmotaLight(
|
||||
|
||||
self._setup_from_entity()
|
||||
|
||||
async def discovery_update(self, update):
|
||||
async def discovery_update(self, update, write_state=True):
|
||||
"""Handle updated discovery message."""
|
||||
await super().discovery_update(update, write_state=False)
|
||||
self._setup_from_entity()
|
||||
await super().discovery_update(update)
|
||||
self.async_write_ha_state()
|
||||
|
||||
def _setup_from_entity(self):
|
||||
"""(Re)Setup the entity."""
|
||||
|
||||
@@ -38,11 +38,12 @@ class TasmotaEntity(Entity):
|
||||
await self._tasmota_entity.unsubscribe_topics()
|
||||
await super().async_will_remove_from_hass()
|
||||
|
||||
async def discovery_update(self, update):
|
||||
async def discovery_update(self, update, write_state=True):
|
||||
"""Handle updated discovery message."""
|
||||
self._tasmota_entity.config_update(update)
|
||||
await self._subscribe_topics()
|
||||
self.async_write_ha_state()
|
||||
if write_state:
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def _subscribe_topics(self):
|
||||
"""(Re)Subscribe to topics."""
|
||||
|
||||
Reference in new issue
Block a user