From 1ec6866189f80ac17715527799341ade7b9e08f1 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Sun, 27 Dec 2020 13:05:05 +0100 Subject: [PATCH] fix bug when resetting switch and it's off --- custom_components/adaptive_lighting/switch.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 597928f3..0869accf 100755 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -241,12 +241,13 @@ async def handle_set_manual_control(switch: AdaptiveSwitch, service_call: Servic else: switch.turn_on_off_listener.reset(*all_lights) # pylint: disable=protected-access - await switch._adapt_lights( - all_lights, - transition=switch._initial_transition, - force=True, - context=switch.create_context("service"), - ) + if switch.is_on: + await switch._update_attrs_and_maybe_adapt_lights( + all_lights, + transition=switch._initial_transition, + force=True, + context=switch.create_context("service"), + ) @callback