evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Polestar: chargingStatus removed from API

Open loebse opened this issue 6 months ago • 32 comments

Describe the bug

Polestar removed chargingStatus from the API which leads to an error and SoC is no longer available

Steps to reproduce

  1. Maintain a Polestar vehicle ...

Configuration details

vehicles:
  - name: vehicle_0
    title: Polestar
    type: template
    template: polestar
    user: ****
    password: ****
    vin: ****
    capacity: 82

Log details

[lp-1 ] ERROR 2026/05/21 13:41:24 charger soc: Message: Validation error of type FieldUndefined: Field 'chargingStatus' in type 'BatteryV2' is undefined @ 'carTelematicsV2/battery/chargingStatus', Locations: [{Line:1 Column:262}], Extensions: map[], Path: []

What type of operating system or environment does evcc run on?

Docker container

External automation

  • [x] I have made sure that no external automation like HomeAssistant or Node-RED is active or accessing any of the mentioned devices when this issue occurs.

Nightly build

  • [x] I have verified that the issue is reproducible with the latest nightly build

Version

0.306.3

loebse avatar May 21 '26 11:05 loebse

...which makes the integration useless?

andig avatar May 21 '26 11:05 andig

I will look into it later to see if there is an alternative. Last time they removed a field it came back 2-3 hrs later...

loebse avatar May 21 '26 12:05 loebse

It looks like the API is completely broken. In HA there is no data at all after a reload of the integration.

` Dieser Fehler stammt von einer benutzerdefinierten Integration

Logger: backoff Quelle: custom_components/polestar_api/coordinator.py:89 Integration: Polestar API (Dokumentation, Probleme) Erstmals aufgetreten: 03:33:27 (1 Vorkommnis) Zuletzt protokolliert: 03:33:27

Giving up _execute_once(...) after 3 tries (gql.transport.exceptions.TransportConnectionFailed) `

oskarfessel avatar May 21 '26 12:05 oskarfessel

It looks like the API is completely broken. In HA there is no data at all after a reload of the integration.

` Dieser Fehler stammt von einer benutzerdefinierten Integration

Logger: backoff Quelle: custom_components/polestar_api/coordinator.py:89 Integration: Polestar API (Dokumentation, Probleme) Erstmals aufgetreten: 03:33:27 (1 Vorkommnis) Zuletzt protokolliert: 03:33:27

Giving up _execute_once(...) after 3 tries (gql.transport.exceptions.TransportConnectionFailed) `

No, as mentioned above: one field has been removed. I can make it work with a little trick (use the EstimatedChargingTimeToFullMinutes to see if it is charging) but I guess this is nothing we want in prod.

loebse avatar May 21 '26 13:05 loebse

We could make it work again like this https://github.com/evcc-io/evcc/pull/30074

However, I am wondering if this is feasible @andig

loebse avatar May 21 '26 14:05 loebse

I wouldn‘t know :/

andig avatar May 21 '26 16:05 andig

I wouldn‘t know :/

It works technically, the question is rather if you are ok to merge such a work around.

loebse avatar May 21 '26 17:05 loebse

Sure! Would be even better if we had a captured timestamp as base for the addition?

andig avatar May 21 '26 17:05 andig

Not really sure what you mean by captured timestamp tbh.

loebse avatar May 21 '26 18:05 loebse

Remaining duration is relative. But relative to what? To be meaningful this needs a timestamp as your api call may be x amount of time in the past.

andig avatar May 21 '26 18:05 andig

The logic is: if the remaining charging duration is greater than 0, the car is actually charging. If charging is complete, the remaining time is 0. If it is not charging at all, the remaining time is NULL.

While the remaining duration is relative, it does not really matter to identify whether the car is charging or not.

loebse avatar May 22 '26 05:05 loebse

Of course it does! If you check the api every 15m and remaining is 5m thats quite a difference.

andig avatar May 22 '26 06:05 andig

It seems this has already been resolved on the Polestar Forum:

https://polestar.fans/t/polestar-api-zu-mqtt-im-container-openwb-v1-anbindung-moeglich/18589/298

Can the approach taken there be applied here as well?

GitJS01 avatar May 22 '26 06:05 GitJS01

It seems this has already been resolved on the Polestar Forum:

https://polestar.fans/t/polestar-api-zu-mqtt-im-container-openwb-v1-anbindung-moeglich/18589/298

Can the approach taken there be applied here as well?

Just removing the field charging status as they did? Not a solution.

loebse avatar May 22 '26 07:05 loebse

Of course it does! If you check the api every 15m and remaining is 5m thats quite a difference.

Is that actually a problem?

Let's take your example: System would show charging for 10mins while it already finished charging. After 10 mins it will change to the correct status.

It's not good but better than it is right now. I do not see an alternative right now with the recent changes. From past experience it might change again soon...

loebse avatar May 22 '26 07:05 loebse

Fine with me!

andig avatar May 22 '26 07:05 andig

We can enter or retrieve the total battery size in kwh already, and if we can fill in the start %, shouldn't we be able to display a battery percentage based on the charged kwh? Seems that's a very safe fallback for when the battery is not reported for all cars.

E.G 72 kWh battery, we start from 10% and we charge 15 kWh, the display can be 31 % Of course if a reported battery percentage of the car is available that should be used

TijsDeBelie avatar May 22 '26 13:05 TijsDeBelie

We can enter or retrieve the total battery size in kwh already, and if we can fill in the start %, shouldn't we be able to display a battery percentage based on the charged kwh? Seems that's a very safe fallback for when the battery is not reported for all cars.

E.G 72 kWh battery, we start from 10% and we charge 15 kWh, the display can be 31 % Of course if a reported battery percentage of the car is available that should be used

How does that help to determine the status wether the car is currently charging or not?

loebse avatar May 22 '26 14:05 loebse

We can enter or retrieve the total battery size in kwh already, and if we can fill in the start %, shouldn't we be able to display a battery percentage based on the charged kwh? Seems that's a very safe fallback for when the battery is not reported for all cars. E.G 72 kWh battery, we start from 10% and we charge 15 kWh, the display can be 31 % Of course if a reported battery percentage of the car is available that should be used

How does that help to determine the status wether the car is currently charging or not?

That still works tho, if there is energy going into the car, the car is charging. It's currently only the battery % that is not being displayed

Image

TijsDeBelie avatar May 22 '26 14:05 TijsDeBelie

No, that’s not the problem. The SoC is not displayed because the API call has an error because the chargingStatus field has been removed from the API. We still get the current SoC, this is not a problem.

loebse avatar May 22 '26 14:05 loebse