fix bug when resetting switch and it's off

This commit is contained in:
Bas Nijholt 2020-12-27 13:05:05 +01:00
commit 1ec6866189

View file

@ -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