One stale Forecast.Solar tomorrow sensor dropped the whole OPT-17 sum from 17:54 to 20:00. Today readings and the OPT-34 morning rules are unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
3.3 KiB
OPT-27 - the night plan keeps the last fresh forecast
Status: done on release/1.0, not released. Tests: test_opt27.py.
The defect. A today sensor is stale after 3 h (FRESH_S) or when it is from
before local midnight. Forecast.Solar stops updating in the evening, so at night
every Forecast.Solar site had no forecast: a price mode's night cheap run needed
1.5x the cycle cost (TARIFF-24 round 2) and Leftover solar planned nothing.
Separately, one missed poll (unavailable) dropped the forecast at once.
Where: solarfc, not the plan. The last fresh reading of each sensor is
kept in solarfc.Hold and read_sum() uses it when a sensor has none. A hold
at the plan (_wx_track/weather_held) can only keep the 1.5x gap off. The
day plan, Leftover solar's levels, Home and the Forecast tab all read
Controller.solar_fc, so one kept forecast makes control and every screen agree
(UX-53) with no second rule to keep in step. weather_held() is unchanged: it
still keeps a run under way when a read is lost.
The rule (Hold.stand_in()). A kept reading is for one day. It covers a
sensor that is missing or stale, never one with a bad value or unit, and:
- for up to
FRESH_Swhen the sensor is missing: a short outage, any time of day; - from the end of the bell (20:00 local,
BELL_TO_H) until local midnight, if the reading is at mostKEPT_MAX_AGE_S(12 h) old when used; after midnight the tomorrow figure is today's until the bell starts (06:00), up to 15 h old (OPT-34 changed this from midnight + 3 h); - the day it is for: a today figure only on that day, a tomorrow figure as tomorrow until midnight and, if the today sensors are still stale, as today's until 06:00 (all sensors of the sum are needed, as for any sum);
- until the next fresh reading, which replaces it at once.
So a figure is never used for another day and never older than 12 hours (KEPT_MAX_AGE_S), except the morning case above: a 17:05 reading serves until 06:00 (12 h 55 min), a 09:05 reading only until 21:05. Until OPT-34 the figure ended at 03:00, and a charge under way lost its level there; OPT-34 closes that limit.
Daytime is as before: a sensor that stopped is stale after 3 h, and no forecast
all day is still no forecast (the night run still needs 1.5x).
Where it is stored. The controller's store, key solar_fc_hold, so an
evening restart keeps it. It is written when a reading's figure changes or
every 15 min (SAVE_EVERY_S), not on every poll. A damaged entry is dropped.
The screens. Forecast.kept is true when a reading older than FRESH_S is
in use; the forecast line then reads "Solar forecast read 17:05, kept for
tonight." (home_words.solar.kept, EN and NL). The event log says
"read, kept from 17:05".
Not changed. Control with modes off: it does not use the forecast. The screens still show the line, so it says "kept", not "used for the plan". A forecast that stays fresh. The hold does not look at the weather, only at the clock and the day.
OPT-38 (2026-11-07). A kept TOMORROW reading (at most KEPT_MAX_AGE_S old, same day0) now stands in at any hour, not only from BELL_TO_H: one sensor that stopped at 14:54 had dropped the whole sum (OPT-17) from 17:54 to 20:00. Today readings and the OPT-34 morning rules are unchanged; test_opt38.py.