diff --git a/homeassistant/components/starline/entity.py b/homeassistant/components/starline/entity.py index f8846c2a97f..f940971c15c 100644 --- a/homeassistant/components/starline/entity.py +++ b/homeassistant/components/starline/entity.py @@ -2,8 +2,6 @@ from __future__ import annotations -from collections.abc import Callable - from homeassistant.helpers.entity import Entity from .account import StarlineAccount, StarlineDevice @@ -24,7 +22,6 @@ class StarlineEntity(Entity): self._key = key self._attr_unique_id = f"starline-{key}-{device.device_id}" self._attr_device_info = account.device_info(device) - self._unsubscribe_api: Callable | None = None @property def available(self) -> bool: @@ -38,11 +35,4 @@ class StarlineEntity(Entity): async def async_added_to_hass(self) -> None: """Call when entity about to be added to Home Assistant.""" await super().async_added_to_hass() - self._unsubscribe_api = self._account.api.add_update_listener(self.update) - - async def async_will_remove_from_hass(self) -> None: - """Call when entity is being removed from Home Assistant.""" - await super().async_will_remove_from_hass() - if self._unsubscribe_api is not None: - self._unsubscribe_api() - self._unsubscribe_api = None + self.async_on_remove(self._account.api.add_update_listener(self.update))