mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Fix lingering timer in lifx (#92476)
* Fix lingering timer in lifx * Remove duplicate code
This commit is contained in:
parent
a73a66bb0c
commit
8a9b9c35e0
@ -170,9 +170,7 @@ class LIFXLight(LIFXEntity, LightEntity):
|
||||
|
||||
async def update_during_transition(self, when: int) -> None:
|
||||
"""Update state at the start and end of a transition."""
|
||||
if self.postponed_update:
|
||||
self.postponed_update()
|
||||
self.postponed_update = None
|
||||
self._cancel_postponed_update()
|
||||
|
||||
# Transition has started
|
||||
self.async_write_ha_state()
|
||||
@ -327,6 +325,17 @@ class LIFXLight(LIFXEntity, LightEntity):
|
||||
)
|
||||
return await super().async_added_to_hass()
|
||||
|
||||
def _cancel_postponed_update(self) -> None:
|
||||
"""Cancel postponed update, if applicable."""
|
||||
if self.postponed_update:
|
||||
self.postponed_update()
|
||||
self.postponed_update = None
|
||||
|
||||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Run when entity will be removed from hass."""
|
||||
self._cancel_postponed_update()
|
||||
return await super().async_will_remove_from_hass()
|
||||
|
||||
|
||||
class LIFXWhite(LIFXLight):
|
||||
"""Representation of a white-only LIFX light."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user