EV-05: car Solar mode (spare sun to the car, Batteries or Car first, cut first for the peak)
Solar charges the car from the signed spare sun (car + battery charge - grid import), less the batteries' room (Batteries first) and the sun kept back, whole amps rounded down, at most one change per 30 s and only on 1 A. It starts after ev_start_min of enough sun, holds 6 A for ev_pause_min, then 0 A. Auto phases through EV-04's safe sequence (4.5 kW / 3 min up, 4.0 kW / 5 min down, one switch per 10 min). What the peak guard would ask the batteries for is taken off the car first, at once. Every way out of Solar ends at 0 A, written once; at shutdown before the inverters go to 0 W. - app/carmode.py: SolarPlan (pure) and SolarWriter (ManualWriter's one write site, its sequence and watch); spare_w, car_target_w, amps_for. - app/ctl_car.py: Solar inputs, the cut, the solar kWh, EV-15's grace for Solar's own 0 A, no "set by the car" for Solar; main.py: shutdown order. - Home card, HA select.goodwe_car_sun_first, sensor car_today_solar_kwh, three options with defaults, strings EN/NL, DOCS, DECISIONS, CHANGELOG. - test_ev05.py, test_ev05_long.py, tools/ev05_sun.py; test_ev03/ev04 checks that pinned "Solar is refused" / "three entities" updated. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -205,7 +205,20 @@ 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":
|
||||
# EV-05: in Solar another writer stops the add-on's writes: amber,
|
||||
# the same words as in Manual.
|
||||
if sw.other:
|
||||
out.append({"ok": False, "warn": True, "id": "charger_other",
|
||||
"text": messages.row_charger_other()})
|
||||
if sw.gave_up:
|
||||
out.append({"ok": False, "warn": True, "id": "charger_refused",
|
||||
"text": messages.row_charger_refused()})
|
||||
if sw.phases_gave_up:
|
||||
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.
|
||||
@@ -250,6 +263,8 @@ 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)),
|
||||
"car_today_solar_kwh": (PAYLOAD_NONE if self.car_sun_kwh() is None
|
||||
else round(self.car_sun_kwh(), 3)),
|
||||
}
|
||||
|
||||
# -- UI ------------------------------------------------------------------
|
||||
@@ -922,7 +937,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