From a5af7460139628ec763342075d212d7f6058df7f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 20 Apr 2020 13:21:29 -0500 Subject: [PATCH] Switch powerwall to async_on_remove (#34472) --- homeassistant/components/powerwall/entity.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/powerwall/entity.py b/homeassistant/components/powerwall/entity.py index 27c12ed23ce..c9cfd124ec6 100644 --- a/homeassistant/components/powerwall/entity.py +++ b/homeassistant/components/powerwall/entity.py @@ -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) + )