Volvo2Mqtt: Connect your AAOS Volvo 🚙

That’s a big disappointment, Volvo. I’m hoping this is only a matter of “we accidentally enabled this for the US before we intended to do so, but we’re going to officially roll it out soon.”

Volvo, if you read this: having access to information about my car through a smart home integration of my choice significantly improved my satisfaction with my XC90 PHEV. For example, it made our lives great to have nightly reminders to charge the vehicle when we and the vehicle were at home, and the charge was below a certain amount. Or, to set maintenance reminders to retorque our snow wheels by monitoring the odometer. It’s disappointing to go turn those automations off :frowning:.

1 Like

They’ve always said that for published apps, but have said all regions work for testing/unpublished apps. Maybe they’ve changed the policy, but it’s still stated in the Docs:

Locations

The API can be used with test credentials around the world. However, when published, only cars in the Europe / Middle East / Africa regions are available. We are working to bring other regions online.

2 Likes

Hi,

Today i noticed a strange thing in the volvo app, it gives a message that the car is in use and therefore it can’t give an update on location and battery level.

I can tell, the car is locked and parked as always. App and car are on latested software 5.33.0 and 2.12

Anyone have experienced this before?
Was wondering if this is related due to volvo developer account?

The Volvo App is still working as expected here in Aus, so the App’s performance wouldn’t seem to be related to the API issues I’m still experiencing.

Given it’s happening on the Developer website as well, it’s not HA or Volvo2Mqtt issue, either, but here is the only place I know with a community of API users :slight_smile:

I have e–mailed their support address on the site.

It solved it self, so to say. I checked the logs of the various Volvo sensors and noticed that the engine sensor had reported it was on, while the car was parked. The sensor reports now not active state and the app works normal. So that must be it but why the sensor reported active suddenly is a mystery.

1 Like

I was hoping to get this more refined before sharing, but since I’m in the US and Volvo shut off our API access, I can’t get it better, but I thought someone else might like it.

I was using the volvo2mqtt in conjunction with the wallbox evse to control the rate of charging my 2022 C40. I could set a departure time and a target charge level and it would adjust the amps provided by the wallbox to get the C40 to my target charge just as I wanted to leave. This would help make my batteries nice and warm. I also had it crank up the amps if I turned on the climate controls. It’s my first shot at a complicated automation so I know it is ruff. I’m also new to posting things here so if there’s a better place for something like this, let me know.

alias: c40 Above Target Charge
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.wallbox_portal_status_description_2
    from: null
    id: wallbox_state
  - platform: state
    entity_id:
      - sensor.volvo_??????_battery_charge_level
    id: c40_battery_level_change
  - platform: state
    entity_id:
      - input_number.c40_target_charge
    id: c40_target_charge_change
  - platform: device
    device_id: ??????
    domain: device_tracker
    entity_id: ????
    type: leaves
    zone: zone.home
    id: c40 left home
  - platform: device
    device_id: ????
    domain: device_tracker
    entity_id: ???????
    type: enters
    zone: zone.home
    id: c40 arrives home
  - platform: device
    type: turned_on
    device_id: ?????
    entity_id: ??????
    domain: switch
    id: c40_ac_on
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - wallbox_state
          - condition: state
            entity_id: sensor.wallbox_portal_status_description_2
            state: Ready
        sequence:
          - device_id: ????
            domain: number
            entity_id: ???
            type: set_value
            value: 48
          - type: turn_on
            device_id: ???
            entity_id: ????
            domain: switch
      - conditions:
          - condition: or
            conditions:
              - condition: trigger
                id:
                  - c40_battery_level_change
              - condition: trigger
                id:
                  - c40_target_charge_change
          - condition: device
            device_id: ?????
            domain: device_tracker
            entity_id: ????
            type: is_home
          - condition: template
            value_template: >-
              {{ (states('sensor.volvo_??????_battery_charge_level')
              | float ) >= ( states('input_number.c40_target_charge') | float )
              }}
          - condition: numeric_state
            entity_id: sensor.volvo_??????_battery_charge_level
            above: input_number.c40_target_charge
            enabled: false
          - condition: state
            entity_id: sensor.wallbox_portal_status_description_2
            state: Charging
            enabled: false
        sequence:
          - type: turn_off
            device_id: ?????
            entity_id: ?????
            domain: switch
      - conditions:
          - condition: or
            conditions:
              - condition: trigger
                id:
                  - c40_battery_level_change
              - condition: trigger
                id:
                  - c40_target_charge_change
          - condition: device
            device_id: ?????
            domain: device_tracker
            entity_id: ?????
            type: is_home
          - condition: numeric_state
            entity_id: sensor.volvo_?????_battery_charge_level
            below: input_number.c40_target_charge
          - condition: device
            type: is_off
            device_id: ????
            entity_id: ?????
            domain: switch
            enabled: false
        sequence:
          - variables:
              c40_target_amp: >-
                {{ (((75 * (((states('input_number.c40_target_charge')|int) -
                (states('sensor.volvo_??????_battery_charge_level')|int))/100))*1000)
                / ((((as_timestamp(states('input_datetime.c40_departure'))) -
                now().timestamp())/60)/60))/210 }}
          - service: notify.mobile_app_pixel_8_pro
            data:
              message: "{{ c40_target_amp }}"
            enabled: false
          - service: number.set_value
            data:
              value: "{{ c40_target_amp }}"
            target:
              entity_id: number.wallbox_portal_max_charging_current_2
          - type: turn_on
            device_id: ????
            entity_id: ?????
            domain: switch
          - service: input_number.set_value
            data: {}
            target:
              entity_id: input_number.thor_target_amp
            enabled: false
      - conditions:
          - condition: trigger
            id:
              - c40 left China
        sequence:
          - service: input_number.set_value
            data:
              value: 60
            target:
              entity_id: input_number.c40_target_charge
          - device_id: ??????
            domain: number
            entity_id: ????
            type: set_value
            value: 48
          - type: turn_on
            device_id: ???
            entity_id: ????
            domain: switch
      - conditions:
          - condition: trigger
            id:
              - c40 arrives home
        sequence:
          - device_id: ????
            domain: number
            entity_id: ????
            type: set_value
            value: 6
      - conditions:
          - condition: trigger
            id:
              - c40_ac_on
          - condition: device
            device_id: ???
            domain: device_tracker
            entity_id: ????
            type: is_home
        sequence:
          - type: turn_on
            device_id: ????
            entity_id: ????
            domain: switch
          - device_id: ????
            domain: number
            entity_id: ?????
            type: set_value
            value: 48
          - service: input_number.set_value
            data:
              value: 100
            target:
              entity_id: input_number.c40_target_charge
          - service: input_datetime.set_datetime
            data: {}
            target:
              entity_id: input_datetime.c40_departure
trace:
  stored_traces: 20
mode: single
1 Like

Hi,

Awesome add-on! My entities are constantly flapping in HA. The state is available for like 10 seconds and then show unavailable for 30 seconds and that cycle keeps on going. Did any encounter this? What can I do?
image

I see this in the logs:
Dec 11 12:55:12 volvo2mqtt [108] - WARNING: MQTT disconnected, reconnecting automatically
Dec 11 12:56:14 volvo2mqtt [108] - WARNING: MQTT disconnected, reconnecting automatically
Dec 11 12:57:15 volvo2mqtt [108] - WARNING: MQTT disconnected, reconnecting automatically
Dec 11 12:58:16 volvo2mqtt [108] - WARNING: MQTT disconnected, reconnecting automatically
Dec 11 12:59:17 volvo2mqtt [108] - WARNING: MQTT disconnected, reconnecting automatically

And this in my mqtt logs:
702296794: New connection from 172.17.0.1:46832 on port 1883.
1702296794: New client connected from 172.17.0.1:46832 as volvoAAOS2mqtt (p2, c1, k60).
1702296809: Client volvoAAOS2mqtt closed its connection.
1702296855: New connection from 172.17.0.1:46930 on port 1883.
1702296855: New client connected from 172.17.0.1:46930 as volvoAAOS2mqtt (p2, c1, k60).
1702296870: Client volvoAAOS2mqtt closed its connection.
1702296916: New connection from 172.17.0.1:47008 on port 1883.
1702296916: New client connected from 172.17.0.1:47008 as volvoAAOS2mqtt (p2, c1, k60).
1702296931: Client volvoAAOS2mqtt closed its connection.

I am getting this message in the log:

“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
Dec 16 13:50:58 volvo2mqtt [106] - INFO: Starting volvo2mqtt version v1.8.21
Dec 16 13:50:58 volvo2mqtt [106] - WARNING: VCCAPIKEY ****************** isn’t working! Access denied due to invalid VCC-API-KEY. Make sure to provide a valid key for an active application.
Dec 16 13:50:58 volvo2mqtt [106] - WARNING: No working VCCAPIKEY found, waiting 10 minutes. Then trying again!”

