Repository navigation
Night engine fixes: Start now, Off after I'm up, switched-off nights, empty cutoff - #115
Merged
Merged
Conversation
…t, switched-off nights finish, empty cutoff doesn't outlive the afternoon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
A bug pass over the night engine (controller, night, presence, summary, away) turned up these, each checked in the code
and reproduced with a test that fails before the fix:
the pause, the ended flag or the stale out-of-bed time kept the side off.
of the coming one, so tonight's night still ran.
summary waited, and the noon rollover was held back.
then also blocked the evening's pre-conditioning (and "Start now" or "Resume") until someone lay down.
still saw the side as "off by the person", so the change wasn't treated as "turn my side on".
ask about a night the person was marked away.
Fix
tonight("start_now")clears the pause, the ended / lie-in-over flags, the out-of-bed times and the empty cutoff;resumeand any night start (_began) clear the empty cutoff, and so does entering pre-conditioning ("waiting").tonight("skip")setsskip_nextonce the night has ended by hand, as it already did after the planned end.adjust()counts a side it has just resumed as idle, so a temperature turns it on by hand.away.morning_checkalso treats a night as away when an ended away period covered at least half of it, andnight_verdictreturns "can't tell" when there are no rows.Noted and not changed here (each needs a decision, or is intentional):
mornings with a midnight bedtime work, so it needs a test against real data first).
Verification
tests/test_engine_fixes.py(6 scenario tests); all 6 fail on the old engine and pass now.(the soak test is left to CI).
Release note
Fixes: "Start now" starts even after a pause or getting up; "Off tonight" pressed after "I'm up" is for the coming
night; a night switched off still finishes properly (night summary and morning notification); an empty-bed cutoff in
the afternoon no longer stops the evening's pre-cooling; and the morning "Were you away?" question doesn't ask about
nights you were already marked away.