EV-14: Car Why says what happens in shadow mode and after a phase change that did not happen
Display only: shadow mode over-limit Why speaks in would-terms; read phases that differ from the setting say the charger stays; a writer hold says something else set the charger. EN and NL texts, test_ev14.py. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1318,14 +1318,34 @@ def _over_why_is_floor(c, pg) -> bool:
|
||||
return bool(pg is not None and pg.floor_limited and pg.soc is not None)
|
||||
|
||||
|
||||
def _real_phases(c):
|
||||
"""EV-14: the phases the charger reports (1 or 3), or None: no fresh
|
||||
reading, or none read. Reads only; unknown is never a difference."""
|
||||
car = getattr(c, "car", None)
|
||||
r = getattr(car, "reading", None)
|
||||
fresh = getattr(car, "fresh", None)
|
||||
if r is None or fresh is None or not getattr(r, "available", False):
|
||||
return None
|
||||
if not fresh(c.car_now()):
|
||||
return None
|
||||
n = getattr(r, "phases_allowed", None)
|
||||
return n if n in (1, 3) else None
|
||||
|
||||
|
||||
def _car_manual_why(c, key):
|
||||
"""The Why of Manual: what you set, and what the peak limit does about it.
|
||||
Plan lines: two sentences of at most 12 words."""
|
||||
Plan lines: two sentences of at most 12 words. EV-14: in shadow mode it
|
||||
says what the add-on would set; after a phase change that did not happen
|
||||
it says what the charger does."""
|
||||
a = f"{float(c.car_a):.0f}"
|
||||
w = c.car_writer
|
||||
pct = _pct(c.o.get("peak_soc_floor", peakguard.PEAK_OPTION_DEFAULTS[
|
||||
"peak_soc_floor"]))
|
||||
if c.car_over:
|
||||
if c.shadow:
|
||||
t, n = w.would if w.would is not None else (c.car_a, c.car_n)
|
||||
return _t("car.why.manual_shadow_over", a=f"{float(t):.0f}",
|
||||
phases=car_phases_word(n))
|
||||
pg = getattr(c, "peak_guard", None)
|
||||
if not c.car_cover:
|
||||
return _t("car.why.manual_nocover", a=a)
|
||||
@@ -1337,6 +1357,8 @@ def _car_manual_why(c, key):
|
||||
phases=car_phases_word(n))
|
||||
if not c.auto:
|
||||
return _t("car.why.manual_stopped")
|
||||
if w.hold:
|
||||
return _t("car.why.manual_other")
|
||||
if key in ("none", "full"):
|
||||
return _t("car.why.manual_wait", a=a)
|
||||
if w.blocked:
|
||||
@@ -1344,6 +1366,11 @@ def _car_manual_why(c, key):
|
||||
if c.car_cover and peak_engaged(c):
|
||||
giving = max(0.0, float(c.site_batt_w or 0.0))
|
||||
return _t("car.why.manual_cover", a=a, kw=_kw(giving), pct=pct)
|
||||
real = _real_phases(c)
|
||||
if real is not None and real != c.car_n and w.seq is None:
|
||||
return _t("car.why.manual_phases", a=a,
|
||||
phases=car_phases_word(c.car_n),
|
||||
real=car_phases_word(real))
|
||||
return _t("car.why.manual_set", a=a, phases=car_phases_word(c.car_n))
|
||||
|
||||
|
||||
@@ -1900,7 +1927,8 @@ def _samples() -> list:
|
||||
out += [("plan", _t("car.big." + k, t="09:12")) for k in
|
||||
words["car"]["big"]]
|
||||
out += [("plan", _t("car.why." + k, a="10", brand="Alfen", kw="8.6 kW",
|
||||
pct="20 %", phases=car_phases_word(3)))
|
||||
pct="20 %", phases=car_phases_word(3),
|
||||
real=car_phases_word(1)))
|
||||
for k in words["car"]["why"]]
|
||||
out += [("plan", _t("peak.car", kw="12.1 kW", car="11.0 kW",
|
||||
cov="8.6 kW")),
|
||||
|
||||
@@ -329,6 +329,9 @@
|
||||
"manual_wait": "You set {a} A. It is set when a car is connected.",
|
||||
"manual_would": "Shadow mode: the add-on would set {a} A, {phases}.",
|
||||
"manual_stopped": "Control is stopped. The charger keeps its last setting.",
|
||||
"manual_shadow_over": "Shadow mode: the add-on would set {a} A, {phases}. This charge would set the peak.",
|
||||
"manual_phases": "You set {a} A, {phases}. The charger stays on {real}.",
|
||||
"manual_other": "Something else set the charger. The add-on leaves it until you change something.",
|
||||
"manual_blocked": "The phases change once per 10 minutes at most. This waits."
|
||||
}
|
||||
},
|
||||
|
||||
@@ -283,6 +283,9 @@
|
||||
"manual_wait": "U stelde {a} A in. Het wordt ingesteld zodra een auto is aangesloten.",
|
||||
"manual_would": "Schaduwmodus: de add-on zou {a} A instellen, {phases}.",
|
||||
"manual_stopped": "De regeling is gestopt. De laadpaal houdt haar laatste instelling.",
|
||||
"manual_shadow_over": "Schaduwmodus: de add-on zou {a} A instellen, {phases}. Deze lading zou de piek bepalen.",
|
||||
"manual_phases": "U stelde {a} A in, {phases}. De laadpaal blijft op {real}.",
|
||||
"manual_other": "Iets anders heeft de laadpaal ingesteld. De add-on laat dit zo tot u iets wijzigt.",
|
||||
"manual_blocked": "De fasen wisselen hooguit eens per 10 minuten. Dit wacht."
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user