Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding XC40 2019 Diesel fails #33

Closed
thomasddn opened this issue Jan 10, 2025 · 5 comments
Closed

Adding XC40 2019 Diesel fails #33

thomasddn opened this issue Jan 10, 2025 · 5 comments
Labels
problem Something isn't working

Comments

@thomasddn
Copy link
Owner

I am getting a problem adding a second car. My first car (V90 XC 2021) works fine and the level of information is great! When I do 'add entry' for the second car (XC40 2019 Diesel) it fails to initialise. It keeps retrying so I have disabled it. The system log has the following error info (I have removed the VIN and replaced with '*'):

Logger: custom_components.volvo_cars.coordinator
Source: helpers/update_coordinator.py:321
integration: Volvo Cars (documentation, issues)
First occurred: 12:42:49 (23 occurrences)
Last logged: 13:43:43

Unexpected error fetching XC40 data
Traceback (most recent call last):
File "/config/custom_components/volvo_cars/volvo/api.py", line 210, in _async_request
response.raise_for_status()
File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1158, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url='https://api.volvocars.com/connected-vehicle/v2/vehicles/***********************'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 321, in __wrap_async_setup
await self._async_setup()
File "/config/custom_components/volvo_cars/coordinator.py", line 105, in _async_setup
vehicle = await self.api.async_get_vehicle_details()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/volvo_cars/volvo/api.py", line 132, in async_get_vehicle_details
data = await self._async_get_data_dict(_API_CONNECTED_ENDPOINT, "")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/volvo_cars/volvo/api.py", line 164, in _async_get_data_dict
body = await self._async_get(endpoint, operation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/volvo_cars/volvo/api.py", line 172, in _async_get
return await self._async_request(hdrs.METH_GET, endpoint, operation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/volvo_cars/volvo/api.py", line 218, in _async_request
raise VolvoAuthException from ex
custom_components.volvo_cars.volvo.models.VolvoAuthException

I can see both cars in the app and can switch between them etc. I am using the same Volvo ID login details for both entries, I am using the same API key for both vehicles. The VIN is obviously different and the Friendly name is different.

I am doing something wrong?

Originally posted by @MJBirtwistle in #3 (comment)

@thomasddn thomasddn added the problem Something isn't working label Jan 10, 2025
@thomasddn thomasddn changed the title Adding XC40 2019 Diesel) fails Adding XC40 2019 Diesel fails Jan 10, 2025
@thomasddn
Copy link
Owner Author

Can you:

  • Remove the faulty entry
  • Enable debug logging (how-to)
  • Add the XC40 again
  • Disable debug logging
  • Upload the log (remove VIN from log)

@MJBirtwistle
Copy link

home-assistant_volvo_cars_2025-01-10T15-43-46.159Z.log

Done, if you need more info - let met know :)

@thomasddn
Copy link
Owner Author

I see what the issue is: "No relationship to UUID".

You probably don't have access to that car with the specified account. Do you see both cars on https://www.volvocars.com/uk/account/my-cars/?

Forgot to say this, and it's not the cause of the problem, but don't use the same API key for both cars, unless you'll set the update interval to a larger value. You can create multiple API keys.

@MJBirtwistle
Copy link

So I restarted HA so that the log would be easier to clean up.

I deleted the previous XC40 entry, disabled the V90 entry and enabled debug logging.

I then added the XC40 entry and it worked!

I then re-enabled the V90 entry and that's working too.

I did not see your comments about UUID before doing this.

So I guess what I should do is delete the XC40 again, set up a new API key and then re-add the XC40 with the new API key?

I have the debug log if you would like it but I guess it will show it going through without any problem?

@thomasddn
Copy link
Owner Author

So I guess what I should do is delete the XC40 again, set up a new API key and then re-add the XC40 with the new API key?

That is one option.

The second option is to set a higher update interval on both entries. Look for the "Data update interval" entity of both cars. In a next release there will be an option to change the API key without needing to re-configure the entry. Then you could lower the interval again.

I have the debug log

I don't need it for now.

@thomasddn thomasddn closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants