Test that switch is on before updating time listeners (#936)

Co-authored-by: Michael Carroll <mjoecarroll@gmail.com>
This commit is contained in:
droans 2024-02-21 16:10:00 -05:00 committed by GitHub
commit 92aa50411a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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'",