Volvo Oncall binding

Hi Ben,

Somehow I missed your reply, sorry about that. I’ve contacted you by PM, let’s try to schedule a Zoom or Teams session to resolve this as I am not sure either what is happening… might depend on the version of my rules, or something like that…

Regards,

Nika.

Well, that’s weird. The token_type is supposed to return “Bearer” instead of the entire authResponse.

The code is:

		var token_type = transform("JSONPATH", "token_type", authResponse)

Which is supposed to use the JSONPATH transform and look for token_type from the JSON:

{"access_token":"eyJhbGciOiJSUzI1NiIs<knip>NR5jd","token_type":"Bearer","expires_in":1799}

What version of OpenHAB are you using?

That was it! JSONPATH missing.
Now, everything is nicely rolling in! And we can start building nice things around it…

ps, I don’t agree with the average speed: 291 km/h. I know EV’s are fast, but that fast? Maybe I just need some extra readings to get my average lowered? Will now go for a relaxing drive… :wink:

Thanks for you effort and patience!!!

Nice Ben! Yes, the Volvo API is still somewhat buggy with some of the statistics. Good to know, they released a beta v2 version of the API which seems to be a bit more stable (and from my first tests using Postman it looks like the average speed is correct with v2):

I still need to incorporate it into the code.

Also good to know, maybe I should start a new thread, I have created some code to push the power percentage to ABRP (A Better Route Planner) using their API as well. Will publish it soon.

Still hoping some Java developer can actually create Bindings for this as well…

Regards,

Nika.

1 Like

Still hoping for someone to pick up development of the actual plugin from here. Home Assistant and Domoticz already have the plugins available…

Also good to know, Volvo now also published the location API:

Regards,

Nika.

I had a look at GitHub - Dielee/volvo2mqtt: Home Assistant addon for connecting AAOS Volvos. After getting the vcc-api-key from https://developer.volvocars.com/account/ and changing some configurations in the src/settings.json, I was able to connect to my XC40 BEV MY23. This addon communicates via MQTT (duh!) and I have succeeded to intercept with mosquitto_sub the message volvoAAOS2mqtt/availability online, but that’s about it. I haven’t figured out how to communicate via MQTT with the addon.

I know it isn’t a very beautiful solution, but a quick hack could be to have this addon running as a service on the OS and then set up a {Generic MQTT Thing | HomeAssistant MQTT Component} in OpenHAB. Has anybody else tried this and figured out the MQTT topics and commands?

In fact, OpenHAB autodiscovered my car thing as a HomeAssistant MQTT Component. It created applicable channels as well.

One alternative (again, not so beautiful), would be to create a service running the process, but this would(?) be platform dependent.

Hi,

I have a similar issue, though the token_type seems to be correct.

Script execution of rule with UID ‘volo-6’ failed: For input string: “{“access_token”:“eyJhbGciOiREDACTEDekGPZATLaVvw”,“refresh_token”:“oZQREDACTEDogRFTrHO0c4UZtZCRy5.Wk4oUK”,“token_type”:“Bearer”,“expires_in”:1799}”

It is also not being stored in an item.

I’m running openhab 4.0.3

Let me know if you need more information to help me debug.

I haven’t upgraded to 4.0.3 yet, I am still running 3.4.3. Might be an upgrade thing? Do you have more context for the error, as I have no clue where and how that might occur…

I found the issue… Everything was set up correctly but there was no JSONPATH transformation addon installed… All is good now!

Hi nikagl,

There is a new MG binding ([saicismart] Initial contribution by dougculnane · Pull Request #15894 · openhab/openhab-addons · GitHub) that has this ABRP functionality. I am testing it and was thinking of adding this to the Renault Binding. But maybe it should be a separate binding? Then all cars can use it and send it the State Of Charge from their car data item. This would make the functions more reusable and maintainable in one location. I can do the Java programming but I will need testers. Shall we start a thread and a new binding for all car types?

After playing around a bit I think the answer to this question is no. The URL get with parameters is simple to script or add to an existing binding. It will be a pain to map all the parameters and trigger an update using the openHAB item mappings etc… I am interested in other opinions but it looks like an easy to add feature in the car binding rather than a separate one.

Hi.
Sorry if this question is slightly off topic, but I have just ordered a new Volvo EX30 which will arrive in a couple of months. If I have understood correctly I won’t be able to control my new car using this binding, right? Anyone know if there is any ongoing work with bindings for the new Volvos? Or if there even is any good APIs so it’s possible?