Skip to content

fix(control): stop charging at the configured soc_max in every mode - #1867

Merged
frahlg merged 1 commit into
fix/fuse-one-functionfrom
codex/ems-soc-max-limit
Oct 26, 2026
Merged

frahlg merged 1 commit into
fix/fuse-one-functionfrom
codex/ems-soc-max-limit

Conversation

@frahlg

@frahlg frahlg commented Oct 26, 2026

Copy link
Copy Markdown
Member

With batteries.<driver>.soc_max: 0.9 and a fresh 90% reading, EMS could still send a 10 kW charge order. The configured limit reached the planner, but Core's charge stop only checked for 100%. A battery could therefore refuse charge while FTW kept requesting it.

EMS now stops charging at each battery's soc_max, falling back to the planner's limit and then 100% when neither is set. The same stop covers all control modes, manual holds, self-tuning, quiet ticks and dispatch holdoff. It runs after the final fuse adjustment. A battery at its charge ceiling can still discharge or help relieve an import overage.

The existing one percentage point restart gap follows the chosen ceiling: a 90% stop resumes at 89%. Config reload updates the limit on the next control tick, and command feedback reports that same restart level.

Tests

  • Before the fix, TestConfiguredSoCMaxStopsDispatch failed in both charge and planner_arbitrage: each sent 10,000 W at the configured 90% ceiling, with no solar and 1,000 W of grid import.
  • Tests cover every mode with both dispatch paths; charge below the limit; fleet and scoped manual holds; a capable sibling; self-tuning without a prior control tick; a prior charge order during holdoff or a quiet tick; hysteresis and missing SoC; config precedence and reload; default 100% and an explicit zero; import fuse relief; the export guard; and the API's 89% restart level.
  • GOCACHE=/private/tmp/ftw-goran-go-cache GOFLAGS=-p=2 make verify: passed (Go tests, native solver checks, protocol checks, vet and build). The Docker-context check skipped because no Docker daemon is running.

Base and scope

Stacked on #1789 (fix/fuse-one-function, c60da23), which already changes these control paths and carries the per-battery SoC floor. The diff against that branch contains only this charge-ceiling fix and its tests. Retarget to master after #1789 lands.

The separate report of an Idle plan beside a charge order still needs logs from the event. This PR does not claim to explain it. No hardware test or deployment has been performed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T17:45:07.644612Z 1dbbce4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@frahlg
frahlg merged commit 6e58e5e into fix/fuse-one-function Oct 26, 2026
1 check passed
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.

1 participant