Repository navigation
fix(setup): write Core's control timings from the setup guide - #2156
Merged
Merged
Conversation
The setup guide wrote control_interval_s 5, slew_rate_w 500 and min_dispatch_interval_s 5. It copied the defaults when it was added in April (#66); the defaults moved to 2 s / 3000 W / 2 s in May (#293, #298) and the guide did not follow. Settings → Control showed the same old values as its fallbacks. The guide now sends 2 / 3000 / 2, and Settings → Control shows them. It cannot leave the fields out: with a house password the box stores the guide's settings as sent and fills no defaults, so a missing slew_rate_w would turn the ramp limit off. wizardOrDefaultSeed still knows a guide seed only by 5 / 500 / 5. An older Core saves 2 / 3000 / 2 for an untuned home, and that save must import after a rollback. Tests: a guard that the guide and the Control tab match applyDefaults, the seed check for the old and new values, and an older Core's save with default timings importing over live Settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Problem
The setup guide writes
control_interval_s: 5,slew_rate_w: 500andmin_dispatch_interval_s: 5into every new home (web/setup.js). Core's defaults are 2 s, 3000 W and 2 s (applyDefaults).The values are left over, not chosen. The guide copied the defaults when it was added on 16 April 2026 (#66,
bc1a2850). The defaults moved on 24–25 May (#293 for 2 s / 2 s, #298 for 3000 W), and nobody changed the guide. No issue or ADR keeps 5/500/5. Settings → Control used the same old numbers as its fallbacks (fc799836, April).A field report on 2 December (Pixii battery and meter, battery export not allowed) showed about 30 s of battery export after each heat-pump stop. At 500 W per dispatch and one dispatch per 5 s, cutting 3 kW takes 30 s. #2155 fixes the export case in control. This PR fixes the timings every new home gets.
Change
web/setup.jssends 2 / 3000 / 2.web/settings/tabs/control.jsshows 3000 / 2 / 2 as fallbacks.wizardOrDefaultSeedkeeps its 5/500/5 test; only its comment changes.applyDefaults. Onmaster's web files it reports all six old values.Why the guide cannot leave the fields out
With a house password, which is the normal path, the box stores the guide's JSON as sent (
saveInitialAssistantStorage→SaveStored). Stored Settings get no defaults on load, onlyFillUnsetTimings, which fillscontrol_interval_sbut notslew_rate_w. A missingslew_rate_wwould be stored as 0, and 0 means no ramp limit (TestStoredZeroTimingsLoadAsDefaults). Only the YAML path, without a password, runsapplyDefaults.Seed detection
wizardOrDefaultSeedtells a guide seed beside live Settings from an older Core's save after a rollback. It still matches only 5/500/5:TestWizardSeedDoesNotOverrideLiveSettings,TestWizardOrDefaultSeedKnowsOnlyTheOldGuide).TestRollbackSaveWithDefaultTimingsImports).state.db:saveInitialConfigrefuses (fix(config): do not start setup over live Settings #1175).A 5 s meter and a 2 s tick
The Pixii driver polls every 5 s (
return 5000,device-driversdrivers/lua/pixii.lua:835). On a 2 s tick with no newer meter sample,siteMeterHeldholds dispatch: the PI does not run, and targets stay or move toward zero (holdTowardZero). The PI addsKi·erroronce per update, with no time factor, so it sees the same samples, one step each, at a 2 s or a 5 s tick.So the 2 s tick gains such a meter one thing: a new sample waits at most 2 s for a dispatch instead of up to 5 s. It adds no dispatches. The ramp limit applies per dispatch, so for a 5 s meter 3000 W per cycle is 600 W/s, against 100 W/s at 500 W. For the field report the ramp limit matters more than the tick.
Homes already on 5/500/5: should they move?
This PR changes no stored Settings. My recommendation is to move them, with Fredrik's yes.
For moving:
wizardOrDefaultSeedalready rests on that.Against:
battery.Model.UpdatewithdtS), so it refits after the change. Changing the interval in Settings does the same today.The option, not built: at boot, stored Settings with exactly 5/500/5 move once to 2/3000/2 as a new Settings revision, with a heal event that names both values and a stored marker so it never runs twice. An older Core reads that revision unchanged. Owners who want 5 s can set it back in Settings → Control. Until then, an affected owner can change the three fields by hand.
Evidence
make verifygreen on this machine.npm test: 1082 pass, 0 fail.master'sweb/the same steps stored and showed 500 / 5 / 5.Open PR #1051 also touches
web/setup.js, but not these lines.🤖 Generated with Claude Code