Fix lingering timer in generic_hygrostat (#92575)
parent
7e19bb4ee0
commit
7cb25e9710
|
@ -172,7 +172,11 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
|
|||
)
|
||||
|
||||
if self._keep_alive:
|
||||
async_track_time_interval(self.hass, self._async_operate, self._keep_alive)
|
||||
self.async_on_remove(
|
||||
async_track_time_interval(
|
||||
self.hass, self._async_operate, self._keep_alive
|
||||
)
|
||||
)
|
||||
|
||||
async def _async_startup(event):
|
||||
"""Init on startup."""
|
||||
|
@ -216,6 +220,12 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
|
|||
|
||||
await _async_startup(None) # init the sensor
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Run when entity will be removed from hass."""
|
||||
if self._remove_stale_tracking:
|
||||
self._remove_stale_tracking()
|
||||
return await super().async_will_remove_from_hass()
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
"""Return True if entity is available."""
|
||||
|
|
Loading…
Reference in New Issue