Skip to content

feat(app): save household planner prefs over the session - #1479

Draft
frahlg wants to merge 1 commit into
masterfrom
cursor/plan-household-prefs-1a28
Draft

frahlg wants to merge 1 commit into
masterfrom
cursor/plan-household-prefs-1a28

Conversation

@frahlg

@frahlg frahlg commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Contract-pair: srcfl/ftw-webapp@cursor/plan-household-prefs-1a28

Problem and result

The phone app needs to save the Plan card's household prefs. GET /api/planner/prefs is already a read. POST /api/planner/prefs is actuation, so the session was refusing it with E_USE_CMD and no command to name.

planner.prefs.set stores safety_k and battery_export through the same write the HTTP route performs. The box maps that permission onto a planner mode and returns the stored factor. The caller does not choose the mode.

planner_passive_arbitrage and planner_arbitrage stay in the mode catalogue. The dashboard hides those keys; Home Assistant still uses them.

Paired with srcfl/ftw-webapp#76. contract/registry.yaml is the same file in both.

Scope and safety

The command uses ftw.mode.write and is not a dispatch write, same as changing the site mode: a sick meter must not lock the household out of holding more reserve. The plan that comes out of the prefs still meets the dispatch gate before anything moves.

Open PRs #1474, #1470 and #1337 also touch go/internal/api/api.go. This change adds Via(planner.prefs.set) on the existing prefs POST only.

Verification

go test ./internal/appproto/ ./internal/api/ ./cmd/ftw -count=1 -run 'TestRegistry|TestPlannerPrefs|TestDoesNotExist' passed, which compiles the uplink wiring and runs the prefs command tests.

No UI in this repository.

Checklist

  • The change follows one scope: the session door for an actuation route that already exists.
  • Overlapping PRs checked. Shared file is go/internal/api/api.go.
  • Tests cover a missing port, bad arguments, and an applied write.
  • No UI changed.
  • Changeset included.
  • Commit has a DCO sign-off.
Open in Web Open in Cursor 

POST /api/planner/prefs changes dispatch, so the phone writes safety_k
and battery_export with planner.prefs.set. The box still maps that
permission onto a planner mode.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>
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