Skip to content

Commit

Permalink
Allow adaptive_lighting.apply to turn on lights and do not issue log …
Browse files Browse the repository at this point in the history
…message (#705)
  • Loading branch information
basnijholt authored Aug 5, 2023
1 parent e3a84ff commit 51a18f2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/adaptive_lighting/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2694,7 +2694,10 @@ def _off_to_on_state_event_is_from_turn_on(
off_to_on_event: Event,
) -> bool:
# Adaptive Lighting should never turn on lights itself
if is_our_context(off_to_on_event.context):
if is_our_context(off_to_on_event.context) and not is_our_context(
off_to_on_event.context,
"service", # adaptive_lighting.apply is allowed to turn on lights
):
_LOGGER.warning(
"Detected an 'off' → 'on' event for '%s' with context.id='%s' and"
" event='%s', triggered by the adaptive_lighting integration itself,"
Expand Down

0 comments on commit 51a18f2

Please sign in to comment.