EV-20: Car Solar mode, spare sun to the car (charging only) #271

Merged
ems-agent merged 6 commits from EV-20 into release/1.0 2026-11-23 10:55:42 +01:00
Collaborator

EV-20: Car Solar mode, charging only (part 1 of the EV-05 split). Brief v3 (R4), test plan PASS on brief v2 (61 T-ids, 15 N-ids).

What it does

  • Mode Solar on Home and in select.goodwe_car_mode (Off, Manual, Solar); select.goodwe_car_sun_first (Batteries / Car), runtime state in the store. Night stays refused.
  • Signed spare car + battery charge - grid import; Batteries first takes the RATINGS of the batteries that may charge; ev_margin_w kept back; whole amps rounded down, 6 A to the clamp; 30 s / 1 A rule; start after ev_start_min at 7 A worth (on 1 phase from a pause in auto); 6 A hold for ev_pause_min, then 0 A; auto phases 4.5 kW / 3 min up, 4.0 kW / 5 min down, one per 10 min, through EV-04's safe sequence; one-phase car on 1-phase arithmetic.
  • Fail state 0 A on every way out, retried by EV-04's rule (60 s, 3 tries, gave-up row); at shutdown before the inverters' 0 W, three tries inside 15 s (D3); start-up and a returning charger/HA write 0 A first (D2); never over another writer's hold (N16).
  • The peak guard treats a Solar car exactly as a Manual car (car_controlled), with D1's wording.
  • Solar kWh: sensor.goodwe_car_today_solar_kwh and "{kwh} charged today, {sun} from the sun".
  • ev_margin_w (100, 0-1000), ev_start_min (2, 1-30), ev_pause_min (5, 1-30): config, validator, translations, DOCS; DECISIONS/EV-20-solar-mode.md; CHANGELOG.

Checks

New: test_ev20.py, test_ev20_exits.py, test_ev20_writers.py, test_ev20_guard.py, test_ev20_long.py (sim day), test_ev20_fuzz.py; harness tools/ev20_sun.py, tools/ev20_kit.py. Changed: test_ev03.py, test_ev04.py (Solar is no longer the refused example: Night/Bogus instead; four car entities/sensors).

Details, mutants and coverage per T-id: reports/EV-20-dev-report.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w

