v0.2.1 — Balancing-cycle race fix
What's new
Bug fixes (since v0.2.0)
-
Spurious sessions during BMS battery balancing (#21) — the previous balancing-cycle guard from PR-14 relied on an internal "previous car-status" memory that was only refreshed when the car-status sensor's state-change event fired. On real go-e hardware the charger pushes
trxandcar_statusupdates near-simultaneously over WebSocket, and thetrxevent consistently arrived first — so the guard's decision logic ran before the memory had been updated and started a new spurious session.Live-observed impact (2026-04-24): a single plug-in event produced 22 short sessions instead of 1 over a ~2-hour balancing window.
Fix: the guard now uses a synchronously-set boolean gate that is engaged in the same code path that ends a session and cleared only on
car_status → "Idle"or"Wait for car". Behaviour is independent of which entity event fires the listener, so the race cannot recur.Defensive additions: the gate engages on session end only when
car_statusis exactly"Complete"(so non-go-e profiles with different end-states are unaffected), and on Home Assistant restart while balancing was in progress (currentcar_status == "Complete"or unknown at recovery time).
Internals
- 14 new tests covering the race reproduction, 20-cycle synthetic stress test, gate-clear conditions, micro-session gate engagement, and four recovery branches.
- 8 obsolete
_prev_car_statustests removed. - The
BALANCING_SKIPdebug-log message wording is preserved verbatim for log-history continuity.
Upgrade
Via HACS: open Home Assistant → HACS → EV Charging Manager → Update. Restart Home Assistant after the update completes.