Skip to content

Home Assistant addon for connecting AAOS Volvos

License

Notifications You must be signed in to change notification settings

Dielee/volvo2mqtt

Repository files navigation

Volvo2Mqtt

Supports aarch64 Architecture Supports amd64 Architecture Supports armhf Architecture Supports armv7 Architecture Supports i386 Architecture
Project Maintenance GitHub Release GitHub Activity

This component establishes a connection between the newer AAOS Volvo cars and Home Assistant via MQTT.
Maybe this component works also with other Volvo cars. Please try out the native Volvo integration before using this component! If the native component doesn't work for your car, try this mqtt bridge.

Home Assistant thread can be found here.

Important note: The Volvo api currently ONLY works in these countries

If you like my work:
ko-fi

Confirmed working with

  • EX30 BEV (2024)
  • XC40 BEV (2024)
  • XC40 BEV (2023)
  • XC40 BEV (2022)
  • XC40 PHEV (2021)
  • V60 T8 PHEV (2023)
  • V60 T6 PHEV (2025)
  • C40 BEV (2023)
  • C40 BEV (2022)
  • C40 BEV (2024)
  • XC90 T8 PHEV (2023)
  • XC60 PHEV (2024)
  • XC60 PHEV (2023)
  • XC60 PHEV (2022)
  • XC60 B5 Mildhybrid (2023)
  • XC90 PHEV T8 (2023)
  • XC90 PHEV T8 (2024)
  • XC90 B5 Mildhybrid (2024)
  • V90 PHEV T8 (2019)*
  • V90 PHEV T6 (2024)
  • V90 B5 Mildhybrid (2023)
  • EX40 BEV (2025)

*only partly working

Please let me know if your car works with this addon so I can expand the list!

Supported features

  • Lock/unlock car
  • Start/stop climate
  • Sensor "Battery Charge Level"
  • Sensor "Battery Capacity"
  • Sensor "Electric Range"
  • Sensor "Charging System Status"
  • Sensor "Charging Connection Status"
  • Sensor "Estimated Charging Finish Time"
  • Sensor "Door Lock Status (All doors, tank lid, and engine hood)"
  • Sensor "Window Lock Status (All windows and sunroof - Thanks to @navet)"
  • Sensor "Engine Status"
  • Sensor "Odometer"
  • Sensor "Tire Status"
  • Sensor "Fuel Status"
  • Sensor "Average Fuel Consumption"
  • Sensor "Average Speed"
  • Sensor "Distance to Empty"
  • Sensor "Hours to Service"
  • Sensor "Distance to Service"
  • Sensor "Months to Service"
  • Sensor "Service warning status"
  • Sensor "Service warning trigger"
  • Car Device Tracker
  • Multiple cars

NOTE: Energy status currently available only for cars in the Europe / Middle East / Africa regions. source

OTP Authentication

As of version v1.9.0, this addon uses the same OTP authentication as the Volvo app. The following steps are required for authentication in exactly this order:

  1. Setup volvo2Mqtt, either via Docker, or via HA addon (take a look at the "Setup" section below)

  2. Fill in your settings and start volvo2Mqtt

  3. Your log will show the following lines
    Waiting for otp code... Please check your mailbox and post your otp code to the following mqtt topic "volvoAAOS2mqtt/otp_code". Retry 0/15
    Waiting for otp code... Please check your mailbox and post your otp code to the following mqtt topic "volvoAAOS2mqtt/otp_code". Retry 1/15
    etc ...

  4. Now, open your mailbox and copy your OTP Code

  5. Open HomeAssistant and search for the entity ID text.volvo_otp

  6. Paste your OTP into the text entity and press Enter
    6a. (optional) If your OTP cannot be safed, try to paste your OTP code via MQTT to the following topic: volvoAAOS2mqtt/otp_code

    OTP Post Script

    1. Safe the following script in your script section
    2. Go to https://yourHAUrl/developer-tools/service
    3. Search for "Post Volvo OTP"
    4. Tick "OTP" and fill in your OTP
    5. Run this service

         alias: Post Volvo OTP
         sequence:
           - service: mqtt.publish
             metadata: {}
             data:
               topic: volvoAAOS2mqtt/otp_code
               payload: "{{ otp }}"
         mode: single
         fields:
           otp:
             selector:
               text: null
             name: OTP
             description: Volvo OTP
    
  7. If everything has worked, your addon is now authenticated. In the future, OTP authentication only needs to be done when updating, not when restarting the container.

Setup

Docker:

Just install this addon with the following command. Please note to fill in your settings inside the environment variables.

docker run -d --pull=always -e CONF_updateInterval=300 -e CONF_babelLocale='de' -e CONF_mqtt='@json {"broker": "", "username": "", "password": "", "port": 1883}' -e CONF_volvoData='@json {"username": "", "password": "", "vin": "", "vccapikey": ["key1", "key2"]}' -e TZ='Europe/Berlin' --name volvo2mqtt ghcr.io/dielee/volvo2mqtt:latest

HA Add-On:

Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.

Here is what every option means:

Environment Variable Name Type Json Option Default Description
CONF_updateInterval int required Update intervall in seconds.
CONF_babelLocale string required Select your country from this list. "Locale name" is the column you need!
CONF_mqtt json broker required Your MQTT Broker IP. Eg. 192.168.0.5.
CONF_mqtt json port 1883 Your MQTT Broker Port. If no value is given, port 1883 will be used.
CONF_mqtt json username optional MQTT Username for your broker.
CONF_mqtt json password optional MQTT Password for your broker.
CONF_volvoData json username required Normally your email address to login into the Volvo App.
CONF_volvoData json password required Your password to login into the Volvo App.
CONF_volvoData json vin optional A single VIN like "VIN1" or a list of VINs like "["VIN1", "VIN2"]". Leave this empty if you don't know your VIN. The addon will use every car that is tied to your account.
CONF_volvoData json vccapikey required VCCAPIKEY linked with your volvo developer account. Get your Vccapi key from here. Starting version 1.8.0, it is possible to define multiple keys, like this: ["vccapikey1", "vccapikey2", "vccapikey3", "etc..."]
CONF_debug string optional Debug option (true/false). Normally you don't need this.
TZ string required Container timezone eg "Europe/Berlin" from here