EV-15: the add-on's own phase change at the peak reserve raises no false alarm

While the add-on holds the car at 0 A for its own phase change, the car's
figure had no corroboration (not charging), so nothing was explained and the
peak-floor alarm fired once. For grading only, the car's fresh, not stuck
figure now stands in for that sequence (bounded: its own waits plus one
corroboration window), ending at once on Off, Stop, shadow, unplug, another
writer or a refused write. car_exclude, the claim, floor and writes unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
glenn schrooyen
2026-11-17 13:26:56 +01:00
co-authored by Claude
parent f66048b287
commit 2cfbc4aec8
6 changed files with 355 additions and 12 deletions
+6
View File
@@ -125,6 +125,7 @@ class ManualWriter:
self.phase_fails = 0 # phase selects the charger did not take
self.phases_gave_up = False
self.undone = 0 # sequences undone before the select
self.phase_done_at = None # EV-15: our phase change ended well then
# ------------------------------------------------------------------ user
def user_changed(self) -> None:
@@ -296,6 +297,7 @@ class ManualWriter:
if not ok:
self._failed(now)
return
self.phase_done_at = None
self.seq = {"stage": "zero", "t0": now, "n": n, "tries": 0,
"prev": cur}
@@ -336,6 +338,7 @@ class ManualWriter:
self.log.append(("phases", q["n"], now, ok))
q["stage"], q["t1"] = "settle", self.last_done # from its return
if not ok:
q["failed"] = True # EV-15: no grace for the alarm
# The charger did not take it: the car gets its current back
# on the old phases after the same SETTLE_S as a taken select
# (HA may have taken it and only the read-back be late), and
@@ -356,7 +359,10 @@ class ManualWriter:
# still wanted, and one that is in place is adopted.
self.seq, self.rev_applied, self.reapply = None, None, False
self.fails, self.blocked = 0, False
if not q.get("failed"):
self.phase_done_at = self.last_done # EV-15
return
q["failed"] = True # EV-15: a refused write ends it
q["tries"] += 1
if q["tries"] >= MAX_TRIES:
# Left at 0 A is the safe side; the next reading re-applies.