Repository navigation
fix(control): boot legacy planner modes into passive arbitrage - #1991
Merged
Merged
Conversation
A stored planner_self or planner_cheap mode is replaced at restart by planner_passive_arbitrage and saved, the same way removed modes are replaced. Unknown stored values still keep the default mode. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0124SQZZwXFRjnTEvh4SNrjp
With the planner off, a stored planner_self or planner_cheap now boots into self_consumption instead of a planner mode with no plan. When no battery-export answer is stored or configured, the replacement saves not_allowed, so the household is not asked to allow selling that the legacy mode never did. The changeset now says passive arbitrage can grid-charge where planner_self did not. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0124SQZZwXFRjnTEvh4SNrjp
frahlg
added a commit
that referenced
this pull request
Nov 28, 2026
On a box the setup guide made, the planner was off and "Use the plan" was greyed out; the card sent the owner to Settings → Planner → Enabled → Save and a restart. The button now does that itself: it saves the same setting through the Settings write, restarts FTW when the planner has to start, hands the house to the plan and reads again every 3 s until the plan shows. An error shows under the button. The planning style, battery export and Manual… wait for the first plan, and a home without a battery no longer reads about a battery. While the forecast models still learn, the plan's forecast says "FTW learns your home over the first days." A box that never sold from the battery no longer asks whether selling may continue. DeriveBatteryExport answers not_allowed for every mode but active arbitrage, so a new box stores not_allowed. Turning the planner on from off records not_allowed for a box that stored unknown. An upgrade from active arbitrage is still asked, as #968 and #1991 intended. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg
added a commit
that referenced
this pull request
Nov 28, 2026
On a box the setup guide made, the planner was off and "Use the plan" was greyed out; the card sent the owner to Settings → Planner → Enabled → Save and a restart. The button now does that itself: it saves the same setting through the Settings write, restarts FTW when the planner has to start, hands the house to the plan and reads again every 3 s until the plan shows. An error shows under the button. The planning style, battery export and Manual… wait for the first plan, and a home without a battery no longer reads about a battery. While the forecast models still learn, the plan's forecast says "FTW learns your home over the first days." A box that never sold from the battery no longer asks whether selling may continue. DeriveBatteryExport answers not_allowed for every mode but active arbitrage, so a new box stores not_allowed. Turning the planner on from off records not_allowed for a box that stored unknown. An upgrade from active arbitrage is still asked, as #968 and #1991 intended. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg
added a commit
that referenced
this pull request
Nov 28, 2026
On a box the setup guide made, the planner was off and "Use the plan" was greyed out; the card sent the owner to Settings → Planner → Enabled → Save and a restart. The button now does that itself: it saves the same setting through the Settings write, restarts FTW when the planner has to start, hands the house to the plan and reads again every 3 s until the plan shows. An error shows under the button. The planning style, battery export and Manual… wait for the first plan, and a home without a battery no longer reads about a battery. While the forecast models still learn, the plan's forecast says "FTW learns your home over the first days." A box that never sold from the battery no longer asks whether selling may continue. DeriveBatteryExport answers not_allowed for every mode but active arbitrage, so a new box stores not_allowed. Turning the planner on from off records not_allowed for a box that stored unknown. An upgrade from active arbitrage is still asked, as #968 and #1991 intended. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg
added a commit
that referenced
this pull request
Nov 28, 2026
On a box the setup guide made, the planner was off and "Use the plan" was greyed out; the card sent the owner to Settings → Planner → Enabled → Save and a restart. The button now does that itself: it saves the same setting through the Settings write, restarts FTW when the planner has to start, hands the house to the plan and reads again every 3 s until the plan shows. An error shows under the button. The planning style, battery export and Manual… wait for the first plan, and a home without a battery no longer reads about a battery. While the forecast models still learn, the plan's forecast says "FTW learns your home over the first days." A box that never sold from the battery no longer asks whether selling may continue. DeriveBatteryExport answers not_allowed for every mode but active arbitrage, so a new box stores not_allowed. Turning the planner on from off records not_allowed for a box that stored unknown. An upgrade from active arbitrage is still asked, as #968 and #1991 intended. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg
added a commit
that referenced
this pull request
Nov 28, 2026
… its first start (#2098) * fix(web): Use the plan turns the planner on On a box the setup guide made, the planner was off and "Use the plan" was greyed out; the card sent the owner to Settings → Planner → Enabled → Save and a restart. The button now does that itself: it saves the same setting through the Settings write, restarts FTW when the planner has to start, hands the house to the plan and reads again every 3 s until the plan shows. An error shows under the button. The planning style, battery export and Manual… wait for the first plan, and a home without a battery no longer reads about a battery. While the forecast models still learn, the plan's forecast says "FTW learns your home over the first days." A box that never sold from the battery no longer asks whether selling may continue. DeriveBatteryExport answers not_allowed for every mode but active arbitrage, so a new box stores not_allowed. Turning the planner on from off records not_allowed for a box that stored unknown. An upgrade from active arbitrage is still asked, as #968 and #1991 intended. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]> * feat(planner): a new box plans from its first start Planner on from the start now means the plan drives. A box with the planner on in its config and no stored control mode starts in the planner mode its battery-export answer maps to, and stores it like the other first-boot values. A stored mode is kept. The startup replan runs 2 s after start, often before the first battery reading and prices, and failed. Only a planner mode retried a missing plan, so any other box waited for the 15-minute replan. Core now replans once as soon as prices and, for a site with a battery, a fresh charge level are in. On a test box the first plan came 5 s after the first start; master gave none in 90 s. While the forecast models still learn, caution takes its margin from priors, its alternative fails replay on a first plan and the box runs the valid point plan. The card no longer shows that as "Plan without extra forecast margin"; the learning line covers that time. A home without a battery gets no planning style, battery export or manual modes, and no "Why: Idle". Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]> * fix(planner): seed the planner mode only on a box's very first start An existing box with the planner on in its config that never stored a mode has run self_consumption all along. The seed would have handed it to the planner on its next start without its owner choosing that. The seed now needs a first start too. Core records a "startup" event at every start and never prunes the event log, and the setup wizard writes none, so an empty log read before this start records its own marks a new box. A box that ran before, or was restored from a backup, has events and keeps its mode. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]> * fix(web): keep Manual… in a planner mode, and offer Restart FTW Manual… is the only way off the planner on the Plan card. It waited for a plan, so a battery home in a planner mode with no plan (no prices for hours, or the battery offline) could not leave the planner from there. It now shows in a planner mode with a battery, plan or not, and waits only on a box that has never planned and runs the default mode. A battery in the settings counts while its driver is offline. When the restart after "Use the plan" fails, the planner setting and the mode are already saved. The card says so in place and offers "Restart FTW", which restarts and waits for the planner as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]> * fix(planner): read the first battery charge through a health-gated accessor The first-plan wait read battery readings straight from the telemetry cache, which the telemetry-read check refuses. telemetry gains FreshBatterySoCOnline: a charge level within BatterySoCMaxAge from a driver that is online and not calibrating, the planner's own gates on its starting charge. The wait uses it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Fredrik Ahlgren <[email protected]> --------- Signed-off-by: Fredrik Ahlgren <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
At boot,
restoreStoredModenow treats the legacy planner modesplanner_selfandplanner_cheapas no longer used. Like the removedpriorityandweightedmodes, they are replaced and the replacement is saved:priority,weightedself_consumptionself_consumptionplanner_self,planner_cheapplanner_passive_arbitrageself_consumptionValues FTW never had still keep the default mode and are left in place.
Battery export stays off
Neither legacy mode sold from the battery, and passive arbitrage doesn't either. When no
battery_exportanswer is stored in SQLite or set in YAML, the replacement savesnot_allowed. Without that, the self-consumption fallback would deriveunknown, and the dashboard would ask the household to "allow selling to continue" for selling that never happened. A stored or configured answer is kept.Behavior change to note
Passive arbitrage can charge the battery from the grid in cheap hours.
planner_selfnever did. The changeset says so.Not in this PR
AllModes/IsValidModestill accept the legacy keys onPOST /api/mode, from Home Assistant and in the site test scenarios ingo/test/site. Rejecting them there would break existing automations, so that should be a separate change.self_consumption("Self (manual)") is a valid mode and stays as it is.Tests
TestRestoreStoredModeReplacesRemovedAndLegacyModes.TestRestoreStoredModeLegacyPlannerModes: planner enabled, off or missing; the derived export isnot_allowed; a storedallowedis kept.go vet ./cmd/ftwandgo test ./cmd/ftwpass.Cross-audit
allowedplus a later preference change remaps to active arbitrage. Not taken: master does the same forplanner_self, because it is already a planner mode, and the household has answered "allowed".🤖 Generated with Claude Code
https://claude.ai/code/session_0124SQZZwXFRjnTEvh4SNrjp