Skip to content

fix(web): follow the car's planned charge on an EV step - #1542

Merged
frahlg merged 1 commit into
masterfrom
cursor/ev-expected-charge-b146
Oct 10, 2026
Merged

frahlg merged 1 commit into
masterfrom
cursor/ev-expected-charge-b146

Conversation

@frahlg

@frahlg frahlg commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Problem and result

The car card showed 76% and a plan from 76% to 80%. Opening the full plan still said Expected charge 24% after next step and 10% at the end of the plan.

Those percents are the home battery on the same slot (soc, with start SoC 17% in the header). The next step is Charge EV at 11.0 kW, so Expected charge now uses that car's planned SoC (loadpoint_soc / loadpoint_soc_by_id): about 79% in the car after next step and 80% in the car at the end of the plan for the reported 2.8 kWh then 1.1 kWh into an 86.5 kWh pack.

The overview card uses the same sentence, so it no longer shows the home battery as the car's charge either. A home-battery step is unchanged. Start SoC in the plan header stays the home battery.

If the next step charges more than one car, one percent is not invented. If an EV step has no car SoC, the home-battery figure is labeled as the home battery.

Scope and safety

Web briefing only (web/plan-brief.js). No planner, dispatch, or driver change. Open PR #1177 touches web/plan.js for hidden-tab polling; this change does not.

Verification

npm test — 707 passed.

The briefing was rendered with the app CSS at phone width and desktop width, using a plan shaped like the screenshots (home battery 24% then 10%, car 79.2% then 80.4%).

Phone width: expected charge follows the car
Desktop: expected charge column

Not checked on a live site. A person still needs to look at the rendered plan on a real box.

Checklist

  • The change follows VISION.md and one selected scope.
  • I checked overlapping PRs and coordinated shared files/contracts.
  • Relevant checks cover the changed behaviour and failure paths.
  • A human reviewed changed UI in a browser, or no UI changed.
  • A Changeset is included, or the change is exempt.
  • Every commit has a DCO sign-off.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Expected charge used the home battery's SoC on the same slot, so a car
at 76% read as 24% after the next step and 10% at the end of the plan.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@frahlg
frahlg marked this pull request as ready for review October 10, 2026 05:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 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-10T05:42:04.375422Z 4950ad2 Draft marked ready
ℹ️ 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 96a9c5b into master Oct 10, 2026
12 checks passed

@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: 4950ad2900

ℹ️ 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 thread web/plan-brief.js
Comment on lines +315 to +316
const where = car ? " in the car" : (evStep ? " in the home battery" : "");
const nextFrac = car ? car.nextSoc : (next ? next.soc : null);

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 Avoid inventing a home battery on multi-car sites

When a batteryless site schedules two cars in the same step, carChargeForecast deliberately returns null because it cannot choose one car, but every Go Action still serializes soc: 0; consequently batteryIsPresent returns true and this branch renders “0% in the home battery” even though no home battery exists. Handle the ambiguous multi-car case without falling back to next.soc, or determine battery presence independently of the always-present aggregate soc field.

Useful? React with 👍 / 👎.

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