2.7 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 + 3 h (KEPT_UNTIL_H), if the reading is at mostKEPT_MAX_AGE_S(12 h) old when used; - 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 midnight + 3 h (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): a 17:05 reading serves until 03:00 (9 h 55 min), a 09:05 reading only until 21:05.
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.