From 92aa50411a60e9779db035af5f3ad4d491336c6f Mon Sep 17 00:00:00 2001 From: droans <49721649+droans@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:10:00 -0500 Subject: [PATCH] Test that switch is on before updating time listeners (#936) Co-authored-by: Michael Carroll --- custom_components/adaptive_lighting/switch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 06cd2f87..cf38d21f 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -359,7 +359,8 @@ async def handle_change_switch_settings( # deep copy the defaults so we don't modify the original dicts switch._set_changeable_settings(data=data, defaults=deepcopy(defaults)) - switch._update_time_interval_listener() + if switch.is_on: + switch._update_time_interval_listener() _LOGGER.debug( "Called 'adaptive_lighting.change_switch_settings' service with '%s'",