Volvo2Mqtt: Connect your AAOS Volvo 🚙

It does seem to be an issue on the Volvo API side. I use this great (thank you for this integration!) integration besides a Node-RED API call automation. They both receive the same data. Besides that I still do see different values for battery state in the Volvo app, but different from the actual SoC of our car (XC40 Recharge 2023 model). So none of the sources was showing correct yesterday.
Today it seems to be working again.

Is there anyway of installing this on a containerised Home Assistant that doesn’t support Add-Ons?

Hi, I’m looking to build some logic in to NodeRed so that I can run commands to lock/unlock the car and turn pre-conditioning on without having HA running.

At the moment I can connect to the car and run everything through HA but wanted to know what MQTT topics and payloads I should be sending so that I can trigger Volvo2Mqtt to lock/unlock the car directly from NodeRed without having to go via HA.

Apologies for posting about how not to use HA in this scenario but does anyone know if this is possible and if so, what the MQTT topics and payloads are please?

Thanks.

Hi everyone,

I have HA Supervisor with Debian 12 and encountering below error:

“s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
curl: (7) Failed to connect to supervisor port 80 after 1 ms: Couldn’t connect to server
[22:04:04] ERROR: Something went wrong contacting the API
Nov 02 22:04:06 volvo2mqtt [103] - INFO: Starting volvo2mqtt version v1.8.8
Traceback (most recent call last):
File “/volvoAAOS2mqtt/main.py”, line 14, in
connect()
File “/volvoAAOS2mqtt/mqtt.py”, line 39, in connect
client.connect(settings[“mqtt”][“broker”], port)
File “/usr/lib/python3.11/site-packages/paho/mqtt/client.py”, line 914, in connect
return self.reconnect()
^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/site-packages/paho/mqtt/client.py”, line 1044, in reconnect
sock = self._create_socket_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/site-packages/paho/mqtt/client.py”, line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/socket.py”, line 851, in create_connection
raise exceptions[0]
File “/usr/lib/python3.11/socket.py”, line 831, in create_connection
sock = socket(af, socktype, proto)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/socket.py”, line 232, in init
_socket.socket.init(self, family, type, proto, fileno)
PermissionError: [Errno 13] Permission denied
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped”

If I am using
mqtt:
broker: auto_broker
port: auto_port
username: auto_user
password: auto_password

“s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
curl: (7) Failed to connect to supervisor port 80 after 0 ms: Couldn’t connect to server
[22:10:08] ERROR: Something went wrong contacting the API
Nov 02 22:10:10 volvo2mqtt [102] - INFO: Starting volvo2mqtt version v1.8.8
Traceback (most recent call last):
File “/volvoAAOS2mqtt/main.py”, line 13, in
set_mqtt_settings()
File “/volvoAAOS2mqtt/util.py”, line 134, in set_mqtt_settings
raise Exception(“MQTT connection could not be established. Please check if your MQTT Add-On is running!”)
Exception: MQTT connection could not be established. Please check if your MQTT Add-On is running!
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped”

Solved by editing apparmor.txt

Hi all,

I’m having problems starting the integration. I have started the docker container with the right conf for Mosquitto and the VCC-API-KEYS I just created but the logs show the following: ‘message": “Access denied due to invalid VCC-API-KEY. Make sure to provide a valid key for an active application.”’
I’ve regenerated the two keys and passed them to docker as in the example, but I keep on getting the same message. Do you need to publish the application for the API keys to work? So far I just create an App and generated the two API keys, but I did not publish the application. I assume I must be doing something wrong with my devel API conf.
Any hints?
Thanks!

UPDATE: Even though I keep on seeing that message in the docker logs it turns out that Home Assistant does receive all the sensors data via Mosquitto, so everything seems to be working.
/Nacho

Just wanted to check if others are seeing their Battery Level no longer returning data. Started just today.

Nov 07 15:48:37 volvo2mqtt [106] - INFO: Failed, Battery Charge Level is unfortunately not supported by your vehicle.

Worked for months. XC90 2024 Recharge Ultimate.

After a restart of volvo2mqtt I also lost battery level, but also some other sensors like windows, doors. Some are still working.

Engine status is not working, now again.

Volvo C40 MY24 here. Battery charge level is not working any more. Energy API has never returned any values for me, and the volvo2mqtt add-on tries polling the OpenAPI (Connected Vehicle API) as well as a fall back. Now that doesn’t work either.

If I manually go to the Volvo Developer portal Overview – Connected Vehicle API – APIs | Volvo Cars Developer Portal and try the Get Battery Charge Level endpoint on the v1 API, it get a correct response. Unfortunately, I’m not skilled enough to grab that into Home Assistant, so now my EV has most of its entities in Home Assistant apart from one of the most important one; battery charge.

Please update to version v1.8.11. It will fix the API changes by Volvo and moves the battery charging endpoint back to V1.

Could you, please, update apparmour.txt to enable Debian 12 and HA connection?

Capabilities

capability,
file,
signal (send) set=(kill,term,int,hup,cont),
network,

Thanks

Would you please format this config right ? I’m unsure what have to be insite the apparmor.txt at this time.

At this moment it is only:

“file,
signal (send) set=(kill,term,int,hup,cont),”

WIth this configuration in Debian there is a api error to connect to the supervisor port:

“curl: (7) Failed to connect to supervisor port 80 after 0 ms: Couldn’t connect to server
[22:10:08] ERROR: Something went wrong contacting the API”

I know what it is at this time


So please send your working config in a formated format.

#include <tunables/global>

profile 982ee2c4_volvo2mqtt flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>

# Capabilities
 capability,
 file,
 signal (send) set=(kill,term,int,hup,cont),
 network,


# Receive signals from S6-Overlay
signal (receive) peer=*_ADDON_SLUG,

# Access to options.json and other files within your addon
/data/** rw,

# Access to mapped volumes specified in config.json
/share/** rw,

# Access required for service functionality
/usr/bin/myprogram r,
/bin/bash rix,
/bin/echo ix,
/etc/passwd r,
/dev/tty rw,

# Allow outbound MQTT communication
network tcp,
network inet stream,
network inet dgram,
network inet6 stream,
network inet6 dgram,

# Add any additional MQTT-related rules if needed
# For example, if you're using the paho-mqtt library
/usr/bin/python3 cx -> paho.mqtt,
/usr/lib/python3.11/site-packages/paho/mqtt/** r,

This is incomplete
 Please pm me.

Hello! That’s just beautiful. Would you please share your yaml? I cannot wait to use it with my car
 :wink:

Thank you in advance!

I have the same issue with “non valid API-key”. Some of the sensors are found by HA, however, they do not receive any values (status Unknown).

I’m having troubles with the VCC API Key. I’ve tried creating three apps, copying the Primary Key into the config, and I always get the same error message:

Access denied due to invalid VCC-API-KEY. Make sure to provide a valid key for an active application.

I’ve tried the VCC API Key in the example “list VINs” curl example on the API site (with the demo/dummy vehicle), and I get the same error message, so it’s not a Volvo2Mqtt issue per se.

I’m only asking here as you’ve all gotten this to work and I thought I’d ask to help me figure out where my VCC API access is going wrong.

If there are any gotchas newbies miss on getting the API to respond to basic requests, I’d love to hear it. I must be doing something wrong, but I don’t know what!

Like, is there a delay between establishing a Volvo API account and it working?

Volvo site says under my app

Status: Only for testing
Requests today: 0 out of 10 000

I’m in Australia if that means anything.

Thanks!

Sean