Skip to content

Polestar credential: API, Connection page and documentation - #83

Merged
vcanuel merged 5 commits into
mainfrom
polestar-connection
Oct 21, 2026
Merged

vcanuel merged 5 commits into
mainfrom
polestar-connection

Conversation

@vcanuel

@vcanuel vcanuel commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Part of #52 (step 4; the check on a real car remains).

API

  • PUT /connection/polestar (session only, the three values in the body): a token is asked for and the VINs listed before the credential is stored. Refused: 400 credential_refused; reading no vehicle: 409 no_vehicle; portal unreachable: 502 source_unavailable; over the account's vehicle cap, counted over all its vehicles: 409 too_many_vehicles. The VINs listed are added to the account.
  • DELETE /connection/polestar erases the credential only. Migration 0024 lets a Polestar connection stay without one: its vehicles and history are kept, and the collector no longer reads them until another credential is given.
  • GET /connection gives polestar: last4, set_at, expires_at (90 days after it was given, an assumption) and refused_at. Never the credential.
  • A vehicle's connection names its provider; a Polestar's has credential (set, refused, missing) and a null api_key. unshared_at comes with the vehicle; the failure kinds include credential_refused, unshared, not_granted.
  • A Polestar without a family is offered the brand's variants (catalog.Brand), and the variant chosen sets its family; PUT …/model checks it with catalog.Chosen.
  • The Volvo Data Portal's files are refused for a Polestar: 409 not_volvo.
  • RUNSTEN_POLESTAR_BASE_URL is read by runsten-api as well.

Contract changes are in api/openapi.yaml and internal/api/testdata/ (a Polestar added to the fixtures; connection-polestar.json).

Web

  • Connection page: a Polestar section (steps to the Data Portal, a link to the guide, the three fields, the credential's last four characters and dates, a reminder two weeks before it expires, its refusal, its removal).
  • Per vehicle: credential refused or removed, vehicle no longer shared, a domain not granted, with the vendor's words for pauses, quotas and failures.
  • Vehicle page: when the car last measured its values, beyond 30 minutes.
  • Vehicle settings: a Polestar's variants are offered without a family; no import of the Volvo Data Portal's files.

Development

sim.env, task run-api, run-collector and connect-sim use the simulated Data Portal; connect-sim gives its development credential. Try it with tilt up -- --scenario=commute,polestar2.

Documentation

documentation/guide/polestar.md (beta): creating the credential, the five domains, giving it, choosing the variant, the 90 days.

Left open

  • ps2-lr-single-2024 has no sourced net capacity: chosen, it gives no energies.
  • A Volvo ID connection counts only its own vehicles against the cap.

Checks

task unit (but web-audit: a vite advisory already on main), task integration, and task system, including compose-test (116 Playwright tests with axe).

🤖 Generated with Claude Code

vcanuel and others added 4 commits October 21, 2026 00:22
PUT /connection/polestar asks the Data Portal for a token with the owner's
credential and lists its VINs before storing it: a credential refused, one
that reads no vehicle, or a portal that does not answer is not stored, and
the vehicles listed are added to the account, under its vehicle cap.
DELETE erases the credential only: migration 0024 lets a Polestar
connection stay without one, its vehicles and history kept, unread by the
collector until another is given. GET /connection tells its last four
characters, when it was given, when it expires and whether it was refused.

A vehicle's connection now names its provider; a Polestar's tells its
credential's state, and the vehicle when it is no longer shared. The
failure kinds know the Data Portal's. A Polestar without a family is
offered its brand's variants, and the one chosen sets its family. The
Volvo Data Portal's files are refused for a Polestar.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Polestar section beside the Volvo ID: the steps to the Data Portal and
a link to the guide, the three values checked as the API does, the
credential's last four characters, when it was given and when it
expires, a reminder two weeks before, its refusal, and its removal. Each
vehicle tells a credential refused or removed, a vehicle no longer
shared and a domain not granted, in the vendor's words. The vehicle page
tells when the car last measured its values once that is more than half
an hour ago. A Polestar's settings offer its brand's variants and no
import of the Volvo Data Portal's files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
runsten-api and the collector read the simulated Data Portal in task
run-api, run-collector and sim.env; task connect-sim gives its
development credential after the Volvo ID, and connects either alone
when the scenario has no Volvo or no Polestar (commute,polestar2 in tilt).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A guide to the owner's credential: creating it on the portal, the five
domains to grant, giving it to Runsten, choosing the variant, the 90
days, what is read and when, and what is still in beta until checked on
a real car.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
8.3.1 carries a high severity advisory of launch-editor (the dev server's
opening of a file in an editor), which fails the dependency audit. 8.3.4
is a patch release of the same line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vcanuel
vcanuel merged commit 0845219 into main Oct 21, 2026
5 of 7 checks passed
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