Closed leeyuentuen closed 5 months ago
@loebse, quick fix to let use partial new endpoint (not investigate other stuffs). https://github.com/leeyuentuen/polestar_api/releases/tag/1.5.7
It appears that getBatteryData and getOdometerData have been moved to mystar-v2
. Queries like getConsumerCarsV2 are still in /my-star
@wouterhardeman should work on the new beta version, can you check the message above?
All entities are back up again. There's also a new (static) value: Torque
All entities are back up again. There's also a new (static) value: Torque
ya, I was planning to do something, but it seems it doesn't work. I want to calculate the charging speed, but I need to know the battery size (what I have) I don't know what the battery limit is set atm. so I can't continue
All entities are back up again. There's also a new (static) value: Torque
ya, I was planning to do something, but it seems it doesn't work. I want to calculate the charging speed, but I need to know the battery size (what I have) I don't know what the battery limit is set atm. so I can't continue
You could make an estimate by using the time delta between battery percentage going up and then diving that by the battery size. I could have a try and implement it if you want?
All entities are back up again. There's also a new (static) value: Torque
ya, I was planning to do something, but it seems it doesn't work. I want to calculate the charging speed, but I need to know the battery size (what I have) I don't know what the battery limit is set atm. so I can't continue
You could make an estimate by using the time delta between battery percentage going up and then diving that by the battery size. I could have a try and implement it if you want?
be my guest to try it out. not sure how accurate the delta time will be, because sometimes it only updates every 5 min or something.
i'll close this issue, for more discussion, we can continue on disuccion https://github.com/leeyuentuen/polestar_api/discussions/95
Have just hit the same in https://github.com/evcc-io/evcc/issues/11754. Followed your change, i.e. use /mystar-v2
for battery and odometer. Unfortunately, I'm seeing
{
"errors" : [ {
"errorType" : "UnauthorizedException",
"message" : "Unauthorized"
} ]
}
for the new endpoint, using identical token as for the original endpoint. Did you notice anything like this?
Have just hit the same in evcc-io/evcc#11754. Followed your change, i.e. use
/mystar-v2
for battery and odometer. Unfortunately, I'm seeing{ "errors" : [ { "errorType" : "UnauthorizedException", "message" : "Unauthorized" } ] }
for the new endpoint, using identical token as for the original endpoint. Did you notice anything like this?
depends which call you get this exception. the call the odo and battery call it is only the url
the other getcarinformation add extra variable to locale
Only odo and battery. Maybe I‘ll need to test with different car to see if that makes a difference. Thank you!
Btw, https://github.com/leeyuentuen/polestar_api/commit/aa88faf730b03bb3f67a702f70eb948acd884a93#diff-6c13acca0123ef6e56fd0bfc79573379cde1a7f9a1cd556b39f9a301cfdebfeeR106 looks wrong- local instead of locale? But still works?
Only odo and battery. Maybe I‘ll need to test with different car to see if that makes a difference. Thank you!
Btw, aa88faf#diff-6c13acca0123ef6e56fd0bfc79573379cde1a7f9a1cd556b39f9a301cfdebfeeR106 looks wrong- local instead of locale? But still works?
nice, maybe it should filled in to get work. but i'll change them next time
@leeyuentuen thanks for bearing with me. Could I ask you to kindly confirm that this works for you?
TOKEN=...
curl -X POST --data '{"query":"query getCars{getConsumerCarsV2{vin,internalVehicleIdentifier}}","operationName":"getCars"}' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $TOKEN" \
https://pc-api.polestar.com/eu-north-1/my-star
curl -X POST --data '{"query":"query GetOdometerData($vin:String!){getOdometerData(vin: $vin){odometerMeters}}","variables":{"vin":"<VIN>"},"operationName":"GetOdometerData"}' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $TOKEN" \
https://pc-api.polestar.com/eu-north-1/mystar-v2
It doesn't for me on the 2nd request:
{
"errors" : [ {
"errorType" : "UnauthorizedException",
"message" : "Unauthorized"
} ]
}
i'll check later. i'm not at my pc today
@andig it works for me
using the following curl call:
curl -X POST --data '{"query":"query getCars{getConsumerCarsV2{vin,internalVehicleIdentifier}}","operationName":"getCars"}' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $token" \ https://pc-api.polestar.com/eu-north-1/my-star
curl -X POST --data '{"query":"query GetOdometerData($vin:String!){getOdometerData(vin:$vin){averageSpeedKmPerHour eventUpdatedTimestamp{iso unix}odometerMeters tripMeterAutomaticKm tripMeterManualKm}}","variables":{"vin”:”<vin>"},"operationName":"GetOdometerData"}' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $token" \ https://pc-api.polestar.com/eu-north-1/mystar-v2
Thank you, much appreciated. Seems there are further implementation differences that I'll need to figure out.
@leeyuentuen additional difference I've found is authentication. Seems you're using the flow that the web app is using while I was using a different flow for polexplore
. Could I kindly ask you to share a curl
example for getAuthToken
graphQL? For some weird reason I always bump into " BAD USER INPUT
and I'm still unsure if really all vehicles should work for the new auth of if this is maybe a weird firmware-difference thing. Much appreciated!
i haven't use in this api the getAuthToken. but the graphql should be like this:
query GetAuthToken($code: String) { getAuthToken(code: $code) { access_token refresh_token id_token expires_in } }
by the way, it would be interesting if you were using polexplore. on my API version here I'm using polmystar
if you have token from polexplore, then you should also get access on the climate and the door unlock feature I suppose
@andig maybe easier to continue in the discussion thread? https://github.com/leeyuentuen/polestar_api/discussions/95 because is not really an issue but more a discussion
Discussed in https://github.com/leeyuentuen/polestar_api/discussions/95