Fix lingering timer in generic_hygrostat (#92575)
This commit is contained in:
parent
7e19bb4ee0
commit
7cb25e9710
1 changed files with 11 additions and 1 deletions
|
@ -172,7 +172,11 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
|
||||||
)
|
)
|
||||||
|
|
||||||
if self._keep_alive:
|
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):
|
async def _async_startup(event):
|
||||||
"""Init on startup."""
|
"""Init on startup."""
|
||||||
|
@ -216,6 +220,12 @@ class GenericHygrostat(HumidifierEntity, RestoreEntity):
|
||||||
|
|
||||||
await _async_startup(None) # init the sensor
|
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
|
@property
|
||||||
def available(self):
|
def available(self):
|
||||||
"""Return True if entity is available."""
|
"""Return True if entity is available."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue