From d4dab148571eebd1a02df3f65cc66cec2ab14013 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Sun, 30 Jul 2023 13:21:07 -0700 Subject: [PATCH 1/2] Do not assert but issue a warning --- custom_components/adaptive_lighting/switch.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 2cf2c5db..a96351f2 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -2476,7 +2476,16 @@ def _off_to_on_state_event_is_from_turn_on( off_to_on_event: Event, ) -> bool: # Adaptive Lighting should never turn on lights itself - assert not is_our_context(off_to_on_event.context) + if is_our_context(off_to_on_event.context): + _LOGGER.warning( + "Detected an 'off' → 'on' event for '%s' with context.id='%s' and" + " event='%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, + off_to_on_event, + ) turn_on_event: Event | None = self.turn_on_event.get(entity_id) id_off_to_on = off_to_on_event.context.id return ( From 2f7eccda28ed0346dff005b07a6b643a9ce1b6ca Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Sun, 30 Jul 2023 13:23:11 -0700 Subject: [PATCH 2/2] bump to 1.18.2 --- custom_components/adaptive_lighting/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/adaptive_lighting/manifest.json b/custom_components/adaptive_lighting/manifest.json index 87996208..8d6a80b9 100644 --- a/custom_components/adaptive_lighting/manifest.json +++ b/custom_components/adaptive_lighting/manifest.json @@ -8,5 +8,5 @@ "iot_class": "calculated", "issue_tracker": "https://github.com/basnijholt/adaptive-lighting/issues", "requirements": ["ulid-transform"], - "version": "1.18.1" + "version": "1.18.2" }