OPT-27 round 2: a kept tomorrow figure is bounded on both sides

Hold.stand_in(): day0 <= now < day0 + 3 h. A tomorrow sensor is asked with
day0 = the next midnight, so the upper bound alone was true all day and a
figure stood in at any hour. test_opt27.py covers daytime tomorrow outages.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-10-30 18:54:41 +01:00
co-authored by Claude
parent 4fde0b177c
commit bf842997c1
2 changed files with 19 additions and 1 deletions
+3 -1
View File
@@ -327,7 +327,9 @@ class Hold:
day, at = rec
if (now - at).total_seconds() <= FRESH_S and not as_today:
return day, at, False
after_midnight = now < day0 + timedelta(hours=KEPT_UNTIL_H)
# Both sides: a tomorrow sensor is asked with day0 = the next
# midnight, which is in the future all day (round 2).
after_midnight = day0 <= now < day0 + timedelta(hours=KEPT_UNTIL_H)
evening = _local_hour(now) >= BELL_TO_H and now < day0 + timedelta(
days=1)
if as_today: