diff --git a/goodwe_controller/DECISIONS/OPT-27-last-fresh-forecast-for-the-night.md b/goodwe_controller/DECISIONS/OPT-27-last-fresh-forecast-for-the-night.md index 8230585..973f238 100644 --- a/goodwe_controller/DECISIONS/OPT-27-last-fresh-forecast-for-the-night.md +++ b/goodwe_controller/DECISIONS/OPT-27-last-fresh-forecast-for-the-night.md @@ -20,7 +20,7 @@ still keeps a run under way when a read is lost. sensor that is missing or stale, never one with a bad value or unit, and: - for up to `FRESH_S` when 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`), however old; + (`KEPT_UNTIL_H`), if the reading is at most `KEPT_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); diff --git a/goodwe_controller/app/solarfc.py b/goodwe_controller/app/solarfc.py index 874b273..7ddfa82 100644 --- a/goodwe_controller/app/solarfc.py +++ b/goodwe_controller/app/solarfc.py @@ -34,7 +34,8 @@ evening and api.forecast.solar is sometimes out for a poll. A kept reading stands in for its sensor (a) for up to `FRESH_S` when the sensor is missing or unavailable, as a sensor that merely stopped updating is already tolerated, and (b) from the end of the bell (`BELL_TO_H`) until local -midnight + `KEPT_UNTIL_H` however old it is. Never beyond that, and never +midnight + `KEPT_UNTIL_H`, if it is at most `KEPT_MAX_AGE_S` old when used. +Never beyond that, and never for another day: a today figure is only today's, a tomorrow figure is tomorrow's until midnight and then, until midnight + 3 h, today's. DECISIONS/OPT-27-last-fresh-forecast-for-the-night.md. diff --git a/goodwe_controller/test_opt27.py b/goodwe_controller/test_opt27.py index 2c6289e..2793b49 100644 --- a/goodwe_controller/test_opt27.py +++ b/goodwe_controller/test_opt27.py @@ -7,8 +7,9 @@ Forecast.Solar site was "no forecast": a price mode's night cheap run needed fresh reading of each sensor, for the day it is FOR: * up to `FRESH_S` when the sensor is missing or unavailable (a short outage); -* from the end of the bell (20:00) until local midnight + 3 h however old it - is (the night plan); never beyond, never for another day. +* from the end of the bell (20:00) until local midnight + 3 h, if the reading + is at most `KEPT_MAX_AGE_S` (12 h) old when used (the night plan); never + beyond, never for another day. DECISIONS/OPT-27-last-fresh-forecast-for-the-night.md. @@ -166,7 +167,7 @@ check("... its sun is counted on the day it is for (06:00-20:00 on the 4th)", and fmid.between(at(4, 3, 0), at(4, 7, 0)) > 0.0) check("03:01 (midnight + 3 h): not used any more", rs(GONE, GONE, at(4, 3, 1), h2)[0] is None) -check("... and not the next evening either (older than one night)", +check("... and not the next evening either (past midnight + 3 h)", rs(GONE, GONE, at(4, 22, 0), h2)[0] is None) fe = rs(st(0.1, at(4, 21, 50)), GONE, at(4, 22, 0), h2)[0] check("... the next evening, with today fresh and tomorrow's sensor down, "