EV-20: Car Solar mode, charging only (part 1 of the EV-05 split). Brief v3 (R4), test plan PASS on brief v2 (61 T-ids, 15 N-ids). ## What it does - Mode **Solar** on Home and in `select.goodwe_car_mode` (Off, Manual, Solar); `select.goodwe_car_sun_first` (Batteries / Car), runtime state in the store. Night stays refused. - Signed spare `car + battery charge - grid import`; Batteries first takes the RATINGS of the batteries that may charge; `ev_margin_w` kept back; whole amps rounded down, 6 A to the clamp; 30 s / 1 A rule; start after `ev_start_min` at 7 A worth (on 1 phase from a pause in auto); 6 A hold for `ev_pause_min`, then 0 A; auto phases 4.5 kW / 3 min up, 4.0 kW / 5 min down, one per 10 min, through EV-04's safe sequence; one-phase car on 1-phase arithmetic. - Fail state 0 A on every way out, retried by EV-04's rule (60 s, 3 tries, gave-up row); at shutdown before the inverters' 0 W, three tries inside 15 s (D3); start-up and a returning charger/HA write 0 A first (D2); never over another writer's hold (N16). - The peak guard treats a Solar car exactly as a Manual car (`car_controlled`), with D1's wording. - Solar kWh: `sensor.goodwe_car_today_solar_kwh` and "{kwh} charged today, {sun} from the sun". - `ev_margin_w` (100, 0-1000), `ev_start_min` (2, 1-30), `ev_pause_min` (5, 1-30): config, validator, translations, DOCS; DECISIONS/EV-20-solar-mode.md; CHANGELOG. ## Checks New: `test_ev20.py`, `test_ev20_exits.py`, `test_ev20_writers.py`, `test_ev20_guard.py`, `test_ev20_long.py` (sim day), `test_ev20_fuzz.py`; harness `tools/ev20_sun.py`, `tools/ev20_kit.py`. Changed: `test_ev03.py`, `test_ev04.py` (Solar is no longer the refused example: Night/Bogus instead; four car entities/sensors). Details, mutants and coverage per T-id: reports/EV-20-dev-report.md. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
ems-agent added 1 commit 2026-11-22 20:34:56 +01:00
EV-20: Car Solar mode, spare sun to the car (charging only)
checks / unit (pull_request) Successful in 57m6s
infra-pin / fresh (pull_request) Successful in 3s
226e5a1e8b
Solar as a second writer next to Manual (carmode.SolarPlan, SolarWriter on
ManualWriter's one write site, safe phase sequence and other-writer watch):
signed spare, Batteries first on the batteries' ratings, the margin, whole
amps rounded down, the 30 s / 1 A rule, start and pause dwells, auto phases,
a one-phase car. Every way out ends at 0 A, retried by EV-04's rule; at
shutdown before the inverters, three tries inside 15 s (D3); start-up and a
returning charger or HA write 0 A first (D2); never over another writer's
hold. The peak guard treats a Solar car as a Manual car (D1 wording). Solar
kWh sensor and card line; select.goodwe_car_sun_first; ev_margin_w,
ev_start_min, ev_pause_min with config, validator, translations, DOCS,
DECISIONS and CHANGELOG.

Checks: test_ev20.py, test_ev20_exits.py, test_ev20_writers.py,
test_ev20_guard.py, test_ev20_long.py, test_ev20_long_car.py,
test_ev20_fuzz.py (harness tools/ev20_sun.py, ev20_kit.py, ev20_day.py);
test_ev03/test_ev04 no longer use Solar as the refused example.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
ems-agent added 1 commit 2026-11-22 20:48:04 +01:00
EV-20: T4 through the Controller, T21 (a) on car_cycle itself
checks / unit (pull_request) Successful in 41m4s
infra-pin / fresh (pull_request) Successful in 2s
d18ed56fad
T4: battery A's power missing, NaN or unavailable, for one cycle (no
write) and for 400 s (no spare, the current held, 0 A at 300 s).
T21 (a): car_cycle on the same projection, guard and reading gives the
same car figure, explains and over in Solar and Manual.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
ems-agent added 1 commit 2026-11-22 21:33:33 +01:00
EV-20: SPIKE-05 decisions C1, C6, C9 (brief v5) with rows for C1, C5, C6, C8, C9
checks / unit (pull_request) Successful in 34m42s
infra-pin / fresh (pull_request) Successful in 2s
e0138a2ae5
C1: an own 0 A not yet read back is kept with the mode; a start in Off with
it writes the 0 A (retried), without it nothing; a start that will not write
warns once when the charger still has the add-on's current. C6: Solar's 30 s
gate also counts from Manual's latest write. C9: an exit also owes its 0 A
when the read-back shows Solar's own value. Rows for C5 and C8 too.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
ems-agent added 1 commit 2026-11-23 00:34:26 +01:00
EV-20 review round 1: no 1-phase current on 3 phases after a select; rows for mE, mF, mC
checks / unit (pull_request) Successful in 32m26s
infra-pin / fresh (pull_request) Successful in 2s
9c82bc816a
After its own phase select (taken, or with a late read-back), Solar ends the
sequence with the lower of the currents for the new phases and the phases the
charger reports, and keeps the plan on them; the old phases' current comes
back only when no select went out (EV-28's cap). Rows: T19/T33 settle write
refused or ignored once and select confirmed late; an exit after a given-up
write; shutdown in Off with the 0 A owed; Stop with a refused 0 A and another
writer. NoCharger.write_current takes took_s; ev_mode_start text names C1;
NL solar_hold wording.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
ems-agent added 1 commit 2026-11-23 01:25:09 +01:00
EV-20 review round 2: one write clock for every non-zero current (C6, N5)
checks / unit (pull_request) Successful in 30m56s
infra-pin / fresh (pull_request) Successful in 2s
cd8c393161
ManualWriter._write, the one write_current call, stamps every non-zero
current either writer sends; Solar's 30 s gate reads that stamp (its own and
Manual's), so the step back up after a phase change's closing write waits 30
s on every path. The closing current is fixed once per sequence, retries too.
Rows: every select shape (refused, ignored, late; settle refused three times;
T7 1 -> 3 and T22 3 -> 1) with nevers().

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VSY9UpTaUYnjJF5oVtbM1w
ems-agent added 1 commit 2026-11-23 10:24:43 +01:00
EV-20 review round 3: drop the if True wrapper in SolarWriter._close_a (cosmetic, no logic change)
checks / unit (pull_request) Successful in 30m34s
infra-pin / fresh (pull_request) Successful in 1s
5147c300b8
Co-Authored-By: Claude <noreply@anthropic.com>
ems-agent merged commit cc8c0dc2ae into release/1.0 2026-11-23 10:55:42 +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#271