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
+61
View File
@@ -190,6 +190,8 @@ T_CHARGER_UNREACH = "Charger not reachable"
T_CHARGER_UNREACH_NL = "Laadpaal onbereikbaar"
T_CAR_OVER = "Car over the peak limit"
T_CAR_OVER_NL = "Auto boven de piekgrens"
T_CAR_RELEASE = "Car may still be charging"
T_CAR_RELEASE_NL = "Auto laadt mogelijk nog"
T_NO_PRICES = "No prices"
T_NO_PRICES_NL = "Prijzen ontbreken"
@@ -204,6 +206,7 @@ ID_MAINT_FAILED = "goodwe_maint_failed_{slug}"
ID_NO_PRICES = "goodwe_no_prices"
ID_CHARGER_UNREACH = "goodwe_charger_unreachable"
ID_CAR_OVER = "goodwe_car_over"
ID_CAR_RELEASE = "goodwe_car_release"
# PRICE-01: an earlier build raised a card with this id. Nothing raises it now;
# the add-on only dismisses it at start.
OLD_FIXED_CARD_ID = "goodwe_fixed_tariff_unused"
@@ -518,6 +521,44 @@ def row_car_over() -> str:
"piekgrens.")
def _solar_over(a_text):
# D1's words, in the one sentence STYLE.md allows a grey note and row; the
# card's Why has them as two (`car.why.solar_over`).
return (f"Solar charges the car at {a_text} A, which sets the peak.",
f"Zon laadt de auto met {a_text} A, wat de piek bepaalt.")
def car_over_solar(a_text) -> Notice:
"""EV-20 (D1): in Solar the car's charge takes the 15-minute period over
the peak limit and the batteries cannot hold it. Grey, once per charging
session, as Manual's; `a_text` is Solar's current at that moment."""
en, nl = _solar_over(a_text)
return Notice(ID_CAR_OVER, INFO, T_CAR_OVER, en,
body_nl=f"{T_CAR_OVER_NL}. {nl}")
def row_car_over_solar(a_text) -> str:
"""EV-20 (D1): the grey row while Solar's charge is over the peak limit."""
return Bi(*_solar_over(a_text))
def car_release_failed() -> Notice:
"""EV-20 (D3): at shutdown in Solar the charger did not take 0 A, and the
inverters were released on time anyway. Taken down when the next start's
0 A is taken."""
en = ("The add-on stopped before the charger took 0 A, so check the "
"charger.")
nl = ("De add-on stopte voor de laadpaal 0 A overnam, dus controleer de "
"laadpaal.")
return Notice(ID_CAR_RELEASE, WARNING, T_CAR_RELEASE, en,
body_nl=f"{T_CAR_RELEASE_NL}. {nl}")
def car_release_gone() -> Dismiss:
"""EV-20 (D3): takes the 'Car may still be charging' notice down."""
return Dismiss(ID_CAR_RELEASE)
def row_charger_other() -> str:
"""EV-04: the grey row, in Manual, while something else sets the current."""
return Bi("Something else changes the charger, so the add-on writes "
@@ -526,6 +567,15 @@ def row_charger_other() -> str:
"tot u iets wijzigt.")
def row_charger_other_solar() -> str:
"""EV-20: the amber row, in Solar, while something else sets the current:
Solar writes nothing until you press Solar or the read-back matches."""
return Bi("Something else changes the charger, so Solar writes nothing "
"until you press it.",
"Iets anders wijzigt de laadpaal, dus Zon schrijft niets tot u "
"erop drukt.")
def row_charger_stuck() -> str:
"""EV-04: the amber row when the charger's reading does not move."""
return Bi("The charger reading may be stuck, so check the charger.",
@@ -1484,6 +1534,7 @@ HINTS = {
"car_mode": "Car mode set",
"car_current": "Car current set",
"car_phases": "Car phases set",
"car_sun_first": "Where spare sun goes first set",
"settings_saved": "Settings saved, they apply after a restart",
"restart_requested": "Restart requested from the settings page",
"setup_only": "In setup, nothing is sent to any inverter",
@@ -1780,6 +1831,8 @@ def status_samples() -> list:
("row_charger_writer", GREEN, row_charger_writer()),
("row_car_over", GREEN, row_car_over()),
("row_charger_other", GREEN, row_charger_other()),
("row_charger_other_solar", AMBER, row_charger_other_solar()),
("row_car_over_solar", GREEN, row_car_over_solar("8")),
("row_charger_error", GREEN, row_charger_error("Socket error")),
("row_charger_stuck", AMBER, row_charger_stuck()),
("row_charger_refused", AMBER, row_charger_refused()),
@@ -1822,6 +1875,8 @@ def samples() -> list:
no_prices(),
charger_unreachable("09:12"),
car_over("16"),
car_over_solar("8"),
car_release_failed(),
]
@@ -1890,6 +1945,9 @@ LABELS = {
"ev_max_a": "Charger limit",
"ev_batt_cover": "Batteries help with the peak",
"ev_mode_start": "Mode after a restart",
"ev_margin_w": "Sun kept back",
"ev_pause_min": "Pause after",
"ev_start_min": "Start after",
"ev_phases": "Phases",
}
@@ -1976,6 +2034,9 @@ LABELS_NL = {
"ev_max_a": "Laadpaalgrens",
"ev_batt_cover": "Batterijen helpen met de piek",
"ev_mode_start": "Modus na een herstart",
"ev_margin_w": "Zon achtergehouden",
"ev_pause_min": "Pauzeren na",
"ev_start_min": "Starten na",
"ev_phases": "Fasen",
}
# The inverter list shows two of them under a shorter name.