-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VOC api not working for android auto vehicles #84
Comments
What vehicle are you querying? Vehicles with AAOS (Android Automotive OS) like the XC40 P8 and P6 are not supported yet |
2022 XC60 Recharge, also uses android automotive. |
Quote from their website: "This API works for all connected cars up to model year 2021, excluding the XC40 Recharge BEV.": |
I have not yet found a way to query the car,.. looking forward to someone that does. Currently I cannot find a way to trace the app either, to register a car it requires Bluetooth which is not supported in Bluestacks and such |
I have a regular XC40 too and when switching from one to the other the app restarts and changes into the same look as yours without the vehicle buttons in the bottom... I'll make some screenshots to demonstrate |
At a minimum they are using an undocumented oauth method secured by the volvo account. I was able to see they make a request to an oauth endpoint using the volvo account to authorize it, then get a token to use for future requests but the requests aren't showing up in charles. I suspect they are using grpc so it's just tcp traffic not showing up in charles. |
exactly, tried it with charles proxy too and couldn't capture enough detail to reverse engineer what they do :( |
One thing i did take note on is unlike the public api docs they are not including a |
They also do not allow the app to be installed on apple silicon (this is a specific setting you disable in appstore connect) so they are intentionally hiding it like that. |
Here are some screenshots and a recording when switching from one car to the other to demonstrate complexity: |
any update on this? |
Thanks for triggering this. I have checked Volvo's website and the Connect and Extended Vehicle APIs still do not support XC40 P8 / full electric. But... they introduced a new "Energy API": |
I try to use this new API, but i'm getting 404 when make https://api.volvocars.com/energy/v1/vehicles/{{VIN}}/recharge-status |
I had the same issue 🙈stopped when it became too difficult... might try again soon... |
I think you guys might be interested in my post here on the Home Assistant integration issue covering this. I've set up a complete Postman implementation of the 3 APIs (Connected Vehicle, Energy and Extended Vehicle) that you can test, and have also made some hopeful progress on obtaining oAuth credentials from Volvo to get this API working outside their sandbox 🤞 All three APIs work just fine with a MY23 XC90 Recharge (AAOS), including commands. I'd be interested to hear how you do with your vehicles. |
Great job @andynash ! Thanks for this. Looks like the Energy API doesn't work yet on the XC40 P8, but while configuring the APIs I noticed that the Extended and Connected Verhicle APIs now work! This is good news, I can finally pre-heat my car when my Home Automation (OpenHAB) says the temperature is below a certain temp... 👍👍 |
@nikagersonlohman Great stuff, shame about the Energy API though 😔 I take it you will also need to wait for Volvo to let us publish apps before you can use the Connected/Extended APIs? Or do you have another way to access them, eg scraping? |
I have only been able to use the hourly tokens, so I will soon create a script to use selenium to click on the right tags (assume that's what you meant with scraping?) |
Ah yes, have now seen your comment on the HA issue, yes that's what I meant - Selenium is a good call if Volvo don't come through with the key/secret 👍 |
Wel... I have published a quick-and-dirty release of getting the authorization with Selenium... Be aware, this will still have many bugs... |
Good to know, the following code works to authenticate and query the (in this case extended-vehicle) Volvo APIs for Electric Cars as well:
|
When you'd like to use the API's with Postman, you can use a Pre-request Script like the following:
Simply define the Volvo On-call Username and Password variables and it replaces the access tokens from you collection (@andynash). You can also use the default Volvo collections from here: Import them into Postman and create the collections from the API. For this, use the following Pre-request Script:
To use them for all collections, I use "global" variables instead of collection variables. Just need to set them once :)
|
@nikagersonlohman Thanks for the script. |
For those in the US...Still waiting for Volvo to make the endpoints available for our country. Eager to do some app development once it's available. |
where did you get this from? |
I found it "on the web"... assume it was somehow traced/debugged/reverse-engineered from the Volvo App, or someone somehow leaked it. Officially you need to apply for a key at the Volvo Developer portal for the app you're developing, but Volvo does not supply them yet: |
Thanks for this bud! I was becoming crazy thinking if it was the demo car or just mine (which is new but no so new 😆 ) Does anybody know what it would be needed to bump the core HA integration code to be compatible with our new models? If not I guess that I will need to do my usual dirsy, very dirty, workaround with node-red and from there add in HA as new entities :( Thanks anyway, very good thread! |
Ok, some good and bad news after some days playing :) So... at least we know that the API work and that the integration is fixable... Sadly my python skills are not enough for fixing the integration. Besides the Volvo developer portal where there is a lot of info... I got the requests formats and some very usefull toolkit to do tests from this repo from @andynash : https://www.postman.com/andynash/workspace/volvo-apis/collection/6009097-92ddc541-ef84-4d87-acec-03b1b19abd9b?tab=overview For now I have just added some stuff that I use most (it gets refreshed every 5min), im only missing the car location: So for everyone... as doing this dirty way with node-red...etc is very far from clean... I can only say to other people that the integration is fixable for our cars... so with some time I guess we will have in Home Assistant core this working again :) |
If anyone is interested in the node-red flow, here I posted the info: home-assistant/core#61785 (comment) |
Maybe it is interesting for someone who is facing exactly this problem. I have built a MQTT bridge to connect AAOS cars to Homeassistant. Take a look here: https://github.com/Dielee/volvo2mqtt |
Located in the US.
The official volvo on call app works for my vehicle. But all calls to the voc api used by this project simply fail with a 500 error:
I used charles to take a look at how the official volvo app works. I can see it making requests to these URLs:
It appears their app is using the new api but when I follow the docs and query my account i just get an empty list for my vehicles, but querying their demo data shows a valid vin / vehicle to query.
Is there no working API for north america anymore?
The text was updated successfully, but these errors were encountered: