Skip to content

fix(loadpoint): a binding fuse no longer stops a battery boost - #2011

Merged
frahlg merged 1 commit into
masterfrom
fix/boost-survives-binding-fuse
Nov 14, 2026
Merged

frahlg merged 1 commit into
masterfrom
fix/boost-survives-binding-fuse

Conversation

@erikarenhill

@erikarenhill erikarenhill commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

The core battery-boost safety check (SetBatteryBoostSafety in go/cmd/ftw/main.go) no longer returns fuse_safety_block or import_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. FuseSaturated is 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. EVFuseBudget works from the measured site meter, and pendingBatteryCommandsW counts only rises in battery power. A discharge order earns the car room only once the meter shows it.

Boundaries and safety

  • The per-phase fuse guard, the meter-based car limit and the joint allocator are unchanged.
  • Like the site-wide BatteryCoversEV toggle, which never had this stop, a boost now runs with a binding fuse.
  • The two stop reasons stay in the API and UI vocabulary for statuses saved by older versions.
  • Out of scope: whether the battery actually covers the car in planner modes. That is a separate PR (fix(control): a battery boost makes the battery cover the boosted car #2012).

Verification

  • go test ./cmd/ftw ./internal/loadpoint ./internal/api, go vet ./cmd/ftw.
  • The safety closure has no unit test and still has none. This change removes two branches.
  • Live on a Raspberry Pi site (Easee Cloud, Pixii, 3×16 A), with L2 at 14.5 A and the car fuse-limited to 7 A:
    • Unpatched: POST /api/loadpoints/garage/battery_boost → 409 {"error":"fuse_safety_block"}.
    • Patched: 200, and the boost stayed active until 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

  • The diff implements one scope and does not add follow-on work.
  • I checked open pull requests that touch the same files (fix(control): fuse protection as one function #1789, above).
  • Tests cover the changed behaviour and its failure path (live evidence above; the closure has no unit test).
  • No UI changed.
  • A Changeset is included.
  • Every commit has a DCO sign-off.

🤖 Generated with Claude Code

https://claude.ai/code/session_0124SQZZwXFRjnTEvh4SNrjp

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 frahlg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
frahlg merged commit 13b085d into master Nov 14, 2026
23 checks passed

@frahlg frahlg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants