Volvo2Mqtt: Connect your AAOS Volvo 🚙

Hah! I’m a software developer myself with a good two decades of experience. I would have done a lot differently from how they did it.

I used to have a Mazda MX-30, and what I described was exactly what they did. Every time I requested the car status, they actively fetched it from the car, waking it up. Next day, the 12v battery was completely done for. I’m not sure if Volvo has been smarter about this. However, the behavior of the car indicates they weren’t. I experienced some very strange and unsettling behavior by the car yesterday morning that could have easily been caused by a drained 12v battery.

Well, we seem to be on the same page regarding how this should be done, let’s hope Volvo does the same :slight_smile:.
Regarding your issue, I think the battery would be the problem, there are a lot of reported cases of battery issues with the newer Volvos (> MY2021) so I wouldn’t be surprised if your dealer will either update the software or replace your battery.

Yeah, I’ll be trying to get an appointment with my car dealer to get this sorted out later today. Keep your fingers crossed that it will help! Otherwise my trust in this car will be more than just a little bit disturbed. I cannot rely on a car that occasionally just refuses to run with no way for me or even my dealer to fix it because it is a software issue and “Volvo is working to fix the problem” (has been for ages). Because I know what that means in older companies that keep running so secretively. They all could take a page from Tesla’s book. Say what you will about the cars’ hardware, but at least the software seems to be pretty good.

I work with Volvo cars and we have looked at the traffic when you do a “forced data” and there are no traffic going to the car. Only to the cloud.
If you make a lock/unlock command, of course communication goes to the car.

1 Like

I am seeing @thewindev has more sensors than my vehicle such as the charging_system_status. Why is this? I have an XC90 2023 and using the latest version

The Volvo Energy API is enabled only in EMEA (Europe, Middle East, Africa), so if you’re in the North America or Asia/Pacific regions, you’re out of luck. At least until Volvo gets its act together!

I have a C40 fully electric in North America, and the only energy-related sensor I have is the battery’s state of charge in percent.

2 Likes

Yup that checks out! Thanks

Going to share my dashboard too that was inspired by @thewindev but more minimalist approach

image

Dependencies:

Some elements only show up when a state is detected, i.e. you only get yellow triangle when your car needs service

device_tracker.tina_car_tracker is a BLE beacon that tracks the car. Might be able to swap this with a location binary_sensor, if you get that metric, to determine if car is Home

sensor.cph50_charging_status and sensor.cph50_charging_cable is my Level 2 Charging Station at home. I dont get electric metrics on my Volvo since I’m in North America, so I use Chargepoint integration instead

Stylizing picture-elements cards are tricky, this helped a lot: Styling elements in Picture elements card: a small tutorial - #15 by Ildar_Gabdullin

- type: 'custom:vertical-stack-in-card'  
          cards: 
          - type: picture-elements
            entity: binary_sensor.volvo_yv4h600n7p1955232_engine_state
            state_filter:
              - Not Running: grayscale(100%)
            image: /local/img/volvo_exterior.png
            style: |
              ha-card {
                {% if not is_state('sensor.volvo_yv4h600n7p1955232_service_warning_status', 'NORMAL') %}
                --service-warning-visible: block;
                {% else %}
                --service-warning-visible: none;
                {% endif %}
                {% if not is_state('device_tracker.tina_car_tracker', 'home') %}
                --home-visible: none;
                {% else %}
                --home-visible: block;
                {% endif %}
                {% if is_state('device_tracker.tina_car_tracker', 'home') %}
                --home-off-visible: none;
                {% else %}
                --home-off-visible: block;
                {% endif %}
              }
            elements:
              - type: state-icon
                entity: switch.volvo_yv4h600n7p1955232_climate_status
                style:
                  top: 52%
                  left: 22%
                  transform: scale(2.0,2.0)
                  filter: drop-shadow(1px 1px 1px black)
                  color: black
              - type: state-icon
                entity: lock.volvo_yv4h600n7p1955232_lock_status
                style:
                  top: 52%
                  left: 47%
                  transform: scale(2.0,2.0)
                  filter: drop-shadow(1px 1px 1px black)
              - type: state-icon
                entity: binary_sensor.volvo_yv4h600n7p1955232_engine_state
                style:
                  top: 52%
                  left: 72%
                  transform: scale(2.0,2.0)
                  filter: drop-shadow(1px 1px 1px black)
                  color: gray              
              - type: state-label
                entity: sensor.volvo_yv4h600n7p1955232_distance_to_empty
                prefix: 'Range:  '
                style:
                  top: 8%
                  left: 75%
                  color: white
                  filter: drop-shadow(1px 1px 1px black)
              - type: state-icon
                entity: sensor.volvo_yv4h600n7p1955232_service_warning_status
                style:
                  top: 5%
                  left: 3%
                  transform: scale(2.0,2.0)
                  filter: drop-shadow(1px 1px 1px black)
                  '--paper-item-icon-color': orange
                  display: var(--service-warning-visible)
              - type: icon
                icon: mdi:home
                style:
                  top: 5%
                  left: 90%
                  transform: scale(1.5,1.5)
                  color: rgba(var(--color-blue),1)
                  display: var(--home-visible)
                  opacity: 80%
              - type: icon
                icon: mdi:home-off
                style:
                  top: 5%
                  left: 90%
                  transform: scale(1.5,1.5)
                  color: rgba(var(--color-red),1)
                  display: var(--home-off-visible)
                  opacity: 80%
          - type: 'custom:bar-card'
            entity: sensor.volvo_yv4h600n7p1955232_battery_charge_level
            icon: mdi:battery-high
            positions:
              name: 'off'
              icon: inside
            severity:
              - color: Red
                from: 0
                to: 25
              - color: Orange
                from: 26
                to: 50
              - color: Yellow
                from: 51
                to: 75
              - color: Green
                from: 76
                to: 100
            style: |-
              #states {
                padding-top: 0px;
                padding-right: 0px;
                padding-left: 0px;
                padding-bottom: 1px;
              }
              bar-card-value {
                font-weight: bold;
                text-shadow: 1px 1px #0005;
                font-size: 13px;
              }
              bar-card-currentbar {
                border-radius: 0px;
              }
              bar-card-backgroundbar {
                border-radius: 0px;
              }
          - type: 'custom:vertical-stack-in-card'   
            horizontal: true
            cards: 
              - type: 'custom:button-card'
                template: chip_icon_label
                entity: sensor.cph50_charging_cable
                label: '[[[ return entity.state ]]]'
                state:
                  - operator: template
                    value: >
                      [[[ 
                        return entity.state != "Plugged In" && states['device_tracker.tina_car_tracker'].state == "home"
                      ]]]
                    styles:
                      icon:
                        - animation: blink 5s ease infinite 
                        - color: "rgba(var(--color-red),1)"
                      label:
                        - color: "rgba(var(--color-red),1)"
              - type: 'custom:button-card'
                template: chip_icon_label
                entity: sensor.cph50_charging_status
                label: >
                  [[[ 
                    return entity.state + ' - ' + states['sensor.cph50_power_output'].state + 'kW'
                  ]]]
                state:
                  - operator: template
                    value: '[[[ return entity.state == "Charging" ]]]'
                    styles:
                      icon:
                        - animation: blink 5s ease infinite 
                        - color: "rgba(var(--color-green),1)"
                      label:
                        - color: "rgba(var(--color-green),1)"
                  - operator: template
                    value: '[[[ return entity.state != "Charging" ]]]'
                    styles:
                      card:
                        - display: none
              - type: 'custom:button-card'
                template: chip_icon_label
                icon: mdi:car-door
                entity: group.volvo_doors
                label: >
                  [[[ 
                    if (entity.state == "on")
                      return "Doors Open"
                    return "Doors Closed"
                  ]]]
                state:
                  - value: "on"
                    styles:
                      icon:
                        - animation: blink 10s ease infinite 
                        - color: "rgba(var(--color-red),1)"
                      label:
                        - color: "rgba(var(--color-red),1)"
              - type: 'custom:button-card'
                template: chip_icon_label
                icon: mdi:window-closed-variant
                entity: group.volvo_windows
                label: >
                  [[[ 
                    if (entity.state == "on")
                      return "Windows Open"
                    return "Windows Closed"
                  ]]]
                state:
                  - value: "on"
                    icon: mdi:window-open-variant
                    styles:
                      icon:
                        - animation: blink 10s ease infinite 
                        - color: "rgba(var(--color-red),1)"
                      label:
                        - color: "rgba(var(--color-red),1)"

Hope this gets some creative juices flowing!

4 Likes

Updated today (1.8.1) and addon fails to load -

Failed to save add-on configuration, Invalid list for option ‘vccapikey’ in Volvo2Mqtt (982ee2c4_volvo2mqtt). Got {‘updateInterval’: 300, ‘babelLocale’: ‘en_US’, ‘TZ’: ‘America/Chicago’, ‘debug’: False, ‘mqtt’: {‘broker’: ‘auto_broker’, ‘port’: ‘auto_port’, ‘username’: ‘auto_user’, ‘password’: ‘auto_password’}, ‘volvoData’: {‘username’: ‘@gmail.com’, ‘password’: '’, ‘vin’: ‘’, ‘vccapikey’: ‘*******************************’, ‘odometerMultiplier’: 1, ‘averageSpeedDivider’: 1, ‘averageFuelConsumptionMultiplier’: 1}}

Verified key is correct. Any ideas?

Did you redact you vin or is there a typo in your config?

Edit: Look at releases for version 1.8.0. It’s now a list

Yes, redacted for that post.

@Dielee I suggest capping the number of api keys to prevent abuse in v1.8.X, or maybe capping the interval?

1 Like

Well, was the change you mentioned in 1.8.0. Though I was pretty sure I had already updated to that version without having to change the config. Thanks.

Same thing with mine. Latest update has killed it, rolling back now to see if it fixes it.

Yep, rolling back to 1.7.10 fixed it for me.

Jep, the intervall is already capped. I will cap the max amount of API keys to three.

Please read the changelog. vccapikey is now a list, as @Maxcodesthings said.

Sorry Linus!
I only saw the v1.8.1 changelog and not v1.8.0.

Working now with the new vccapikey format. Cheers

1 Like

I added some more info for the v1.8.1 release!

Seems like my door/window sensors are not working anymore and don’t update…

Can someone tell me what I’m doing wrong? The Volvo ID and password are fine. Does the vccAPI Key still have to be published somewhere?

Thanks