Integration of Polestar 2

I think you only need to add the following to your configuration.yaml to achieve that (with the correct odometer sensor name for you of course).

utility_meter:

    # Trip meter daily
    trip_meter_daily:
        source: sensor.polestar_1565_current_odometer_2
        cycle: daily
        unique_id: 4A295E2B32

Just did this now to try. Will have to confirm it works when I use the car. But I’m pretty sure this will work.

EDIT:
It works as expected. Recorded my shopping run yesterday and then reset to zero at midnight.

1 Like

Hi everyone,

I have been using the integration for som e time now without issues.
But the other day when I cam back home after a week of travel i noticed the integrations did not work anymore. I got API error. I noticed there was an update for the integratopn to v 1.6.0.
Did the upgrade but since then it doe snot work at all.
Tried unistalling it and reinstalling it, but I only get “Unexpected error creating api” when I try to enter credentials when adding integration.

Does anyone know what might be the error?

Finally got it to work again :slight_smile:
The only thing that worked for me was to manually delete the custom components “polestar api” files, reboot Home assisant and start over again.

Hi,
where do you get your charing power from?

From a Shelly EM (programmed with ESPHome s/w) on the charger (Wallbox Pulsar Plus) line.

I have the HA Wallbox integration, but found the power reported by the Wallbox to be unreliable.

good when you only charge at home…
I thought more to add the Geo-Locations in account as well, and than display home vs “elsewhere” charging.

alias: Polestar API Restart
trigger:
  - platform: state
    entity_id:
      - sensor.polestar_XXXX_api_status_code
    for:
      hours: 0
      minutes: 10
      seconds: 0
    from: OK
condition: []
action:
  - service: homeassistant.reload_config_entry
    data: {}
    target:
      device_id: fe5eb71f031c15d080bea43889b2fc12
mode: single

That reloads the integration if the API stops being ‘OK’ for 10 minutes. Worth noting that it hasn’t fired for a couple of weeks which might indicate this is more reliable now, though I have been doing work in HA so restarting the whole thing fairly regularly.

1 Like

Thank you!

The integration has been rock solid for weeks! Thanks again @leeyuentuen for the hard labor. Hence, no need to reload either.

Give me a finger I will take the hand: Is there a way to get the location information?

I used to get that reliably from the HA AAOS app in the car, but that has stopped working a while ago and the development of the app seems to have died all together.

The Polestar phone app provides the info, so this integration can as well?

1 Like

the authentication on app is different then on api(web)

they didn’t provide the information.

i need to reverse engineer the mobile app. but it is not so easy + now the app used 2fa to make more complicated

Thanks for your great effort - patience is needed here, but I hope you can carry this through

The best way to get location at the moment is with car stats viewer if you can get on one of the tracks. Link is further up the thread, it is on the German Polestar forum.

The HA app still works for me, which is another option. It does not update as often. CSV is almost real time.

CSV is pretty limited though. For a start, it’s user dependent so no help if someone else (a partner, say) uses the car, unless you sign them up to a test track too and set it up on their account. Plus it gets closed if the car has been parked long enough for the infotainment to hibernate or a different user has logged in, meaning you have to remember to manually open it again next time you drive.

This is working great for me, so a big thanks! Most all of the data is updating properly and showing the correct values.

However, I notice that the software version is not correct. For me, this integration is showing a value of “P02.13”. But my car is running “2.14.3”. This is pretty low on the list of priorities, but I thought I’d mention it and see if others were seeing a similar issue.

First of all @leeyuentuen a big bow for your work, what you did, I only found this topic today. I’ve been searching for a way to connect for some tomen trying to figure out the API, and for now I was working with the EEVEE plugin. But works, but that’s about it…
I’m a DevOp myself. Is there a ‘postman’ collection/workspace then I can use to examine the API responses? I wasn’t able to connect to the API with Postman, so if I’m there, i might be of some help (don’t program myself, but do bugchecking/beta testing for several apps)

I’m using a utility meter sensor to get the daily milage from the odometer reading:

utility_meter:

    # Trip meter daily
    trip_meter_daily:
        source: sensor.polestar_1565_current_odometer_2
        cycle: daily
        unique_id: 4A295E2B32     

But I noticed that some trips are double counted for the daily milage. Looking at the detail showed a strange behavior of the odometer reading that explains the double counting:

Is this a bug? Is it the car or is it the integration?

I think I can solve my issue by setting the ‘net consumption’ configuration variable for the utility meter to ‘true’.

utility_meter:

    # Trip meter daily
    trip_meter_daily:
        source: sensor.polestar_1565_current_odometer_2
        cycle: daily
        net_consumption: true
        unique_id: 4A295E2B32

Thought it was still worth flagging this issue here.

I’ve been using this for a few months and it has been working great! Having this has enabled me to add some functionality that I didn’t have before.

  • I can now control the Charge Level by setting the Polestar 2 to 100% and watching the SoC via this integration to stop the charge from my EVSE
  • I can detect when the EVSE is connected to the car. I was able to do this before with my Emporia EVSE through some templating, but having a second source works great for triggering Actionable Notifications
  • I can more reliably use Excess Solar Charging by also leveraging the SoC sensor

I’ve updated my dashboard to look like this:

The ability to set the Max Charge remotely is my favorite

2 Likes

I have updated the car to software version 3.0.3. The Polestar app shows the updated version number. This integration still shows P02.14.

Not important, but anyway.

Same here. Updated this morning (just search for new update while driving) and it updated to 3.0.3. Integration still shows P02.14. It’s nice to see charging power and charging current now.

Mine now shows 3.0.0. The Polestar app shows 3.0.3.

Charging current and power work great.