Skip to content

Show no charging power where the car says no charge runs - #111

Merged
vcanuel merged 2 commits into
mainfrom
ex30-idle-power
Oct 25, 2026
Merged

vcanuel merged 2 commits into
mainfrom
ex30-idle-power

Conversation

@vcanuel

@vcanuel vcanuel commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

An EX30 answers chargingPower with PROPERTY_NOT_FOUND while idle, in the same response that says no charge runs (status IDLE, type NONE). The State page showed Power as "Unknown". It now shows "None" when the car itself says no charge runs, and keeps "Unknown" for a power missing during a charge.

Changes

  • Front end: the Power reading falls back to the car's word that no charge runs (charging status idle, done or scheduled; else, without a status, type none), shown as "None" (en, fr, sv) with that reading's times. Charging, discharging or in error, a missing power stays unknown. Display only: nothing is stored as 0 W, so the charges' energies, the curves and the MQTT charging_power_kw topic (empty, as for any unknown value) are unchanged.
  • Simulator: the ex30-like profile answers chargingPower PROPERTY_NOT_FOUND while idle and uploads it while charging (an assumption until confirmed on a real car); the ex30 scenario now runs this profile. The field errors take the real API's codes and messages (PROPERTY_NOT_SUPPORTED "Property is not supported for this vehicle", PROPERTY_NOT_FOUND "No valid value could be found for the requested resource"). transferLimit is not simulated: Runsten does not read it.

Screenshots

Before After
before after

The Charging tile of the simulated EX30, parked and idle: Power reads "None" instead of "Unknown".

Tests

  • task unit: Go (fmt, lint 0 issues, unit tests, govulncheck, build) and web (vue-tsc, ESLint, Prettier, 1288 Vitest tests, audit, build), passed.
  • New tests: noChargeReading (every status and type), the Power reading on the State page (idle, charging, French), Availability.While, and the simulator's chargingPower while idle and while charging.
  • Not run locally: task integration and task system (no store, Compose or Dockerfile change); the CI runs them.

Closes #98

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Charging power is now reported only while the vehicle is charging, while capability information remains available when idle.
    • Vehicle status displays “None” when there is no charge and power is unavailable; unavailable power while charging continues to display as “Unknown.”
    • Unsupported and missing vehicle properties now use clearer, consistent error responses.
  • Localization
    • Added translations for “None” in English, French, and Swedish.

vcanuel and others added 2 commits October 25, 2026 22:29
A car may leave the charging power out while idle (an EX30 answers it
PROPERTY_NOT_FOUND), in the same response that says no charge runs. The
State page showed it as unknown; it now shows none, the times of the
charging status beside it. A power missing during a charge stays unknown.
Nothing is stored as zero: the readings and the charges' energies are
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The ex30-like profile answers chargingPower PROPERTY_NOT_FOUND while idle,
as a real EX30 does, and uploads it while charging (an assumption). The
EX30 scenario runs that profile. The field errors take the codes and
messages the real API gives: PROPERTY_NOT_SUPPORTED, "No valid value could
be found for the requested resource".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between c552a7d and 7dd09a7.

Files selected for processing: 15
  • internal/simulator/polestarapi/handler.go
  • internal/simulator/vehicle/vehicle.go
  • internal/simulator/vehicle/vehicle_test.go
  • internal/simulator/volvoapi/handler.go
  • internal/simulator/volvoapi/handler_test.go
  • internal/volvo/normalize.go
  • scenarios/ex30.yaml
  • web/src/entities/vehicle/index.ts
  • web/src/entities/vehicle/model/mode.ts
  • web/src/shared/i18n/locales/en.json
  • web/src/shared/i18n/locales/fr.json
  • web/src/shared/i18n/locales/sv.json
  • web/src/widgets/vehicle-state/ui/VehicleState.vue
  • web/test/entities/vehicle/mode.test.ts
  • web/test/widgets/vehicle-state/VehicleState.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

The simulator now models charging power as available only while charging for the EX30-like profile, and Volvo API responses apply that state-dependent availability. The vehicle-state page displays a localized “None” reading when charging status indicates no charge and power is absent.

Changes: Charging-power behavior

