Volvo Cars integration

I’ve developed a custom integration for Volvo Cars! The supported models are limited to those compatible with the Volvo API.

Why?

The core integration does not work for my car (XC40 BEV 2024). From what I can tell based on the docs, my integration also has more entities (like charging connection, lock with reduced guard, separate light status entities and other diagnostics).

I’m also planning to include more features in upcoming releases, like smart data refresh interval (so certain sensor will update faster when necessary).

What’s included?

  • Support for multiple cars
  • Support for multiple accounts
  • Translations (currently only EN, so I might need some help on this :pray:)
  • Around 70 entities, including:
    • Binary sensors (diagnostics, doors, windows, engine, lights, tyres)
    • Sensors (energy/fuel consumption, distance to empty battery/tank, battery/fuel level, charging info, avg. speed, service info, odometer, trip meters)
    • Locks (lock/unlock, reduced guard mode)
    • Buttons (start/stop climatization, honk, flash)
    • Location (device tracking, including heading direction)
    • Images (interior, exterior)

For more details on features and installation, check out the repository! Feel free to create an issue, whether you’ve found a bug or have a feature request.

Current version

GitHub release (with filter)

Install

Add to your HACS

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Install integration

Open your Home Assistant instance and start setting up a new integration.

Repository

3 Likes

You might want to outline clearly the advantages of your custom component vs the builtin one, imo.

Thanks for the feedback! I’ve updated the opening post to include the reason why I made this custom integration.

Currently I’m using GitHub - Dielee/volvo2mqtt: Home Assistant addon for connecting AAOS Volvos. Apart from 1 being an add-on and relying on MQTT to integrate into HA, what’s the difference?

2 Likes

I was actually using that add-on before. Let me first say that the goal with my integration isn’t to compete, like at all. I just want to offer an alternative.

I didn’t want to make a direct comparison, but since you’ve asked, here are some differences:

  • Like you said: no requirement on MQTT, but also built as an integration, which should be “less demanding” on resources than an add-on (which is a docker container in the end).
  • With my car, I count 44 entities with the volvo2mqtt add-on and 68 with my integration. Some entities also include additional information in the attributes, like reason why something is “a problem” (tyre pressure, levels, command results). All entities of my integration are listed on the repository page.
  • Support for multiple Volvo accounts.
  • Translatable (but requires help from the community)
  • The volvo2mqtt add-on currently offers unit conversion, but that is something that I’m planning to add as well. EDIT: HA handles this automatically. :heart_eyes:

You can run both side by side to see the differences. Just make sure to create an additional API key. And in the end, it all comes down to what you need and your personal preferences.

1 Like

It looks great! Volvo’s dev portal seems to be down atm, so Ive just replaced my Volvo2MQTT entities for now.

Nicely done, a few small requests to make it even better:

  • The formatting for the time to service + hours to service entities, I think the hours are no good to anyone :slight_smile:
  • The MQTT one has a (derived?) sensor for the state of the preheating, I used that for some visualization. Is that not available through the API?

Thanks for your insights!

The API reports time to service in days or months, so I’ve used days as unit value for the sensor. It seems the UI decides to express it in hours. I’ll have a look if that can be influenced somehow. Maybe by changing the device class?

Engine hours to service is reported back in hours by the API. I can convert it to days, but then anything less than 24h will be reported as 0 days. I also don’t know if it goes negative if you wait too long.

Do you mean the switch button? I don’t think that reports back the actual status. If you start preheating via the Volvo app, it won’t toggle the button to “on”. The API doesn’t return that information. That’s why I created buttons to start or stop the preheating.

When switching the button to “on”, volvo2mqtt does automatically stops the preheating after 30 minutes or when a door opens. I haven’t built in this automation, because I believe its up to the car and/or the user to decide what he wants.

1 Like

@jelmer I’ve just published v0.2.0-b1 with your suggested changes. Since it is a beta release, you’ll need to click “Redownload” in HACS and explicitly choose this version.

Both sensors will report the value in days now. Please note that I had to rename Engine hours to service to Engine time to service. You’ll need to remove the old entity manually.

I’m planning to include some other work before releasing the final v0.2.0. No worries if you want to wait for this.

I’ll give it a go!

@thomas_be thanks, somehow your repo was taken down by GitHub, any idea what happened?

Unfortunately, yes, GitHub has restricted access to the repo because something discovered (or someone reported) that a hard coded secret is being used. The same one that all other Volvo projects are using, among others evcc (a big project) and volvo2mqtt, but also elsewhere on the internet.

I’ve reached out to GitHub support with my arguments, and here’s hoping that they will reopen my repository. Now I have no idea how long it takes for them to process support tickets.

I’ll post an update when I receive feedback from GitHub.

1 Like

For when you regain access to the repo: I’ve had some internet outages the last few days, and the integration throws an error and asks to be reconfigured/re-authorized immediately when the internet goes out. Other (cloud) integrations don’t suffer from this.

Good catch, I’ll look into it!

Still haven’t heard back from GitHub support. I’ll give it a few more days before Iooking for an alternative.

2 Likes

It’s been a week now and GitHub still didn’t respond to my ticket. Here’s an extract of the automated mail I received after creating my ticket:

Please note, we are receiving higher volumes of support requests and as a result you may experience longer wait times.

Since the wait time is very vaguely described, I’m wondering what the best approach would be. Should I wait a few days longer, or should I just create a new repository (without the secret in it)?

I’d move to the new repo probably.
That is, if more people face the problem that the integration does not work anymore in 2024.12 :slight_smile:

Yes, indeed, that’s what I will do because it is taking way too long for GitHub to respond.

The new repo will be up this weekend!

And we’re back! :raised_hands:

I have updated the opening post with the new repo URL. Since it is under a new URL, you’ll need to remove the current integration from HACS and HA before installing this one. All entities will have the same ID, except for those mentioned in the breaking changes.

Ping me if you encounter an issue or want something added.

Enjoy it, lads!

1 Like

Hi, i get an error when trying to load the integration:

Error

Config flow could not be loaded: 500 Internal Server Error Server got itself in trouble

Hi!

This should not happen. Could provide some more details?

  1. At which moment exactly do you receive this error?

    • The moment you want to add the integration?
    • After the first step of the setup flow?
    • After the second (OTP) step of the setup flow?
    • Somewhere else?
  2. Can you find the stacktrace that comes with the error? You need to open the log file and look for an ERROR on custom_components.volvo_cars. Below that line you should see a Traceback line. Copy everything from the ERROR line until the next log entry (a line that starts with a date).

  3. Which HA version are you using? You need at least v2024.11.0.