Repository navigation
fix(loadpoint): a binding fuse no longer stops a battery boost - #2011
Conversation
The boost check stopped (or refused) a boost whenever the fuse or import limit was binding, which is exactly when the battery's discharge helps. The car's limit comes from the measured meter either way. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0124SQZZwXFRjnTEvh4SNrjp Signed-off-by: Erik <[email protected]>
frahlg
left a comment
There was a problem hiding this comment.
Reviewed and tested locally. go vet and go test for cmd/ftw, internal/loadpoint and internal/api pass, and so do the full make verify and the box-UI tests on master merged with #2011, #2012 and #2008.
An independent review traced the fuse path. The car's limit comes from EVFuseBudget on the metered site and from pendingBatteryCommandsW, not from FuseSaturated, so removing fuse_safety_block and import_limit_block removes no physical protection. An offline, stale or at-reserve battery and a stale site meter still stop the boost, and restart restore uses the same check.
Two low notes, not blocking: with a battery that cannot discharge, the UI shows an active boost that delivers nothing, as BatteryCoversEV already does; and the check still has no unit test.
frahlg
left a comment
There was a problem hiding this comment.
Claude's review, posted at Fredrik's request. Read together with #2012.
This looks right.
- Stopping the boost when the fuse binds caused the jump it was meant to prevent: the battery left while the car sat at a level the battery had made room for. The car's limit still comes from the measured meter, and a rise in battery power counts as pending before the meter shows it, so the fuse rule holds.
- On its own this keeps a boost running that does nothing in the planner modes, so it should go in with #2012.
- The safety closure still has no unit test. Not a blocker, since this removes two branches.
Checked locally with #2012 merged on top: go vet ./internal/control ./cmd/ftw and go test ./internal/control ./internal/loadpoint ./cmd/ftw ./internal/api ./internal/mpc pass.
What changed
The core battery-boost safety check (
SetBatteryBoostSafetyingo/cmd/ftw/main.go) no longer returnsfuse_safety_blockorimport_limit_block. It serves three callers: enabling a boost, restoring one after a restart, and the per-tick check. All three now keep a boost while the fuse or the hourly import limit is binding. The other reasons are unchanged: core mode, battery hold, stale site meter, charger and battery health, reserve.Why
On a site with a 16 A fuse, the house loading one phase and the car capped by the fuse, enabling a boost failed with
HTTP 409 fuse_safety_block. A boost started earlier was stopped after about 45 s, while the car ramped up.FuseSaturatedis true whenever the joint allocator shares the fuse between battery and car. That is exactly when the battery's discharge helps, and stopping the boost only takes the battery away.The car's fuse limit does not depend on the boost.
EVFuseBudgetworks from the measured site meter, andpendingBatteryCommandsWcounts only rises in battery power. A discharge order earns the car room only once the meter shows it.Boundaries and safety
BatteryCoversEVtoggle, which never had this stop, a boost now runs with a binding fuse.Verification
go test ./cmd/ftw ./internal/loadpoint ./internal/api,go vet ./cmd/ftw.POST /api/loadpoints/garage/battery_boost→409 {"error":"fuse_safety_block"}.200, and the boost stayedactiveuntil it was cancelled.Performance
Nothing measurable: the change removes two comparisons from a check that runs once per loadpoint tick.
Overlap
Draft #1789 (fuse protection as one function) touches this closure. Its boost change, the import-limit stop reason, is already on master via #1783. The draft has conflicted with master since 27 Oct, so this PR is based on master.
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_0124SQZZwXFRjnTEvh4SNrjp