EV-20: Car Solar mode, spare sun to the car (charging only)
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:
@@ -205,7 +205,19 @@ class StatusMixin:
|
||||
"text": messages.row_charger_unreach(
|
||||
f"{brussels(self.car.bad_since_utc):%H:%M}")})
|
||||
w = self.car_writer
|
||||
if self.car_mode == "manual":
|
||||
sw = self.car_solar
|
||||
if self.car_mode == "solar" or (sw.engaged and sw.gave_up):
|
||||
# EV-20: in Solar another writer stops the add-on's writes: amber.
|
||||
if sw.other and self.car_mode == "solar":
|
||||
out.append({"ok": False, "warn": True, "id": "charger_other",
|
||||
"text": messages.row_charger_other_solar()})
|
||||
if sw.gave_up:
|
||||
out.append({"ok": False, "warn": True, "id": "charger_refused",
|
||||
"text": messages.row_charger_refused()})
|
||||
if sw.phases_gave_up and self.car_mode == "solar":
|
||||
out.append({"ok": False, "warn": True, "id": "charger_phases",
|
||||
"text": messages.row_charger_phases()})
|
||||
elif self.car_mode == "manual":
|
||||
# EV-04: in Manual the add-on's own writes are not "another
|
||||
# writer"; its own detector (a read-back that differs from the
|
||||
# last write for 30 s) says so, in grey.
|
||||
@@ -230,7 +242,10 @@ class StatusMixin:
|
||||
"text": messages.row_charger_error(r.error)})
|
||||
if self.car_over:
|
||||
out.append({"ok": True, "warn": True, "id": "car_over",
|
||||
"text": messages.row_car_over()})
|
||||
"text": (messages.row_car_over_solar(
|
||||
f"{self.car_amps_now():.0f}")
|
||||
if self.car_solar_mode()
|
||||
else messages.row_car_over())})
|
||||
return out
|
||||
|
||||
def car_values(self) -> dict:
|
||||
@@ -250,6 +265,9 @@ class StatusMixin:
|
||||
or r.power_w is None else round(r.power_w, 1)),
|
||||
"car_today_kwh": (PAYLOAD_NONE if self.car.today_kwh is None
|
||||
else round(self.car.today_kwh, 3)),
|
||||
# EV-20: today's kWh from the sun (Solar only adds to it)
|
||||
"car_today_solar_kwh": (PAYLOAD_NONE if self.car_sun_kwh() is None
|
||||
else round(self.car_sun_kwh(), 3)),
|
||||
}
|
||||
|
||||
# -- UI ------------------------------------------------------------------
|
||||
@@ -922,7 +940,7 @@ class StatusMixin:
|
||||
now = datetime.now(timezone.utc)
|
||||
if what in ("pack_use", "pack_mode", "pack_sell"):
|
||||
return self._pack_action(what, unit, value, now)
|
||||
if what in ("car_mode", "car_current", "car_phases"):
|
||||
if what in ("car_mode", "car_current", "car_phases", "car_sun_first"):
|
||||
return self._car_action(what, value, now)
|
||||
if what == "auto_toggle":
|
||||
self.auto = not self.auto
|
||||
|
||||
Reference in New Issue
Block a user