mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-12 06:44:04 +02:00
merge wait_for_transition
This commit is contained in:
parent
8b2fcf93be
commit
85eb85cab6
1 changed files with 15 additions and 2 deletions
|
|
@ -1141,11 +1141,24 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
)
|
||||
)
|
||||
self.async_write_ha_state()
|
||||
|
||||
# Return here if there's no lights to adapt.
|
||||
if lights is None:
|
||||
lights = self._lights
|
||||
if (self._only_once and not force) or not lights:
|
||||
if not len(lights):
|
||||
return
|
||||
await self._adapt_lights(lights, transition, force, context)
|
||||
|
||||
if not force:
|
||||
if self._only_once:
|
||||
return
|
||||
for light in lights:
|
||||
# Don't adapt lights that haven't finished prior transitions.
|
||||
if self.turn_on_off_listener.transition_timers.get(light):
|
||||
lights.remove(light)
|
||||
|
||||
await self._update_manual_control_and_maybe_adapt(
|
||||
lights, transition, force, context
|
||||
)
|
||||
|
||||
async def _adapt_lights(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue