SAFETY-128: control does not act on late Home Assistant readings
Readings that Home Assistant delivers late but still changing passed every staleness gate, so the loop corrected again each cycle an error its last command had already fixed (10 s late: the give run swung and exported to -1.9 kW), and the peak guard pushed to the inverter limit on the same late figures (OPT-34 F-2). app/lateness.py fits how long after a power request the meter shows it. Over 8 s the readings are late: a request the battery reading has not answered holds the loop (it may not lead the reading by more than 100 W) and caps the peak guard at what stands; unanswered for 23 s it holds, then 0 W after stale_input_s. An amber row and one log line per episode say so. With readings on time nothing changes (digests equal). DECISIONS/SAFETY-128-late-readings.md; test_safety128.py. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bdqr7PiaHcBnzPituu2yTC
This commit is contained in:
co-authored by
Claude
parent
77fe31b161
commit
09e1fbb898
@@ -644,6 +644,19 @@ def row_controller_stalled(age_s, veto_s) -> str:
|
||||
f"stuurmodule zet de omvormer na {seconden(veto_s)} op 0 W.")
|
||||
|
||||
|
||||
def row_readings_late(delay_s, zero=False) -> str:
|
||||
"""SAFETY-128: Home Assistant readings arrive late; past the hold, 0 W."""
|
||||
if zero:
|
||||
return Bi(f"Home Assistant readings arrive about {seconds(delay_s)} "
|
||||
f"late, so every inverter is at 0 W.",
|
||||
f"Metingen uit Home Assistant komen zo'n "
|
||||
f"{seconden(delay_s)} te laat, omvormers op 0 W.")
|
||||
return Bi(f"Home Assistant readings arrive about {seconds(delay_s)} late, "
|
||||
f"so control holds the batteries.",
|
||||
f"Metingen uit Home Assistant komen zo'n {seconden(delay_s)} te "
|
||||
f"laat, dus de batterijen wachten.")
|
||||
|
||||
|
||||
def row_meter_waiting(limit_s) -> str:
|
||||
"""UX-10: no reading yet since the start, and still inside the limit."""
|
||||
return Bi(f"Meter: waiting for the first reading, limit "
|
||||
@@ -1270,6 +1283,7 @@ WHY_WINNER = {
|
||||
"circulation": "Safety stop, inverters worked against each other",
|
||||
"stopped": "Control is stopped",
|
||||
"inputs missing": "A reading is missing",
|
||||
"readings late": "Home Assistant readings arrive late",
|
||||
"no claim was made": "Nothing asked for power",
|
||||
# UX-10: the claim reasons main.why_key() can return for a safety or
|
||||
# failsafe winner. test_messages.py part 7 finds every one in the code.
|
||||
@@ -1320,6 +1334,11 @@ def why_missing(what, limit_s) -> str:
|
||||
return f"No usable {what} reading for over {seconds(limit_s)}: 0 W"
|
||||
|
||||
|
||||
def why_late() -> str:
|
||||
"""SAFETY-128: readings arrive late, so control holds the batteries."""
|
||||
return "Home Assistant readings arrive late, control holds"
|
||||
|
||||
|
||||
def why_waiting(missing_s) -> str:
|
||||
"""A reading went missing a moment ago: control holds and waits."""
|
||||
return f"A reading is missing for {seconds(missing_s)}, control waits"
|
||||
@@ -1337,6 +1356,8 @@ HINTS = {
|
||||
"roster": "Inverter list read: {n} inverters",
|
||||
"maint_history": "Maintenance history did not move over cleanly",
|
||||
"stop_restored": "{unit}: an earlier safety stop is back, it stays at 0 W",
|
||||
"readings_late": "Home Assistant readings arrive late, control holds",
|
||||
"readings_back": "Home Assistant readings are on time again",
|
||||
"battery_stuck": "{unit}: battery power reading stopped changing",
|
||||
"battery_back": "{unit}: battery power reading is used again",
|
||||
"battery_refuses": "The battery refuses to give power, the add-on asks 0 W",
|
||||
@@ -1488,6 +1509,8 @@ def status_samples() -> list:
|
||||
("row_controller_stalled", RED, row_controller_stalled(45, 30)),
|
||||
("row_meter_stale", RED, row_meter_stale(40, 10)),
|
||||
("row_meter_waiting", AMBER, row_meter_waiting(30)),
|
||||
("row_readings_late", AMBER, row_readings_late(30)),
|
||||
("row_readings_late", AMBER, row_readings_late(30, True)),
|
||||
("row_meter", GREEN, row_meter(-350, 2, 3, 340)),
|
||||
("row_meter_frozen", RED, row_meter_frozen()),
|
||||
*(("row_freeze_off", AMBER, row_freeze_off(k)) for k in FREEZE_OFF),
|
||||
|
||||
Reference in New Issue
Block a user