EV-10, EV-11, EV-12: car-alone peak alarm, steady car-over row, own write is not another writer #258

Merged
admin merged 5 commits from EV-10 into release/1.0 2026-11-16 20:54:31 +01:00
Owner

Rig findings F-1, F-2, F-3 of the EV-04 test.

  • EV-10: car_cycle now asks whether the period WITHOUT the car (projected minus the car's fresh, corroborated average over the same window) is at or under the aim. It holds with the projection still under the aim (car alone takes the batteries to the reserve). Stale, stuck or uncorroborated car figures still leave the normal alarms standing.
  • EV-11: cause: after the car's own quarter became the month peak, the aim sat on the grid it made, so the test crossed the aim every few seconds. car_over stays on until the test has been false for 180 s; the alarm decision (car_explains) has no hold.
  • EV-12: the tracker's own-write mute opens before the write and runs 15 s from its return.

Tests: goodwe_controller/test_ev10.py (red on 75ebe22, green here). DECISIONS/EV-04-manual-mode.md and CHANGELOG updated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Bdqr7PiaHcBnzPituu2yTC

Rig findings F-1, F-2, F-3 of the EV-04 test. - EV-10: `car_cycle` now asks whether the period WITHOUT the car (projected minus the car's fresh, corroborated average over the same window) is at or under the aim. It holds with the projection still under the aim (car alone takes the batteries to the reserve). Stale, stuck or uncorroborated car figures still leave the normal alarms standing. - EV-11: cause: after the car's own quarter became the month peak, the aim sat on the grid it made, so the test crossed the aim every few seconds. `car_over` stays on until the test has been false for 180 s; the alarm decision (`car_explains`) has no hold. - EV-12: the tracker's own-write mute opens before the write and runs 15 s from its return. Tests: `goodwe_controller/test_ev10.py` (red on 75ebe22, green here). DECISIONS/EV-04-manual-mode.md and CHANGELOG updated. 🤖 Generated with [Claude Code](https://claude.ai/code) https://claude.ai/code/session_01Bdqr7PiaHcBnzPituu2yTC
admin added 1 commit 2026-11-16 15:29:57 +01:00
EV-10, EV-11, EV-12: car-alone peak alarm, steady car-over row, own write not another writer
checks / unit (pull_request) Failing after 2m13s
infra-pin / fresh (pull_request) Successful in 2s
8efc385956
EV-10: the car is the cause when the period without it (projected minus the car's
fresh, corroborated average) is at or under the aim, also with the projection
still under it. EV-11: car_over stays on until the test has been false for 180 s.
EV-12: the tracker's own-write mute opens before the write and runs 15 s from its
return.

Co-Authored-By: Claude <noreply@anthropic.com>
admin added 1 commit 2026-11-16 15:42:01 +01:00
EV-11: the end of a charging session clears the car-over state at once
checks / unit (pull_request) Failing after 29m5s
infra-pin / fresh (pull_request) Successful in 2s
50d5ae90d2
Co-Authored-By: Claude <noreply@anthropic.com>
admin added 1 commit 2026-11-16 16:12:45 +01:00
EV-10: test_ev10 points at MUTATION.md and guards its indexed reads
checks / unit (pull_request) Successful in 20m36s
infra-pin / fresh (pull_request) Successful in 2s
a60342e4e8
Co-Authored-By: Claude <noreply@anthropic.com>
Author
Owner

Review of a60342e (EV-10 + EV-11 + EV-12): not merged, back to dev

High (safety). goodwe_controller/app/ctl_car.py:268-274: when the projection is under the aim, the new rule no longer looks at the car's size.
If projected <= aim, then projected - car_avg <= aim is always true. So any car averaging 50 W or more (CAR_PEAK_MIN_W) "explains" a floor-limited guard, even when the house drained the batteries. The rig case is fixed, but the same case with the roles swapped is now silent.

  • Repro (scratch/EV-10/review/break_twin.py 3075): the house is 6 kW and the batteries hold the grid at the aim. The car plugs in at second 800 (6 A, 1 phase, quarter average 155 W). At 850 the batteries reach the reserve and the house eases a little, so the projection is 4287 W against an aim of 4450 W.
    • Off: goodwe_peak_soc_floor at 850.
    • base 75ebe22, Manual: goodwe_peak_soc_floor at 850.
    • a60342e, Manual: no alarm, car_explains True.
  • On the rig this state lasted 3.5 min (F-1, 21:26:37 to 21:30:11). So in production a house-caused "Battery stopped limiting the peak" goes silent for minutes whenever a car draws 50 W.
  • The alarms grade the landing with the batteries giving only what they still can: load_too_high / misses_aim, i.e. projected + (batt - able) * rest / 900. The new rule grades projected, which still counts the batteries' current help.
  • What must change: judge the car against the same landing the alarm grades. For example, the alarm's own predicate on the projection without the car (car_exclude(real_proj, w), with the same batt and able_w/achievable_w) must be false. Or: landing minus car_avg must be at or under the aim. Keep everything else from EV-04 as it is.
  • Test that proves it: the twin above goes into test_ev10 as an alarm-still-fires check (house drains the batteries, the car is small or plugs in late, projection under the aim at the reserve). It must be red on a60342e and green after. The rig case (projection 4432 W against 4450 W, 3.7 kW car) must stay silent.

Medium (test gap). goodwe_controller/app/carmode.py:251-256: no test covers a write that raises. My mutant drops the try/finally, so a raise from write_current leaves mute_until = inf. It survives test_ev10, test_ev04 and test_ev03. Wanted: a driver whose write_current raises (and one that returns False); after OWN_WRITE_MUTE_S the tracker must still flag an outside change.

Low. DECISIONS/EV-04-manual-mode.md:99-100 and ctl_car.py:23-24: "180 s (the rig's longest gap)" is not shown by the data. status.jsonl samples every 50 s, and the longest off run (21:14:42 True, 21:15:32 to 21:18:02 False, 21:18:52 True) is somewhere between 150 s and 250 s. Say "about 3 min, from 50 s samples", or pick the hold on another ground.

Fine as is:

  • EV-11 cause confirmed. From 21:00:32 the month peak is the car's own quarter (14 040 W). period_w then moves 13 966 to 14 065 W around it, and plant.csv shows 14.04 kW +-50 W.
  • The 180 s hold reaches only car_over (row, Why, notice). car_explains has no hold: mutant M1 (car_explains |= car_over) went red on 2 checks.
  • Unplugging clears at once (_car_session_tick).
  • EV-12 mute: opened before the write and ends 15 s after its return, failure included (finally). The write is bounded (10 s HTTP + TOOK_S), and a cancel also runs the finally.
  • 50 W floor: sensible on its own, but it is the only thing separating car from house in the under-aim branch (see High).
  • 10 s on-count: accepted. A gap no longer restarts it, it is EV-04 behaviour, and nothing in the alarm path waits for it.
  • Tests (goodwe-addon-checks:1, --network none) all pass: test_ev10, test_ev04, test_ev03, test_safety81, test_safety87, test_safety126, test_safety126b, plus the importers test_opt36, test_modes_p3, test_modes_p4, test_opt20, test_ux77. CI run 1711 checks / unit (pull_request) is green on a60342e.
  • CHANGELOG line is plain. It is long, but it is one line for three fixes.

I fixed nothing myself: the High finding needs a logic change first.

## Review of a60342e (EV-10 + EV-11 + EV-12): not merged, back to dev **High (safety). `goodwe_controller/app/ctl_car.py:268-274`: when the projection is under the aim, the new rule no longer looks at the car's size.** If `projected <= aim`, then `projected - car_avg <= aim` is always true. So any car averaging 50 W or more (`CAR_PEAK_MIN_W`) "explains" a floor-limited guard, even when the house drained the batteries. The rig case is fixed, but the same case with the roles swapped is now silent. - Repro (`scratch/EV-10/review/break_twin.py 3075`): the house is 6 kW and the batteries hold the grid at the aim. The car plugs in at second 800 (6 A, 1 phase, quarter average 155 W). At 850 the batteries reach the reserve and the house eases a little, so the projection is 4287 W against an aim of 4450 W. - Off: `goodwe_peak_soc_floor` at 850. - base 75ebe22, Manual: `goodwe_peak_soc_floor` at 850. - **a60342e, Manual: no alarm, `car_explains` True.** - On the rig this state lasted 3.5 min (F-1, 21:26:37 to 21:30:11). So in production a house-caused "Battery stopped limiting the peak" goes silent for minutes whenever a car draws 50 W. - The alarms grade the landing with the batteries giving only what they still can: `load_too_high` / `misses_aim`, i.e. `projected + (batt - able) * rest / 900`. The new rule grades `projected`, which still counts the batteries' current help. - **What must change:** judge the car against the same landing the alarm grades. For example, the alarm's own predicate on the projection without the car (`car_exclude(real_proj, w)`, with the same `batt` and `able_w`/`achievable_w`) must be false. Or: landing minus `car_avg` must be at or under the aim. Keep everything else from EV-04 as it is. - **Test that proves it:** the twin above goes into `test_ev10` as an alarm-still-fires check (house drains the batteries, the car is small or plugs in late, projection under the aim at the reserve). It must be red on a60342e and green after. The rig case (projection 4432 W against 4450 W, 3.7 kW car) must stay silent. **Medium (test gap). `goodwe_controller/app/carmode.py:251-256`:** no test covers a write that raises. My mutant drops the `try/finally`, so a raise from `write_current` leaves `mute_until = inf`. It **survives** test_ev10, test_ev04 and test_ev03. Wanted: a driver whose `write_current` raises (and one that returns False); after `OWN_WRITE_MUTE_S` the tracker must still flag an outside change. **Low. `DECISIONS/EV-04-manual-mode.md:99-100` and `ctl_car.py:23-24`:** "180 s (the rig's longest gap)" is not shown by the data. status.jsonl samples every 50 s, and the longest off run (21:14:42 True, 21:15:32 to 21:18:02 False, 21:18:52 True) is somewhere between 150 s and 250 s. Say "about 3 min, from 50 s samples", or pick the hold on another ground. **Fine as is:** - **EV-11 cause** confirmed. From 21:00:32 the month peak is the car's own quarter (14 040 W). `period_w` then moves 13 966 to 14 065 W around it, and plant.csv shows 14.04 kW +-50 W. - **The 180 s hold** reaches only `car_over` (row, Why, notice). `car_explains` has no hold: mutant M1 (`car_explains |= car_over`) went red on 2 checks. - **Unplugging** clears at once (`_car_session_tick`). - **EV-12 mute:** opened before the write and ends 15 s after its return, failure included (`finally`). The write is bounded (10 s HTTP + `TOOK_S`), and a cancel also runs the `finally`. - **50 W floor:** sensible on its own, but it is the only thing separating car from house in the under-aim branch (see High). - **10 s on-count:** accepted. A gap no longer restarts it, it is EV-04 behaviour, and nothing in the alarm path waits for it. - **Tests** (goodwe-addon-checks:1, `--network none`) all pass: test_ev10, test_ev04, test_ev03, test_safety81, test_safety87, test_safety126, test_safety126b, plus the importers test_opt36, test_modes_p3, test_modes_p4, test_opt20, test_ux77. CI run 1711 `checks / unit (pull_request)` is green on a60342e. - **CHANGELOG** line is plain. It is long, but it is one line for three fixes. I fixed nothing myself: the High finding needs a logic change first.
admin added 1 commit 2026-11-16 18:07:28 +01:00
EV-10 round 2: judge the car against the alarm's own landing; test failed writes; honest hold wording
checks / unit (pull_request) Successful in 22m4s
infra-pin / fresh (pull_request) Successful in 2s
646f61e730
Co-Authored-By: Claude <noreply@anthropic.com>
admin added 1 commit 2026-11-16 19:28:04 +01:00
Author
Owner

Re-review of 269b89d: approved, merging

My round-1 High finding is fixed. _car_explains_alarm now runs the alarm's own test with the car and without its fresh, corroborated share, on the same landing.

  • House-caused case, rig twin (break_twin.py, ease 3075 / 3100 / 3200): goodwe_peak_soc_floor now fires in Manual, as in Off. With ease 3000, neither Off nor Manual alarms.
  • Rig F-1 shape end to end (test_ev10 at_reserve: car alone, projection under the aim): still silent, with one grey notice.
  • Branch probes (probe_branches.py), saturated guard and floor with others (N=2):
    • Car alone: explains, while the alarm's own test is true.
    • House: does not explain.
    • A 0 W car, an untrusted car (None) or an unknown battery reading: explains nothing.
  • Floor with nothing left: the two SAFETY-126 latches mirror _peak_landing, reset on a new quarter and when the guard stops wanting power, and run every cycle whatever the cover option says.
  • Stuck, stale, or a car that stops mid-quarter: each gives w None, which sets the without-car latch, so nothing is explained for the rest of the quarter. That is the safe direction.
  • Positive test now needs an earlier latched cycle: this is faithful. On the rig, F-1 alarmed through the SAFETY-126 latch, not through the 4432 W landing, which was within the aim.
  • Mutants (on copies; the clone is unchanged):
    • Dropping not _car_need_excl: 7 checks red.
    • Dropping the try/finally in _write: red on "a write that raises".
  • Tests: all pass in goodwe-addon-checks:1 with --network none: test_ev10, test_ev04, test_ev03, safety81, safety87, safety126, safety126b, opt36, modes_p3, modes_p4, opt20 and ux77. CI run 1715 is green on 269b89d.

Info, no change needed.

  • Behaviour change against EV-04: a house that needed the batteries earlier in the quarter (e.g. 6 kW against a 4.45 kW aim, with a whole-quarter 1.4 kW car) now raises the floor alarm at the reserve, where EV-04 kept it silent. That is the safe direction.
  • _car_batt_prev is set to None when there is no battery reading, while the alarms keep their previous value. The only effect is to explain less.

I fixed nothing myself.

## Re-review of 269b89d: approved, merging My round-1 High finding is fixed. `_car_explains_alarm` now runs the alarm's own test with the car and without its fresh, corroborated share, on the same landing. - **House-caused case, rig twin** (`break_twin.py`, ease 3075 / 3100 / 3200): `goodwe_peak_soc_floor` now fires in Manual, as in Off. With ease 3000, neither Off nor Manual alarms. - **Rig F-1 shape end to end** (test_ev10 `at_reserve`: car alone, projection under the aim): still silent, with one grey notice. - **Branch probes** (`probe_branches.py`), saturated guard and floor with others (N=2): - Car alone: explains, while the alarm's own test is true. - House: does not explain. - A 0 W car, an untrusted car (`None`) or an unknown battery reading: explains nothing. - **Floor with nothing left:** the two SAFETY-126 latches mirror `_peak_landing`, reset on a new quarter and when the guard stops wanting power, and run every cycle whatever the cover option says. - **Stuck, stale, or a car that stops mid-quarter:** each gives `w` None, which sets the without-car latch, so nothing is explained for the rest of the quarter. That is the safe direction. - **Positive test now needs an earlier latched cycle:** this is faithful. On the rig, F-1 alarmed through the SAFETY-126 latch, not through the 4432 W landing, which was within the aim. - **Mutants** (on copies; the clone is unchanged): - Dropping `not _car_need_excl`: 7 checks red. - Dropping the try/finally in `_write`: red on "a write that raises". - **Tests:** all pass in goodwe-addon-checks:1 with `--network none`: test_ev10, test_ev04, test_ev03, safety81, safety87, safety126, safety126b, opt36, modes_p3, modes_p4, opt20 and ux77. CI run 1715 is green on 269b89d. **Info, no change needed.** - Behaviour change against EV-04: a house that needed the batteries earlier in the quarter (e.g. 6 kW against a 4.45 kW aim, with a whole-quarter 1.4 kW car) now raises the floor alarm at the reserve, where EV-04 kept it silent. That is the safe direction. - `_car_batt_prev` is set to `None` when there is no battery reading, while the alarms keep their previous value. The only effect is to explain less. I fixed nothing myself.
admin merged commit b86c0153cf into release/1.0 2026-11-16 20:54:31 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/goodwe-addon#258