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

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
This commit is contained in:
Claude
2026-11-22 20:31:26 +01:00
parent 885528ab48
commit 226e5a1e8b
35 changed files with 4647 additions and 123 deletions
+13
View File
@@ -677,6 +677,19 @@ def _charger_problems(opts: dict, writers: dict) -> list[str]:
out.append(f"{S('ev_charger')} is {messages.shown(raw)}. Choose "
f"{', '.join(chargers.SELECTABLE)}.")
return out
# EV-20: Solar's sun kept back and its two dwells, each in its range (as
# config.yaml's schema holds them, with or without a charger).
for key, (lo, hi) in chargers.SOLAR_RANGES.items():
raw = opts.get(key, chargers.EV_OPTION_DEFAULTS[key])
try:
v = float(raw)
ok = not isinstance(raw, bool) and v == v and v == int(v) \
and lo <= v <= hi
except (TypeError, ValueError, OverflowError):
ok = False
if not ok:
out.append(f"{S(key)} is {messages.shown(raw)}. Set it from {lo} "
f"to {hi}.")
if chargers.mode_of(opts) == chargers.OFF:
return out
ph = opts.get("ev_phases", chargers.EV_OPTION_DEFAULTS["ev_phases"])