From 830c5589f7076ef5ef094a0fcc2996bbf36ba5cc Mon Sep 17 00:00:00 2001 From: Florian Date: Fri, 24 Apr 2026 22:30:18 +0200 Subject: [PATCH] fix: reduce log verbosity for self-triggered off-to-on warning (#1433) (#1434) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: reduce log verbosity for self-triggered off-to-on warning (#1433) Move full event object dump from warning to debug level in _off_to_on_state_event_is_from_turn_on() (switch.py:2717). For lights with large effect_list attributes (e.g. Govee lights with 130+ effects), the warning dumped the entire Event object including both old_state and new_state, creating log entries thousands of characters long. The warning now logs only entity_id and context.id, while the full event remains available at debug level for troubleshooting. Fixes #1433 * fix: correct indentation for _LOGGER.debug block * fix: correct indentation for _LOGGER.warning and _LOGGER.debug * fix: remove unintended encoding corruption, keep only log level change Reset switch.py to main and re-apply only the intended change: move the full event object from warning to debug level in _off_to_on_state_event_is_from_turn_on(). Addresses reviewer feedback about unintended Unicode corruption (→ and ≈ characters were corrupted to mojibake). Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Florian Horner Co-authored-by: Bas Nijholt --- custom_components/adaptive_lighting/switch.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 91049970..b57aeaa7 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -2718,12 +2718,16 @@ class AdaptiveLightingManager: "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," + "Detected an 'off' → 'on' event for '%s' with context.id='%s'," + " triggered by the adaptive_lighting integration itself," " which *should* not happen. If you see this please submit an issue with" " your full logs at https://github.com/basnijholt/adaptive-lighting", entity_id, off_to_on_event.context.id, + ) + _LOGGER.debug( + "Full 'off' → 'on' event for '%s': %s", + entity_id, off_to_on_event, ) turn_on_event: Event | None = self.turn_on_event.get(entity_id)