From cebf31a203991d12184a3652ab8544ad18d0aca5 Mon Sep 17 00:00:00 2001 From: Benjamin Auquite Date: Mon, 3 Apr 2023 01:35:53 -0500 Subject: [PATCH 1/3] 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( From 2f0bad82ffbd55a3dc29fb809cf710c2d0859225 Mon Sep 17 00:00:00 2001 From: Benjamin Auquite Date: Mon, 3 Apr 2023 01:40:29 -0500 Subject: [PATCH 2/3] Update switch.py --- custom_components/adaptive_lighting/switch.py | 1 - 1 file changed, 1 deletion(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index a6fea1b2..f083adaa 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -1142,7 +1142,6 @@ 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 From 4479761ad720c9852f5288d2de2d260f4176b459 Mon Sep 17 00:00:00 2001 From: Benjamin Auquite Date: Mon, 3 Apr 2023 01:50:52 -0500 Subject: [PATCH 3/3] Update switch.py --- custom_components/adaptive_lighting/switch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index f083adaa..81bb365d 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -1891,7 +1891,7 @@ class TurnOnOffListener: light, context.id, ) - self.manual_control[light] = True + self.mark_as_manual_control(light) _fire_manual_control_event(switch, light, context, is_async=False) return True _LOGGER.debug(