Skip to content

Wake: hold after the alarm rang; move earlier for an early calendar event - #116

Merged
ncbudd merged 2 commits into
mainfrom
wake-after-alarm
Nov 27, 2026
Merged

ncbudd merged 2 commits into
mainfrom
wake-after-alarm

Conversation

@ncbudd

@ncbudd ncbudd commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Two wake-up problems seen on a real morning.

The alarm rang, then the wake moved back into the night. The 6:00 alarm rang. The phone's "next alarm" then flipped between the snooze (6:10, 6:45, 6:55) and an 8:30 backup alarm. The wake followed the 8:30 alarm, and when the alarms were dismissed it went back to the planned 9:30. Getting up at 6:46 was then read as a night-time trip, and the side kept running.

  • Once the followed alarm has rung, a later alarm the phone shows while the person is still in bed (a snooze or a backup alarm) no longer moves the wake. Snoozes still get the longer get-up grace.
  • Staying in bed is handled by the lie-in as before: the side keeps the wake temperature until they get up.
  • A new alarm set after they got up (the night already over) is still followed, so going back to bed warms again (test_a_new_alarm_after_the_first_rang_reopens_the_finished_night). A backup alarm already seen while in bed doesn't reopen the night.

An early calendar event didn't move the wake. The calendar's early start (from the phone or an HA calendar) only fed a "Wake up earlier tonight" button on Tonight. Now the warm wake moves to 45 minutes before the event on its own (setting: Your nights → "Wake earlier for early events", on by default):

  • It only ever moves the wake earlier, at most 4 hours before the planned wake.
  • An earlier alarm wins, and a wake set by hand wins.
  • If the event is cancelled or moved before the wake, the wake goes back to the alarm's, or to the planned wake.
  • Events: wake_from_calendar and wake_calendar_cleared.

Also covered:

  • The calendar never moves the wake once the morning has begun, or after "I'm up" or a lie-in. When the first event starts, the next event doesn't push the wake later.
  • Deleting an alarm while the calendar sets the wake forgets that alarm, so it can't come back.
  • After the planned wake passes with no alarm, a later alarm doesn't push the wake back into the night.
  • A new alarm after getting up is followed only once they lie back down.
  • Neither the alarm nor the calendar acts while last night is still running past noon.
  • Switching either setting off gives back the wake it had moved.

Tests: test_wake_morning.py (13). The two alarm tests fail on the old code. test_snoozing_the_alarm_holds_the_wake now expects a backup alarm an hour later not to move the wake. About 380 related engine and simulation tests pass locally.

@ncbudd
ncbudd merged commit 7237cf9 into main Nov 27, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant