Volvo2Mqtt: Connect your AAOS Volvo 🚙

I have an xc40 but my localization doesn’t work, could someone help me?
to be more specific I don’t have the location sensor

Hi all, can’t seem to get this to work it worked fine with 1.8 but then it lost connection ??

Please read the changelog. Vccapikey is now a list. Changelog

1 Like

Sitting in Australia with a Core setup, and happy to compile code/manually ssh files if I have to, but is it possible to drop this into my NUC running Centos 9, which has a happy little Core setup so far?

I have added custom git repositories for the my house battery and solar inverter, so happy to get messy with things, but is the code available to drop into my venv setup?

EDIT: OK it was that easy…

Just editing settings.json, made me a VCC API key, and made sure python dependencies were there…run.sh and we have data on the dashboard.

So this is the output from the CLI (about to systemd the run.sh)

So I have Range estimation, charging finish time, etc in the app when I am charging, so do these API end points only work while actually charging?

Fuel and distance to empty, seems logically not there.

Not sure what the 404 error was related to.

Sep 10 00:16:37 volvo2mqtt [33100] - INFO: Failed, Battery Charge Level is unfortunately not supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Battery Charge Level is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Failed, Electric Range is unfortunately not supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Failed, Estimated Charging Time is unfortunately not supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Failed, Charging System Status is unfortunately not supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Failed, Charging Connection Status is unfortunately not supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Failed, Estimated Charging Finish Time is unfortunately not supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Odometer is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Last Data Update is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Active schedules is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Window Front Left is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Window Front Right is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Window Rear Left is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Window Rear Right is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Door Front Left is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Door Front Right is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Door Rear Left is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Door Rear Right is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Tailgate is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Engine Hood is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Tank Lid is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Sunroof is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Air Conditioning is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Lock state is supported by your vehicle.
Sep 10 00:16:38 volvo2mqtt [33100] - INFO: Success! Force Update Data is supported by your vehicle.
Sep 10 00:16:39 volvo2mqtt [33100] - ERROR: API Call failed. Status Code: 404. Error: {
  "status" : 404,
  "operationId" : "61ee1a9d-6955-4b90-a1ff-2e35b88e7475",
  "error" : {
    "message" : "NOT_FOUND",
    "description" : "VIN not found"
  }
}
Sep 10 00:16:39 volvo2mqtt [33100] - INFO: Failed, Location is unfortunately not supported by your vehicle.
Sep 10 00:16:39 volvo2mqtt [33100] - INFO: Success! Tire Front Left is supported by your vehicle.
Sep 10 00:16:39 volvo2mqtt [33100] - INFO: Success! Tire Front Right is supported by your vehicle.
Sep 10 00:16:39 volvo2mqtt [33100] - INFO: Success! Tire Rear Left is supported by your vehicle.
Sep 10 00:16:39 volvo2mqtt [33100] - INFO: Success! Tire Rear Right is supported by your vehicle.
Sep 10 00:16:39 volvo2mqtt [33100] - INFO: Success! Engine State is supported by your vehicle.
Sep 10 00:16:40 volvo2mqtt [33100] - INFO: Failed, Fuel Level is unfortunately not supported by your vehicle.
Sep 10 00:16:40 volvo2mqtt [33100] - INFO: Failed, Average Fuel Consumption is unfortunately not supported by your vehicle.
Sep 10 00:16:40 volvo2mqtt [33100] - INFO: Failed, Distance to Empty is unfortunately not supported by your vehicle.
Sep 10 00:16:40 volvo2mqtt [33100] - INFO: Success! Average Speed is supported by your vehicle.
Sep 10 00:16:40 volvo2mqtt [33100] - INFO: Success! Hours to Service is supported by your vehicle.
Sep 10 00:16:40 volvo2mqtt [33100] - INFO: Success! Distance to Service is supported by your vehicle.
Sep 10 00:16:41 volvo2mqtt [33100] - INFO: Success! Months to Service is supported by your vehicle.
Sep 10 00:16:41 volvo2mqtt [33100] - INFO: Success! Service warning status is supported by your vehicle.
Sep 10 00:16:41 volvo2mqtt [33100] - INFO: Success! Service warning trigger is supported by your vehicle.
Sep 10 00:16:44 volvo2mqtt [33100] - INFO: Sending mqtt update...
Sep 10 00:16:47 volvo2mqtt [33100] - INFO: Mqtt update done. Next run in 300 seconds.
Sep 10 00:21:47 volvo2mqtt [33100] - INFO: Sending mqtt update...

Last reply from me tonight. Systemd is now running the run.sh with some modifications.

Had to edit util.py which had a hardcoded (cause meant to be running in a container) log path to /addons/…

Now logging in my preferred folder and systemd is keeping it going.

I’m not sure what I’m doing wrong but I can’t get this add on installed.

I receive the following reply when I added the repository and click on install.

De installatie van de add-on is mislukt

The command ‘/bin/ash -o pipefail -c pip install -r requirements.txt’ returned a non-zero code: 1

thanks missed that, it fixed it

High fives and cheers all the way = )

Can anyone help me create an unraid template to install this in docker?

Thanks for a great integration here. I wanted to share the dashboard i have setup for this one.

8 Likes

is it just me that goes wrong?

No, I got this as well as do a number of people on another forum. Volvo App is still working though.

This was an volvo api issue. Restart your addon and everything works again.

I just picked up my new 2024 C40, and was very glad I found this add-on. Upon setting it up, and while most entities shows up (doors, hood, battery charge, even location) there are some missing that I would expect to be there. Looking in the add-on log, it says:

Sep 28 07:35:53 volvo2mqtt [105] - INFO: Failed, Electric Range is unfortunately not supported by your vehicle.
Sep 28 07:35:53 volvo2mqtt [105] - INFO: Failed, Estimated Charging Time is unfortunately not supported by your vehicle.
Sep 28 07:35:53 volvo2mqtt [105] - INFO: Failed, Charging System Status is unfortunately not supported by your vehicle.
Sep 28 07:35:53 volvo2mqtt [105] - INFO: Failed, Charging Connection Status is unfortunately not supported by your vehicle.
Sep 28 07:35:53 volvo2mqtt [105] - INFO: Failed, Estimated Charging Finish Time is unfortunately not supported by your vehicle.

I’ve seen others in this thread having those entities on their C40s. Was there something you had to do to get them working? My car has the 2.11 software installed.

I’m in Sweden with a Swedish car.

EDIT: Playing around with the Energy API on Volvo’s developer site, I can’t get any results from any of the endpoints. All of them has empty data;

{
  "status": 200,
  "operationId": "696c53c3-d7a3-4ff4-a27b-bc80fb2b9b16",
  "data": {}
}

I get lots of useful data from the Connected Vehicle API, so that seems to work fine.

I noticed that when launching the volvo2mqtt add-on, looking up Battery Charge Level always fails and then it succeeds right afterwards.

Sep 28 13:37:56 volvo2mqtt [106] - INFO: Failed, Battery Charge Level is unfortunately not supported by your vehicle.
Sep 28 13:37:56 volvo2mqtt [106] - INFO: Success! Battery Charge Level is supported by your vehicle.

But when I try looking up the battery charge level with the Energy API, I always get empty data back. How does that work?

The energy API seems to be unsuported by your car. There is nothing I can do for your at this time.

We try to get the battery charge level from the energy api. If this fails, there is a fallback to the connected vehicle API.

Dear nmcrae85,

That looks great - would you mind sharing the YAML file?

Warm regards
baybod

Just a greeting from a new XC40 BEV MY24 owner. I invested around 3k API call today and have fun to test out.

I understand it is current limitation for the following entities
INFO: Failed, Electric Range is unfortunately not supported by your vehicle.
INFO: Failed, Estimated Charging Time is unfortunately not supported by your vehicle.
INFO: Failed, Charging System Status is unfortunately not supported by your vehicle.
INFO: Failed, Charging Connection Status is unfortunately not supported by your vehicle.
INFO: Failed, Estimated Charging Finish Time is unfortunately not supported by your vehicle.

Looking forward to have “full support” soon! :slight_smile:

Same result here with an XC40 BEV that was delivered yesterday. Although the API specifications states that the energy API is available for the XC40 BEV in Europe, it gives only empty results.
@Dielee Thanks for this HA integration, works like a charm. I did not use Docker or ADDON as I have a core installation just like @SquirePug, but it is really quite easy to set up in a venv environment.
I could not get the location at first, but after checking all the privacy boxes in the car and in the Volvo ID portal it worked OK. Now I will have to reset one after another while checking that location still works. Also I will try to protect the Lock a bit more. I’m not sure whether it is a good idea that anybody with access to my Home Assistant GUI can lock/unlock my car.

1 Like

Good to hear that about the privacy boxes. Please share that result. :slight_smile:

Unfortunately, I get an issue when trying to install on HA OS (on raspi 4) via HA Add-On
The command '/bin/ash -o pipefail -c apk add --no-cache python3 bash py3-pip' returned a non-zero code: 2
which shows a bit more info in supervisor protocols:

23-10-11 23:28:52 ERROR (MainThread) [supervisor.docker.addon] Build log: 
Step 1/15 : ARG BUILD_FROM
Step 2/15 : FROM $BUILD_FROM
 ---> d3302f0a6b33
Step 3/15 : RUN apk add --no-cache python3 bash py3-pip
 ---> Running in 30b5c33652fb
fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/aarch64/APKINDEX.tar.gz
WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.18/main: temporary error (try again later)

WARNING: fetching https://dl-cdn.alpinelinux.org/alpine/v3.18/community: temporary error (try again later)

ERROR: unable to select packages:
  py3-pip (no such package):
    required by: world[py3-pip]
  python3 (no such package):
    required by: world[python3]

So, seems to fail during build… any ideas how to fix it?