mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-12 06:44:04 +02:00
fix bug
This commit is contained in:
parent
58b4c639dd
commit
d06d4e706a
1 changed files with 7 additions and 7 deletions
|
|
@ -316,6 +316,12 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
rm_to = async_track_state_change(**kwgs, to_state=self._disable_state)
|
||||
self.unsub_trackers.extend([rm_from, rm_to])
|
||||
|
||||
def _unsub_trackers(self):
|
||||
assert self.unsub_trackers
|
||||
while self.unsub_trackers:
|
||||
unsub = self.unsub_trackers.pop()
|
||||
unsub()
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Icon to use in the frontend, if any."""
|
||||
|
|
@ -345,7 +351,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
return
|
||||
self._state = True
|
||||
if setup_listeners:
|
||||
self._setup_trackers()
|
||||
await self._setup_trackers()
|
||||
if adjust_lights:
|
||||
await self._update_lights(transition=self._initial_transition, force=True)
|
||||
|
||||
|
|
@ -356,12 +362,6 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
self._state = False
|
||||
self._unsub_trackers()
|
||||
|
||||
def _unsub_trackers(self):
|
||||
assert self.unsub_trackers
|
||||
while self.unsub_trackers:
|
||||
unsub = self.unsub_trackers.pop()
|
||||
unsub()
|
||||
|
||||
async def _update_attrs(self):
|
||||
"""Update Adaptive Values."""
|
||||
# Setting all values because this method takes <0.5ms to execute.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue