[RELEASE] Volvo Cars Integration (Official API) for Hubitat

[RELEASE] Volvo Cars Integration (Official API) for Hubitat

Hey Hubitat Community,

I'm excited to announce the release of a new integration I've developed: Volvo Cars Integration for Hubitat!

This project allows you to connect your Hubitat Elevation® hub directly to your Volvo car(s) using the official Volvo Cars API.

What does it do?

It brings your Volvo vehicle's status into Hubitat and allows you to send basic remote commands. Think smart home automation based on your car's status or triggering actions from your dashboard!

Key Features Include:

  • Vehicle Status Polling: Get updates on lock status, fuel level, battery/charging status (for EVs/PHEVs), odometer, last location, tire status, service intervals, warning lights, trip stats, and more.
  • Remote Commands: Lock/unlock doors, start/stop engine, start/stop climatization, honk horn, flash lights, and lock with reduced guard (if supported).
  • Multiple Vehicle Support: Manage all cars linked to your Volvo ID.
  • Imperial Unit Conversion: Option for distance and consumption.
  • Configurable Refresh Interval: Control how often data is updated (be mindful of API rate limits!).

Evolution from hubitat-voc

For those familiar with the previous work, this integration represents a significant evolution from the hubitat-voc project. The key difference is that this new integration leverages the official Volvo Cars API, providing a more stable and maintainable connection compared to unofficial methods used previously.

If you are currently using hubitat-voc, I strongly encourage you to migrate to this new version. Please be aware that the setup process is different, as it requires obtaining an official API key.

Important Notes & Requirements (PLEASE READ!):

  • API Key is REQUIRED: You must obtain a VCC API Key from the Volvo Cars Developer Portal. You need one API Key per Volvo ID account you wish to connect. It's free to sign up.
  • Authentication Flow: The setup involves entering your Volvo ID username/password followed by an OTP (One Time Password) sent to your email.
  • API Rate Limits: The Volvo API has limits (typically 10,000 requests per day per API key). Choose your "Vehicle Data Refresh Interval" wisely (e.g., 10-15 minutes or longer) to avoid hitting this limit, especially if you have multiple vehicles or a very short polling interval. The default is 10 minutes.
  • Supported Regions: Check Volvo's documentation for the list of supported countries (developer.volvocars.com/terms-and-conditions/apis-supported-locations/).
  • Hubitat Firmware: Requires 2.2.8 or later.

Installation (Recommended: Hubitat Package Manager)

The easiest way to install is via the Hubitat Package Manager (HPM):

  1. If you don't have HPM, install it from HubitatCommunity/HubitatPackageManager.
  2. In HPM, go to Install a User App.
  3. Click Add User Repository.
  4. Enter this URL: https://raw.githubusercontent.com/brianschmitt/hubitat-volvo-cars/main/packageManifest.json
  5. Click Save.
  6. Go back to the main HPM page and select Install.
  7. Find "Volvo Cars Integration", select it, and proceed through the installation steps.

Manual Installation [GitHub - brianschmitt/hubitat-volvo-cars](See GitHub README for details if not using HPM)

Setup and Configuration:

  1. Install the app and driver via HPM.
  2. Go to Apps -> Add User App and select "Volvo Cars".
  3. Click "Manage Credentials & API Key".
  4. Enter your Volvo ID Username (Email), Password, and the VCC API Key you obtained from the Volvo Developer Portal. Click Next.
  5. Check your email for a 6-digit OTP. Enter it on the next screen in the Hubitat app settings. Click Submit.
  6. If successful, you'll be redirected to the "Main Page", once there select "Manage Vehicles". Select the VIN(s) you want to add and click "Add Vehicle". Be patient, this can take a few seconds per vehicle.
  7. Go back to the main app page to configure the "Vehicle Data Refresh Interval" and other settings.
  8. (Optional) Configure Imperial Measurements or Remote Start Duration on the individual child device page for each car (Devices -> "Volvo XXXX").

Using the Vehicle Device

Once added, you'll find a child device for your car under Devices. On the device page, you can see all the status attributes under "Current States" and send commands under "Commands" (like lock, unlock, startEngine, siren, etc.). These can then be used in Rule Machine, Dashboards, etc., just like any other Hubitat device.

Getting Help and Support

  • Check the Hubitat Logs (Logs) for messages from "Volvo Cars" or your vehicle device (enable debug logging if needed).
  • Post your questions or issues in this thread! This is the best place to get support for this integration.

Project Link:

You can find the code and the full README on GitHub:
https://github.com/brianschmitt/hubitat-volvo-cars

I hope this integration is useful for the Volvo-owning members of the Hubitat community! Please let me know if you have any feedback or run into issues.

Enjoy!

1 Like

Couple of notes:

  • It's using the same undocumented auth flows that other home automation implementations utilize. I'm in the process of getting an app setup with Volvo to review if it can be substituted.
  • The auth flow is little wonky, still trying to figure out the right UI elements and flow within the app to make it work smoothly. You may need to click "Next" twice as you proceed through the steps.
  • Location is not currently working for the US, this is a current limitation of the API's/Auth and there is not much I can do presently. Its high on the list of things to address.
2 Likes

Thank you! Just set this up tonight - as I was never able to get the previous app to work due to Volvo's deprecation of the API.

I did notice the following two errors in my logs (note, I have an XC60 PHEV). I fully expected the first error based on your comment about location, but wanted to alert you to the 2nd.

[app:547](http://hubitat/logs#)2025-05-12 10:15:04.593 PM

error

Volvo Cars: Exception getting data for location (VINGOESHERE): status code: 404, reason phrase: Not Found

[app:547](http://hubitat/logs#)2025-05-12 10:15:04.543 PM

error

Volvo Cars: Exception getting data for rechargeStatus (VINGOEDHERE): status code: 406, reason phrase: Not Acceptable

Overall, great app -- easy to get up and running. Looking forward to using it for some notifications beyond the simple "You didn't lock your car" that the Volvo App provides.

Thanks for the feedback.

I was already aware of both errors, I was trying to decide what to do with them since they may work for others. I was unsure about the recharge status endpoint as I only have a gas XC60. I'll investigate it some more to see if there is an issue with the scopes, payload, or if Volvo is just returning 406s for some reason.

I also hope to limit the api calls made based on engine type, which would prevent it for those without EV.

However, I would have hoped that you would have been able to use that endpoint as it returns values about the battery/charge status.

Thanks again for the feedback!

Thank you! If there's anything I can do to assist with the Recharge issue -- let me know. Happy to run any diags or assist as needed.

1 Like

Dug into the 406 error I was seeing with the Recharge Status endpoint.

I believe the reason it's failing is that groovy is not handling the response type correctly. This particular endpoint has a different header for content type and I think the hubitat httpGet fails to parse it, even though I had specified it would be json. The fix is to manually parse the returned payload.

TLDR - The 406 error is fixed, and I pull recharge values only for EV|hybrid cars and pull Fuel for gas|hybrid|diesel cars. Bumped the version so Package Manager should pick it up.

2 Likes

Thank you - I can confirm that in my basic testing today (took an unplugged car and plugged it in to the charger), that this works and presents the correct data. A nice added benefit is battery % reporting as well - in addition to the Distance to Empty reporting.
Nice work, and Thank you!

Great to hear the Recharge endpoint is working for you.

Any interest/thoughts in a dashboard widget? I usually just have mine listed out with the lock status (the second block), felt it might be nice to report out the full status of Range, Locks, Engine, and Charging status (not shown).. I'm thinking something like the following, still playing around with it:
image

Bumped version to 0.3

  • Fix: For Volvo API HTTP issue
  • Enh: Added the dashboard attribute
  • Moved most logging to debug from info level
1 Like

I have been noticing recently that after some period of time (I believe it to be around ~24 hours) - the Authentication Fails between the App and the Volvo API Backend. If I go in and re-authenticate, it all works for about 24hrs (or longer), but then returns to this state.

[app:547](http://hubitat/logs#)2025-06-12 10:30:00.256 AM

error

Volvo Cars: Authentication Error: Refresh token missing.

I've noticed the same, if i trace it back to the first occurrence, it appears to be failing to refresh due to a timeout, I'm experimenting with extending the timeout, but I have a feeling we might be chasing a fix on this.

The TRUE fix is to use oauth, however, my app request is still pending at Volvo with no apparent activity.

Sorry for the delayed response, had to go away for a few days for a minor emergency.