I am pretty sure i have the right key. I have only entered the primary key, not the secondary

Is the problem perhaps that i did not publish the app i made on the Volvo site?

Using MQTT add on
Located in the Netherlands

Same VCC-API-KEY issue here in Finland. Installed the add-on today, made a VCC API account and generated my API App (showing “Only for testing”), using Primary key for the AddOn but with error.

I think that there could be few lines more about the API creation in the README to clarify the pricess. Example is it needed to publish the App, which of the two key to use etc…

Hope to get this working as the legacy VolvoOnCall was not working as I swapped my old Volvo SensusOS car to a new with AAOS.

It take some time until the key is ready to use.
The primary key is correct, there is no need to publish your app.

1 Like

Thank you for your response. I will wait a couple of days.

The message in the Volvo2MQTT log has changed. It now reads:

“Dec 20 18:27:57 volvo2mqtt [106] - INFO: Mqtt update done. Next run in 300 seconds.
Dec 20 18:32:57 volvo2mqtt [106] - INFO: Sending mqtt update…
Dec 20 18:32:57 volvo2mqtt [106] - INFO: Mqtt update done. Next run in 300 seconds.
Dec 20 18:37:57 volvo2mqtt [106] - INFO: Sending mqtt update…
Dec 20 18:37:58 volvo2mqtt [106] - INFO: Mqtt update done. Next run in 300 seconds.”

So, it looks like its working but i can’t find any Volvo related entities?

Look at that, so it has. I restarted the app, and now I am hetting A LOT of emtities frim my car. It just toom like 2 days to start working.

So restart the app.

EDIT: Problem solved! I am using the MQTT add-on but i forgot to tell the MQTT INTEGRATION to connect to the add on. It all works perfectly now.

I have a 2023 XC40 full electric

Solved Problem:
I restarted the Volvo2mqtt app and in the log i see a lot of messages like: success! Window front left is supported!

But when i look for an entity “binary_sensor.volvo” for example, nothing is found…

I am running HA on Virtual Machine, could this be the problem?

Can somebody help me with my issue from a few days ago?

I have it working by just following the instructions of the docker setup, and then you can get the data via the MQTT integration in HA. I have a Mosquitto MQTT broker running in a separate container for which I added the (login) data.

Maybe my question is a bit off-topic but I using the MQTT integration in HA with pleasure, thanks for the good work to make this possible.
Now I want to sent my volvo car data to ABRP route planner. I have issues with google maps now and then while ABRP is very convient to use.
I don’t now if the service to sent the car data to ABRP can be implemented into the Volvo2Mqtt. Otherwise it would be sufficient to me to program it as a service and use a automation to sent it every 10sec. So far this works from a browser:

https://api.iternio.com/1/tlm/send?api_key=****&token=*******0&tlm={“utc”:1553807658,“soc”:90.4,“soh”:97.7,“speed”:0,“lat”:29.564,“lon”:-95.025,“elevation”:50,“is_charging”:0,“power”:13.2,“ext_temp”:25,“batt_temp”:25,“car_model”:" volvo:xc40:20:75",“current”:36.66,“voltage”:360}’

Any help to program this automation in HA would be very helpful.

Thanks, I created a docker application in the end, just in case it’s of use to anyone else.

version: '3'

services:
    volvo2mqtt:
        image: ghcr.io/dielee/volvo2mqtt:1.8.22
        network_mode: host
        environment:
            - CONF_updateInterval=900
            - CONF_babelLocale=en_GB
            - 'CONF_mqtt=@json { "broker": "192.168.x.x", 
                "username": "user", 
                "password": "password",
                "port": 1883}'
            - 'CONF_volvoData=@json {"username": "[email protected]", 
                "password": "secret", 
                "vccapikey": ["myapikey", 
                                "anotherapikey"], 
                "odometerMultiplier": 1,
                "averageSpeedDivider": 1,
                "vin": "VIN",
                "averageFuelConsumptionMultiplier": 10}'
            - CONF_debug=false
            - TZ=Europe/London
1 Like

I didn´t get it - how can i link my VIN with the Volvo Developer Account?
I´m using my private email address for Volvo App Login and Google Auth for Dev portal.

Just use the rest_command for this link