Skip to content

Commit 1842ac9

Browse files
authored
Do not assert but issue a warning (#687)
* Do not assert but issue a warning * bump to 1.18.2
1 parent e98f0df commit 1842ac9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

custom_components/adaptive_lighting/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"iot_class": "calculated",
99
"issue_tracker": "https://github.com/basnijholt/adaptive-lighting/issues",
1010
"requirements": ["ulid-transform"],
11-
"version": "1.18.1"
11+
"version": "1.18.2"
1212
}

custom_components/adaptive_lighting/switch.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2476,7 +2476,16 @@ def _off_to_on_state_event_is_from_turn_on(
24762476
off_to_on_event: Event,
24772477
) -> bool:
24782478
# Adaptive Lighting should never turn on lights itself
2479-
assert not is_our_context(off_to_on_event.context)
2479+
if is_our_context(off_to_on_event.context):
2480+
_LOGGER.warning(
2481+
"Detected an 'off' → 'on' event for '%s' with context.id='%s' and"
2482+
" event='%s', triggered by the adaptive_lighting integration itself,"
2483+
" which *should* not happen. If you see this please submit an issue with"
2484+
" your full logs at https://github.com/basnijholt/adaptive-lighting",
2485+
entity_id,
2486+
off_to_on_event.context.id,
2487+
off_to_on_event,
2488+
)
24802489
turn_on_event: Event | None = self.turn_on_event.get(entity_id)
24812490
id_off_to_on = off_to_on_event.context.id
24822491
return (

0 commit comments

Comments
 (0)