Allow adaptive_lighting.apply to turn on lights and do not issue log message (#705)

This commit is contained in:
Bas Nijholt 2023-08-05 13:59:58 -07:00 committed by GitHub
commit 51a18f2afb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2694,7 +2694,10 @@ class AdaptiveLightingManager:
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,"