hass-core/tests/components/calendar
Allen Porter 9721ba59b6
Rewrite the calendar trigger to fix potential bugs ()
Update the calander event trigger logic to have more exhaustive coverage. The
trigger will now use a timespan to create an explicit window for considering
upcoming events. The start/end of the time span is now more explicit, rather
than getting it from the alarm time.

The trigger is now broken into composable pieces:
- A timespan object for more explicitly managing the time window
- A function to get events during a time span
- A function to process upcoming events and determine the trigger times

The existing listener is now just responsible for scheduling alarms and glue.

This fixes bug with DST handling where the conversion back and forth between
UTC and timezone ends up dropping events during the jump forward. In practice,
an event was returned from the scanning, but it was never fired by the trigger
because (1) it was filtered out of the interval and (2) the event list was
previously cleared every iteration so it would get dropped.

Future improvements can bake more invariant checking into this structure.
2023-03-19 23:42:12 -04:00
..
__init__.py
test_init.py Add additional CalendarEvent validation () 2023-03-14 20:27:38 -04:00
test_recorder.py Refactor recorder tests to use recorder history API () 2023-03-11 21:51:16 -05:00
test_trigger.py Rewrite the calendar trigger to fix potential bugs () 2023-03-19 23:42:12 -04:00