From 11b268148b098af4f790a6f41c8b87b14ea0748a Mon Sep 17 00:00:00 2001 From: Benjamin Auquite Date: Sat, 8 Apr 2023 13:11:54 -0500 Subject: [PATCH] Revert "cleaned up" This reverts commit 441cb1ff5cc45eb3438f7e367e8f22cea061ba73. --- custom_components/adaptive_lighting/switch.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index d241ad31..d410f28e 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -1234,6 +1234,8 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity): transition: int | None, force: bool, context: Context | None, + adapt_brightness: bool | None = None, + adapt_color: bool | None = None, ) -> None: assert context is not None _LOGGER.debug( @@ -1245,8 +1247,10 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity): context.id, ) - adapt_brightness = self.adapt_brightness_switch.is_on - adapt_color = self.adapt_color_switch.is_on + if adapt_brightness is None: + adapt_brightness = self.adapt_brightness_switch.is_on + if adapt_color is None: + adapt_color = self.adapt_color_switch.is_on for light in lights: if not is_on(self.hass, light): @@ -1278,7 +1282,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity): context, ) ): - _fire_manual_control_event(self, light, context) + _fire_manual_control_event(self, light, context, is_async=False) continue await self._adapt_light(light, transition, force=force, context=context)