Skip to content

iPhone: one honest number for what the plan saves (plan pass 3) - #59

Closed
frahlg wants to merge 2 commits into
claude/ios-plan-levelfrom
claude/ios-plan-saving
Closed

frahlg wants to merge 2 commits into
claude/ios-plan-levelfrom
claude/ios-plan-saving

Conversation

@frahlg

@frahlg frahlg commented Oct 14, 2026

Copy link
Copy Markdown
Member

Plan pass, change 3 of 5: one honest number for what the plan saves. Stacked on change 2 (#58).

What changes

Under the dial, between the cheapest hours and the planned line, one mono line:

CIRKA 10 KR BILLIGARE ÄN UTAN BATTERI · TILL TORS 21:30

It is the box's own planner's reckoning: the plan's cost for the hours it covers against the same hours with no battery. "Till" names where those hours end, so the number has a span.

When it says nothing

The line is left out, rather than shown with a caveat, when:

  • the plan ends more than 5 points from where it starts. A plan that ends emptier has spent stored energy, and the plain difference would flatter it;
  • the saving is under 1 kr (100 minor units), or a number is missing;
  • the box has not sent its planner's document.

It never compares against self-consumption, whose baseline drains the battery and so reads cheaper than it is. Nothing is said on Now.

Where it comes from

/api/mpc/plan, which the plan view reads already for the sky: total_cost_ore, baselines.no_battery_ore, initial_soc, and the last action's soc and end. No Core change.

The demo's plan used to end at 39 % from 62 %, so the rule hid its saving. Its day now stops giving power in the last eight hours once the battery is 2 points under where it started, so the demo shows the line and the rule still holds. That is a separate commit, e7d9d59.

Evidence

  • swift test: FTWShared 220 and FTWKit 368 tests green. New: PlanSavingTests (the home box's 14 Oct plan says 28 kr; a plan that ends emptier says nothing, with the 5-point edge on both sides; no saving to speak of says nothing) and theSavingComesFromThePlannersDocument.
  • UI tests on the iPhone SE (3rd generation), iOS 26.5, after the demo commit: NowFitsTests 11 of 11, PlanStripTests 3 of 3, PlanDialTests 3 of 3.
  • Pictures below, from the demo in Swedish.

Pictures

The plan view dark and light, and at the largest text scrolled to the line, which wraps and holds its place.

The saving under the dial

🤖 Generated with Claude Code

frahlg and others added 2 commits October 14, 2026 21:11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
So the plan's saving compares honestly and the plan view shows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 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-14T19:42:37.755007Z e7d9d59 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7d9d59329

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +144 to +145
let worth = Self.saving(wire?["plan"])
if worth != saving { saving = worth }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor pending metadata before publishing savings

When /api/mpc/plan returns meta.replanning or meta.outdated, this extracts and publishes the previous plan's saving anyway. After a mode or preference change, plan.get can advance first and stop the follow loop while this request returned the old plan, leaving the old saving displayed beneath the new plan until the next quarter-hour refresh. LoadpointsModel.load already treats these same flags as making plan-derived values unavailable; suppress the saving while either flag is set as well.

Useful? React with 👍 / 👎.

@@ -144,6 +147,7 @@ extension SimulatedHouse {
var b = decide(price: price, mean: mean, pv: pv, base: base, ev: ev, soc: soc, mode: modeKey)
if b > 0, soc >= 0.98 { b = 0 }
if b < 0, soc <= Self.minSoc { b = 0 }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Rebalance both sides of the demo's terminal SOC

This lower bound does not ensure that the demo plan ends near its starting level: it blocks discharge below the floor, but later cheap-price or solar charging can still leave the battery far above the start. At the canonical DemoRig start (12 Oct at noon in Stockholm, SOC 0.62), the 24-hour plan finishes around 0.91, so PlanSaving.savedMinor rejects it for exceeding the 5% slack and the demo still shows no saving. The terminal handling needs to constrain or rebalance upward drift too.

Useful? React with 👍 / 👎.

frahlg added a commit that referenced this pull request Oct 14, 2026
…nst guessed, and the planning style as a scale (#58, #59, #60, #61)

One squash for four stacked PRs, changes 2–5 of the plan pass Fredrik approved on 14 Oct 2026 (change 1 was #57):
- #58: the planned battery level in the scrub, a dashed level line in the lanes and the dial's story (socPermille from srcfl/ftw#1630).
- #59: one honest saving under the dial, against no battery, only when the plan ends near its start level.
- #60: known against guessed: the dashed sun, hatched unpriced quarters, the style named when it is not balanced.
- #61: the two levers at the foot of the plan view, the planning style as a detented scale (Fredrik's note 21), one command on release with the receipt, and only moved quarters cross-faded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@frahlg

frahlg commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

Included in #61, merged as 36af0e6.

@frahlg frahlg closed this Oct 14, 2026
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