Volvo Cars integration

Hello there and thanks for the work on this integration. I read all comments in this thread but didn’t find similar question. I have HA in a docker container on a raspberry pi 5. The pie is behind a VPN and HA is exposed. When the VPN is active, i cant connect at all to the API, HA is giving the 500 server got in trouble error and there are timeout erros in the logs. Without VPN everything works fine. Has anyone been in similar situation, any workarounds? Thanks

current response from volvo API , the integration was fine putting this on API status state

[custom_components.volvo_cars.volvo.api] Request [API status] response: {'message': 'Our API Specifications are currently down. Our team is actively working on a solution, and we apologize for the inconvenience.'}

Yeah, but everything is still working on my side. :man_shrugging:t2:

Maybe I should make it a binary sensor or use a custom shorter description, with the original description as an attribute.

Is the vpn server on the same machine as HA?

Same here, the other sensores appear to be working.

I think that current solution with full state in text is good to show the information as normally it returns OK which is short for the normal case.

Yes, running wireguard installed as normal package on the raspberry. All docker traffic is going trough the vpn. Provider is AirVpn and im using port forwarding on the vpn server to access HA. I can share log if you point me to what specific i should look for. Thanks Thomas!

Same for me…
I have been a bit confused about that message. It’s still working, but message say’s it’s down.
So I guess a binary sensor with “long_text” as an attribute would be a good solution. Hopefully VOLVO knows when their servers are down :wink:

I guess all external traffic is blocked when the VPN is active, and not only this integration.

From here it is very difficult to determine what the problem exactly is. I understand networking, but I’m certainly no expert. So I handed it over to chatgpt and here’s what it came up with.

AI shizzle

If the user can access Home Assistant (HA) remotely via the VPN (e.g., through AirVPN port forwarding), but HA itself fails to connect to external services (triggering 500 errors or timeouts in your integration), then it’s almost certainly a routing or DNS issue with outbound traffic from the container via the VPN.

Here’s what’s likely happening and how to fix or verify it:


:mag: Likely Problem

The VPN is routing all outbound traffic from the Raspberry Pi (and its Docker containers) through the tunnel, and:

  1. The VPN provider (AirVPN) may restrict or block some outbound traffic or ports.
  2. DNS isn’t working properly inside the container.
  3. Some API endpoints your integration needs (e.g., HTTPS services) aren’t reachable through the VPN.

:white_check_mark: Steps to Diagnose and Fix

1. Test external access from inside the container

Ask the user to run:

docker exec -it homeassistant /bin/bash
# or /bin/sh depending on the image

# Then try these commands:
curl https://api.volvocars.com
ping 8.8.8.8
ping google.com

If curl or ping fails, then the container has no outbound connectivity or DNS resolution.

2. Check DNS inside the container

Still inside the container:

cat /etc/resolv.conf
nslookup google.com

If DNS resolution fails, HA won’t be able to reach any external service.

3. Confirm VPN policy and firewall behavior

Have the user check their WireGuard config:

If the config includes:

AllowedIPs = 0.0.0.0/0

Then all outbound traffic is routed through the VPN. If the VPN blocks certain traffic (e.g., some ports or destination IPs), HA’s API requests may fail.

Solution: Try split tunneling — allow only selected traffic via VPN or exclude the Docker bridge network or HA container from routing through the VPN.

4. Consider bypassing the VPN for HA

If external connectivity from HA is critical and the VPN is interfering:

  • Use iptables or routing rules to prevent the HA container from using the VPN route.
  • Or run HA outside the VPN namespace altogether.

:hammer_and_wrench: Workaround: Use a custom Docker network

One way to give HA normal Internet access:

  1. Run WireGuard inside its own container (e.g., with gluetun).
  2. Only attach specific containers to the VPN network.
  3. Keep HA on the default network with normal outbound Internet.

This gives you more control.


:test_tube: Summary Test Matrix

Test Expected Result Means…
curl to external API in HA Success Internet access works
ping 8.8.8.8 Success Routing works
ping google.com Success DNS works
curl times out VPN or firewall is blocking
nslookup fails DNS misconfigured

