SAFETY-18: a meter frozen at a wrong-but-fresh value now raises an alarm
A meter that answers 200 OK with a stale document forever is ARRIVING on every
poll, so every freshness mechanism in the stack reads it as healthy while the
loop integrates a constant error and rails: 360/135/75 s at the live install's
max_w: 5000 for a meter frozen at 350/1000/>=3000 W. Fifteen minutes of a 5 kW
unattended import sets the month's billed capaciteitstarief peak.
The detector is a conjunction, not the bare unchanged_s threshold TEL-05
measured and rejected:
unchanged_s >= meter_freeze_s AND |command| within 5 % of max_w
Both terms already existed and were already on the status page, and they fail
for independent reasons: at the converged point the command is nowhere near the
rail, and at the rail against a real load the kWh registers move in seconds. At
the shipped 300 s the relation is structural rather than a margin - the slowest
a healthy 1 Wh register can tick and still look unchanged is 12 W, which is
inside the 15 W deadband, so the command there is parked at 0 W.
Notification only, deliberately: an HA persistent notification with a fixed
notification_id, an ERROR log line, a UI event and a red status row. No claim,
no latch, no 0 W. A false trip parks the battery; a false notification costs an
alert. Only meter_source: homewizard_local is covered - the status page says
NOT COVERED elsewhere rather than pretending the guard is armed.
DOCS.md states the capacity-tariff exposure this does NOT close: peak_cap_w caps
maintenance charging and nothing caps the loop. That cap is SAFETY-07.
test_freeze.py grades both directions and was verified by breaking what it
watches (six mutations, all red): silent over the committed 40-minute converged
capture, silent over an hour of TEL-05's low-power case where the rejected bare
threshold is shown to fire, alarming on a genuinely frozen meter driven over
real HTTP through the real HomeWizardLocalSource (the rig's own hwsim freeze
fault when reachable), silent on the same railed command against a meter that is
still moving, and asserting on the service call that leaves Controller.cycle()
rather than on the watchdog's own flag.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015VXjA3LWccN1rJsk3okyPC
This commit is contained in:
co-authored by
Claude Opus 5
parent
bb64f8fdd7
commit
7aa1bd052e
@@ -1,5 +1,58 @@
|
||||
# Changelog
|
||||
|
||||
## 0.5.2
|
||||
|
||||
**A meter frozen at a wrong-but-fresh value now raises an alarm. It still is not
|
||||
stopped.** (SAFETY-18)
|
||||
|
||||
A meter that answers `200 OK` with a stale document forever is *arriving* on
|
||||
every poll, so every freshness mechanism in the stack reads it as healthy:
|
||||
`meter_max_age_s` is reset by each response, the firmware watchdog is fed by the
|
||||
heartbeat and by a sample age that never climbs, and the arbiter contributes only
|
||||
±`max_w`. The loop integrates a constant error and rails — replaying the real
|
||||
`compute()` at 15 s cycles, in 150/60/30 s at `max_w: 2000` for a meter frozen at
|
||||
350/1000/≥3000 W, and 360/135/75 s at `max_w: 5000`. **The live install runs
|
||||
`max_w: 5000`**, which is both the schema maximum and the device rating.
|
||||
|
||||
The new detector (`app/freeze.py`) is a **conjunction**, not the bare
|
||||
`unchanged_s` threshold TEL-05 measured and rejected:
|
||||
|
||||
unchanged_s ≥ meter_freeze_s AND |command| within 5 % of max_w
|
||||
|
||||
Both terms already existed and were already on the status page. They fail for
|
||||
independent reasons: at the converged point the command is nowhere near the rail,
|
||||
and at the rail against a real load the kWh registers move within seconds. At the
|
||||
shipped 300 s there is also a structural relation, not just a margin — the
|
||||
slowest a healthy 1 Wh register can tick and still look unchanged is 12 W, which
|
||||
is inside the 15 W deadband, so the command there is parked at 0 W and the two
|
||||
halves cannot both be true.
|
||||
|
||||
**Notification only, deliberately.** An HA persistent notification (fixed
|
||||
`notification_id`, so a repeat replaces rather than stacks), an `ERROR` log line,
|
||||
a UI event and a red status banner. No claim, no latch, no 0 W: a false trip
|
||||
parks the battery and the operator's next move is to switch the guard off; a
|
||||
false notification costs an alert. The trip is a separate decision that needs
|
||||
data from a real install.
|
||||
|
||||
- New option `meter_freeze_s` (default 300, range 60–3600, no "off").
|
||||
- **Only `meter_source: homewizard_local` is covered** — it is the only transport
|
||||
that sees the meter's own document. Everywhere else the status page says
|
||||
**NOT COVERED** rather than "armed".
|
||||
- `DOCS.md` now states the **capacity-tariff exposure** this does *not* close:
|
||||
`peak_cap_w` caps maintenance charging and nothing caps the loop, so a lying
|
||||
meter can drive a 5 kW unattended import, and ≥15 minutes of that sets the
|
||||
month's billed peak (measured: one 4998 W quarter moved a monthly peak from
|
||||
4832 → 5013 W). That cap is SAFETY-07.
|
||||
- `test_freeze.py` grades it in both directions: silent over 40 minutes of the
|
||||
live house's real converged capture (committed as
|
||||
`scenarios/p1-age-2026-08-26.jsonl.gz`), silent over an hour of TEL-05's
|
||||
low-power case where a bare threshold is shown to fire, and alarming on a
|
||||
genuinely frozen meter driven over real HTTP through the real
|
||||
`HomeWizardLocalSource` — against the rig's own `hwsim` `freeze` fault when the
|
||||
infra repo is reachable, an equivalent stub otherwise. Its negative twin is the
|
||||
load-bearing one: the same railed command against a meter that is still moving
|
||||
must stay silent at the same threshold.
|
||||
|
||||
## 0.5.1
|
||||
|
||||
**SAFETY-02's latch now survives an add-on restart, which is the difference
|
||||
|
||||
Reference in New Issue
Block a user