From cebf31a203991d12184a3652ab8544ad18d0aca5 Mon Sep 17 00:00:00 2001 From: Benjamin Auquite Date: Mon, 3 Apr 2023 01:35:53 -0500 Subject: [PATCH] Update switch.py --- custom_components/adaptive_lighting/switch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 5d708d60..a6fea1b2 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -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(