Switch powerwall to async_on_remove (#34472)

This commit is contained in:
J. Nick Koston 2020-04-20 13:21:29 -05:00 committed by GitHub
parent 4a788b62d1
commit a5af746013
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,8 +53,6 @@ class PowerWallEntity(Entity):
async def async_added_to_hass(self):
"""Subscribe to updates."""
self._coordinator.async_add_listener(self.async_write_ha_state)
async def async_will_remove_from_hass(self):
"""Undo subscription."""
self._coordinator.async_remove_listener(self.async_write_ha_state)
self.async_on_remove(
self._coordinator.async_add_listener(self.async_write_ha_state)
)