Layer / File(s) Summary
Availability rule and EX30-like profile
internal/simulator/vehicle/vehicle.go, internal/simulator/vehicle/vehicle_test.go
Adds NotFoundIdle and Availability.While(charging). The EX30-like profile uses NotFoundIdle for charging power.
Charging API responses
internal/simulator/polestarapi/handler.go, internal/simulator/volvoapi/handler.go, internal/simulator/volvoapi/handler_test.go, internal/volvo/normalize.go, scenarios/ex30.yaml
Charging power is reported as supported while charging and not found while idle. Unsupported properties use PROPERTY_NOT_SUPPORTED. The EX30 scenario uses the ex30-like profile.
No-charge reading and vehicle-state display
web/src/entities/vehicle/*, web/src/widgets/vehicle-state/ui/VehicleState.vue, web/src/shared/i18n/locales/{en,fr,sv}.json, web/test/entities/vehicle/mode.test.ts, web/test/widgets/vehicle-state/VehicleState.test.ts
Adds noChargeReading and uses it to display localized no-charge values when power is absent. Tests cover reading selection and the displayed values.

Priority: Low

Severity of issue fixed: Low

Merge Risk: Minimal · up to 7dd09

The EX30 charging-power and State page changes are ready to merge after normal checks; no actionable merge risk was identified.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title is short, imperative, in English, and accurately describes the change to show no charging power when the car reports no active charge.
Description check Passed The description explains the change and rationale, includes screenshots for the interface change, identifies tests and their results, documents tests not run, and includes Closes #98. It does not re…
Linked Issues check Passed Issue #98 asks whether Power should show 0 kW or a dash when the car says no charge runs. It also asks that the ex30-like simulator profile reflect the unsupported fields. The PR shows "None" instead.…
Out of Scope Changes check Passed The changes address #98. They cover the front-end power display, the simulator's ex30-like charging-power availability, the simulator's field error codes and messages, the ex30 scenario that uses that…
Full details: Description check

Explanation

The description explains the change and rationale, includes screenshots for the interface change, identifies tests and their results, documents tests not run, and includes Closes #98. It does not reproduce every template checkbox explicitly, but it provides the required information and is substantially complete.

Full details: Linked Issues check

Explanation

Issue #98 asks whether Power should show 0 kW or a dash when the car says no charge runs. It also asks that the ex30-like simulator profile reflect the unsupported fields. The PR shows "None" instead. The PR objectives state this outcome as the chosen display, and it answers the issue's question with a reason.

Evidence at the reviewed head:

  • web/src/entities/vehicle/model/mode.ts: noChargeReading returns the charging status when it is idle, done or scheduled. With no status, it returns the charge type when the type is none. Otherwise it returns null, including while charging, discharging or in error.
  • web/src/widgets/vehicle-state/ui/VehicleState.vue: the power value uses power_w when present. Otherwise, a no-charge reading gives t('charging.power.none'). Otherwise the value is null, which the tile shows as Unknown.
  • internal/simulator/vehicle/vehicle.go: NotFoundIdle maps to NotFound while idle and to Supported while charging. The ex30-like profile sets ChargingPower to NotFoundIdle and ChargingCurrentLimit to Unsupported.

Not implemented, with stated reasons:

  • transferLimit is not simulated. The PR states that Runsten does not read it.
  • chargerPowerStatus is not read. The issue says it "may" help, so it is not a stated requirement.

The test results come from the PR description. I did not run the tests. The whole-PR diff could not be read, so the simulator handler changes rest on the PR summary.

Full details: Out of Scope Changes check

Explanation

The changes address #98. They cover the front-end power display, the simulator's ex30-like charging-power availability, the simulator's field error codes and messages, the ex30 scenario that uses that profile, and tests for these behaviors.

Two changes need a note:

  1. internal/simulator/polestarapi/handler.go: renderBattery now checks ChargingPower.While(true). Only the NotFoundIdle availability, used by ex30-like, changes result. It keeps charging power reported while charging for that profile.
  2. web/src/shared/i18n/locales/fr.json: adds the missing charging.type.none label. The Type reading on the same Charging tile that #98 names uses this label. This is a small related fix.

No unrelated change was found. The whole-PR diff could not be read because changed blobs are missing from the checkout. The polestarapi and volvoapi handler changes rest on the PR summary. The head files read (mode.ts, vehicle.go, VehicleState.vue) match the summary.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@vcanuel
vcanuel merged commit d9a0f94 into main Oct 25, 2026
8 checks passed
@vcanuel
vcanuel deleted the ex30-idle-power branch October 25, 2026 21:57
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.

EX30: chargingPower is PROPERTY_NOT_FOUND while idle, Power shown as "Unknown"

1 participant