Use async_on_remove for WLED DataUpdateCoordinator (#36640)

This commit is contained in:
Franck Nijhof authored and GitHub committed 2020-06-10 16:02:45 -06:00
1 parent ddb85cee7b
commit 59f935beb0
1 file changed
+3 -5
+3 -5
View File
@@ -180,11 +180,9 @@ class WLEDEntity(Entity):
async def async_added_to_hass(self) -> None:
"""Connect to dispatcher listening for entity data notifications."""
self.coordinator.async_add_listener(self.async_write_ha_state)
async def async_will_remove_from_hass(self) -> None:
"""Disconnect from update signal."""
self.coordinator.async_remove_listener(self.async_write_ha_state)
self.async_on_remove(
self.coordinator.async_add_listener(self.async_write_ha_state)
)
async def async_update(self) -> None:
"""Update WLED entity."""