I’m having an issue similar to @thomas_be but it seems different.

The Volvo integration stopped working a couple of days ago and it asks me to re-authenticate.
I enter:

  • username:
  • password:
  • vcc_api_key: <VCC API key - Primary from my Developer Account

I keep getting “Authentication failed”

2025-06-04 12:20:45.454 DEBUG (MainThread) [custom_components.volvo_cars.volvo.auth] Request [auth init]
2025-06-04 12:20:45.614 DEBUG (MainThread) [custom_components.volvo_cars.volvo.auth] Request [auth init] status: 200
2025-06-04 12:20:45.615 DEBUG (MainThread) [custom_components.volvo_cars.volvo.auth] Request [auth init] response: {'id': '**REDACTED**', 'pluginTypeId': '7RmQNDWaOnBoudTufx2sEw', 'status': 'USERNAME_PASSWORD_REQUIRED', 'showRememberMyUsername': False, 'showThisIsMyDevice': False, 'thisIsMyDeviceSelected': False, 'showCaptcha': False, 'rememberMyUsernameSelected': False, '_links': {'self': {'href': '**REDACTED**'}, 'checkUsernamePassword': {'href': '**REDACTED**'}}}
2025-06-04 12:20:45.615 DEBUG (MainThread) [custom_components.volvo_cars.volvo.auth] Request [credentials]
2025-06-04 12:20:45.713 DEBUG (MainThread) [custom_components.volvo_cars.volvo.auth] Request [credentials] status: 200
2025-06-04 12:20:45.713 DEBUG (MainThread) [custom_components.volvo_cars.volvo.auth] Request [credentials] response: {'id': '**REDACTED**', 'pluginTypeId': '7RmQNDWaOnBoudTufx2sEw', 'status': 'USERNAME_PASSWORD_REQUIRED', 'showRememberMyUsername': False, 'showThisIsMyDevice': False, 'thisIsMyDeviceSelected': False, 'showCaptcha': False, 'rememberMyUsernameSelected': False, '_links': {'self': {'href': '**REDACTED**'}, 'checkUsernamePassword': {'href': '**REDACTED**'}}}
2025-06-04 12:20:45.714 ERROR (MainThread) [custom_components.volvo_cars.config_flow] Authentication failed: Status: USERNAME_PASSWORD_REQUIRED Reason: None
Traceback (most recent call last):
  File "/config/custom_components/volvo_cars/config_flow.py", line 221, in _async_authenticate
    result = await api.async_authenticate(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        user_input[CONF_USERNAME], user_input[CONF_PASSWORD]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/config/custom_components/volvo_cars/volvo/auth.py", line 105, in async_authenticate
    raise self._create_exception(data)
custom_components.volvo_cars.volvo.models.VolvoAuthException: Status: USERNAME_PASSWORD_REQUIRED Reason: None

Am I hitting a bug or overlooking something?

Thanks Thomas, that actually helped, i managed to solve the networking of the container. I can ping and curl the api from inside the container, but now there is the same issue like in @chisonne post. Exact same error - line 221 and line 105

@chisonne @rainov Yeah, something is wrong with the auth API of Volvo. We are stuck in a loop. The issue is being tracked in https://github.com/thomasddn/ha-volvo-cars/issues/156.

2 Likes

Everything works smooth after the fix. Thanks again for the integration

Hi Thomas, and thanks for the integration to the Volvo Cars API. With this I get access to the 74 entities in, as I understand it, the Connected Vehicle API.

How do I get access to the other Volvo APIs, eg Energy API, with parameters like “Target battery charge level”? Is there an integration to these as well?

The integration provides access to all available APIs, except for two or three, like the target battery level. That is because the API user has no access to it, and back in the day there was no way to request additional access.

Things have changed in Volvo’s API approval flow, making it possible to use all APIs now, but the auth flow is different.

I have an open PR to make this integration a core integration, making use of this new flow and where all APIs will be available.