Update switch.py

This commit is contained in:
Benjamin Auquite 2023-04-03 01:35:53 -05:00
commit cebf31a203

View file

@ -1145,8 +1145,6 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
# Return here if there's no lights to adapt.
if lights is None:
lights = self._lights
if not len(lights):
return
if not force:
if self._only_once:
@ -1156,6 +1154,9 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
if self.turn_on_off_listener.transition_timers.get(light):
lights.remove(light)
if not len(lights):
return
await self._adapt_lights(lights, transition, force, context)
async def _adapt_lights(