Repository navigation
Description
Runsten carries the Polestar variants in its model catalogue (ADR 0022), but no source reports a Polestar: the collector reads the Volvo Cars API only, and a Polestar is not reachable through it (a Polestar ID, not a Volvo ID). The documentation says so: "no data source reports one yet".
The official way in is the Polestar Data Portal (EU Data Act) and its M2M API: the owner creates API credentials in the portal and reads their own car's data. It is the same "bring your own credentials" model as the Volvo developer application, and what ADR 0003 and docs/research/polestar-data-portal.md §6 point to. The architecture is ready for a second source: a source produces readings (ADR 0035), the derivation is source-agnostic (ADR 0013), the OAuth refresher is generic (ADR 0014).
What is known (community integrations, Home Assistant and evcc, all 🟡; the OpenAPI spec is behind the portal's sign-in)
- OAuth2 client credentials: App client ID, client secret (shown once), account ID in
x-client-id; scopes chosen in the portal; an expired credential is recreated by hand. - Base URL
https://pc-api.polestar.com/eu-north-1/data-portal/m2m; read only, GET:/v1/vehicles, and per VINtelemetry/{battery, location, odometer, health, …}andcharging/{…}. - About 10 000 requests a day, 100 a minute.
- EU/EEA only.
- Freshness: a poll returns what the car last uploaded. Battery and climate a few minutes old, doors 36 h, health 58 h.
Open questions, to settle with a tester
- Which models answer (Polestar 2, 3, 4, 5).
- How fresh location and odometer are, while driving and parked: trips can be derived only if they follow the car. If they do not, the source gives charges and battery, and the trips stay to other sources (imports, Vehicle without a Volvo connection: created by hand, fed by imports and pushed readings #45).
- The quota per credential, and the polling cadence it allows.
Scope
- An ADR for the Polestar source (amending ADR 0003 and ADR 0035's table): access, cadence, mapping, what it cannot give.
- Schema:
connections.provideracceptspolestar, holding client credentials instead of a user's OAuth tokens. - A
polestarpackage: token, list of vehicles, readings normalised to snapshots (ADR 0035); the collector polls it beside Volvo. - Vehicles recognised in the model catalogue (ADR 0022) from what the API returns.
- Web: connect a Polestar by pasting its M2M credentials; show the age of the data when it is old.
- Simulator: a Polestar scenario (ADR 0006), so that it is testable without a car.
- Documentation: a guide to create the credentials in the Polestar Data Portal.
- Verified on a real Polestar by an owner (help wanted: the maintainer has none).
Activity
vcanuel commentedon Oct 20, 2026
The simulator part is in #80 (runsten 7a50d9e): the Polestar Data Portal's M2M API served by
runsten-simulatorfor scenarios ofbrand: polestar.scenarios/polestar2.yamlis the demonstration car.What it settles of the open questions: the token is
POST /tokenwithclientId/clientSecret(nogrant_type), valid for 1 h.x-client-idcarries the Account ID, not the OAuth client ID./v1/vehiclesgives VINs only, so the model must come from the VIN or from the user's choice.Remaining: the
polestarclient and normaliser, the schema and the collector by provider, the Connection page and the guide, and the check on a real Polestar.vcanuel commentedon Oct 20, 2026
Simulator merged in runsten 89e49c9 (#80). The issue stays open: the client, the collector, the Connection page and the check on a real Polestar remain.
vcanuel commentedon Oct 20, 2026
Step 2 (the
internal/polestarclient), in progress on the branchpolestar-client, not committed yet. A finding that changes a later step:LPSis shared). The normalizer therefore reads the model year (10th character) andBatteryElectric, but leaves the family unknown: a wrong family would recognize a wrong variant.catalog.Chosen,catalog.Recognizeand the API's choice of a variant all require a family read. Without a change, a Polestar would have no variant, no net capacity, and unknown energies.catalog.Chosenand the API accept a vehicle of the brand without a family). To do in step 3 or 4.Other findings from the specification, applied in the client:
/v1: any 401 there is taken for an expired token (assumption).AUTHZ_CLIENT_ID_MISMATCH(wrong account ID) is handled as a refused credential.CHARGING_STATUS_V2_…); the values ofchargingStatusV2missing from the decision's table are mapped (SMART_CHARGING_WILL_NOT_FINISHcounted as charging, an assumption);CHARGING_TYPE_WIRELESSis left absent.vcanuel commentedon Oct 20, 2026
runsten 1479e7a: step 2, the
internal/polestarclient, in #81 (part of this issue, so it does not close it).DATA_NOT_AVAILABLE, 429 withRetry-After.polestar.Normalizerfor the sourcepolestar, and the fingerprint without the upload's time and identifiers.Remaining: step 3 (migration, collector by provider,
derivewith one normalizer per source, the brand's variants offered when the family is unknown), step 4 (API, Connection page, documentation), step 5 (a real car).vcanuel commentedon Oct 20, 2026
Step 2 merged in runsten 0dbb0bb (#81): the
internal/polestarclient, errors and normalizer. The issue stays open for steps 3 to 5.vcanuel commentedon Oct 20, 2026
Step 3 (schema and collector by provider), in progress on the branch
polestar-collector, not committed yet. Decisions taken while working:Snapshot.Endpoint,Call.Endpoint,Failure.EndpointandVehicleState.Nextmove to a neutralcollector.Endpointtype: a Polestar domain cannot honestly be avolvo.Endpoint. The Volvo tests of the collector change by type conversions only (Endpoint(volvo.Location),volvo.Endpoint(c.Endpoint).API()): no scenario, figure or assertion changed, and they pass.Sourceis its own package,internal/collector/polestarsource, so that the derivation's end-to-end tests run the real one; the collector itself does not importpolestar.Left for step 4: the API's enumeration of failure kinds does not know the three new ones (
credential_refused,unshared,not_granted); the API's vehicle list reads a Volvo connection's columns; offering the brand's variants (offered). The catalog has no sourced net capacity for the Polestar 2 Long Range Single Motor 2024 (ps2-lr-single-2024, the demonstration car's): chosen, it gives no energies yet.vcanuel commentedon Oct 20, 2026
runsten ba8aa22: step 3, the schema and the collector by provider, in #82 (part of this issue, so it does not close it).
runsten_poll_targets()gives the provider.Source(internal/collector/polestarsource): token kept in memory, the reactions of the decision's table, 10,000 calls a day per credential.derive.Sources: one normalizer per source. A Polestar's brand stands in for its unknown family: a variant of the brand chosen sets it, and gives the energies their net capacity.polestar2(three trips, a DC and an AC charge, incremental equal to rebuild) and on a fleet of a Volvo and a Polestar.Remaining: step 4 (API, Connection page, documentation,
sim.envand the Taskfile, the API's failure kinds and vehicle list, the brand's variants offered), step 5 (a real car).vcanuel commentedon Oct 20, 2026
Step 3 merged in runsten f2c9dda (#82): the schema and the collector by provider. The issue stays open for steps 4 and 5.
vcanuel commentedon Oct 20, 2026
Step 4 (API, Connection page, documentation), in progress on the branch
polestar-connection, not committed yet. Decisions taken while working:PUT /connection/polestarchecks the credential first (a token, then the VINs). Not stored when refused (400 credential_refused), when it reads no vehicle (409 no_vehicle: the listing is the only way its vehicles come in), or when the Data Portal does not answer (502 source_unavailable). The vehicle cap counts every vehicle of the account (409 too_many_vehicles).DELETE /connection/polestarerases the credential only: the connection, its vehicles and their history stay, no longer read until another credential. This needs a small migration (0024): a Polestar connection may have no credential, since deleting the row would delete its vehicles.connectionnames itsprovider; a Polestar's hascredential(set,refused,missing) and a nullapi_key.unshared_atcomes with the vehicle; the failure kinds knowcredential_refused,unshared,not_granted.Found, left for later: the Volvo ID connection counts only its own vehicles against the cap, so a Volvo can still be added to an account that already has a Polestar at the cap. The Polestar 2 Long Range Single Motor 2024 still has no sourced net capacity.
vcanuel commentedon Oct 20, 2026
runsten 4f3b053, 0b96855, 9f6e1f0, 93d1237: step 4, in #83 (part of this issue, so it does not close it).
task connect-simgives the simulator's credential (tilt up -- --scenario=commute,polestar2).Remaining: step 5 (a real car); the sourced net capacity of the Polestar 2 Long Range Single Motor 2024; the Volvo ID's vehicle cap counting the account's other vehicles.
vcanuel commentedon Oct 21, 2026
runsten a124424 (in #83): vite updated to 8.3.4, whose 8.3.1 failed the CI's dependency audit (a launch-editor advisory, already on main). Nothing else changes.
vcanuel commentedon Oct 21, 2026
Step 4 merged in runsten 0845219 (#83), with the vite fix a124424: the API and the Connection page for a Polestar credential, and the Polestar guide (beta). The issue stays open.
Remaining:
vcanuel commentedon Oct 21, 2026
Step 5 changes (decided 2026-10-21): no recruited tester. Polestar ships in beta, as the guide already says, and the check of the decision is made on the first users' cars, through the logs. The collector will log, with neither VIN nor credential:
/v1(status, code, message, the token's age), and a 429 (code, message,Retry-After, rate limit headers, the connection's calls of the last minute and day);Also on the branch: the Volvo ID counts every vehicle of the account against the cap; the Polestar 2 Long Range Single Motor 2024 has its net capacity (79 kWh, two secondary sources agreeing).
vcanuel commentedon Oct 21, 2026
runsten dc72170, 8f1b1a8, dacb15f, f66d9b5, in #85 (part of this issue, so it does not close it).
Remaining: step 5, the check on the first users' cars in beta, by these logs.
vcanuel commentedon Oct 21, 2026
Merged in runsten 66e29db (#85): Go 1.27.3, the vehicle cap counting every vehicle of the account, the net capacity of the Polestar 2 Long Range Single Motor 2024, and the collector's logs measuring the Data Portal on real cars.
Remains: step 5, checking the beta on real cars through these logs. The issue stays open.
vcanuel commentedon Oct 22, 2026
Merged in runsten 3b40c7f (#86, part of this issue, so it does not close it): d440d1a, 79fa2da, d15e8f1.
not_admitted) until the account is admitted, as the Volvo sign-in already was.Remains: step 5, the beta in production and its check on real cars through the collector's logs.
vcanuel commentedon Oct 22, 2026
runsten c7d8c21, in #87 (part of this issue, so it does not close it).
Remains: step 5, the beta in production and its check on real cars through the collector's logs.
vcanuel commentedon Oct 22, 2026
Merged in runsten f44fca3 (#87, part of this issue, so it does not close it): the documentation names no brand where it speaks of the car; the supported cars are listed in one place (the docs home and the guide home), and the sidebar has a "Connecting your car" section with Volvo and Polestar (beta).
Remains: step 5, the beta in production and its check on real cars through the collector's logs.
vcanuel commentedon Oct 22, 2026
#88 rewords the confirmation of a saved credential without naming the collector.
vcanuel commentedon Oct 22, 2026
Merged in runsten bcea4c6 (#88): the confirmation of a saved credential no longer names the collector.
vcanuel commentedon Oct 25, 2026
First report from a real Polestar 3: a self-hoster connected it through the Data Portal (built from main, before v0.9.0) and the car shows up. Not yet known: how often it sends its readings while driving, asked to them. Their feedback is in #99 to #103.
vcanuel commentedon Oct 25, 2026
The self-hoster's Polestar 3: a first drive of 2 × 1 km came out as a reconstructed trip (no route). Too short to tell how often the car uploads while driving: a longer drive followed by a charge is to come, and they will report. They also offer the Data Portal's documentation as they copied it, which says that some calls are available to some models only.
vcanuel commentedon Nov 9, 2026
Done, released in v0.9.0: the Polestar source read through the owner's Data Portal credentials, and checked on a self-hoster's Polestar 3 (their feedback in #99 to #103). How often the car uploads while driving, and the paces that follow from it, are followed in #152.