core: Renault integration not working - ClientResponseError: 403, message='Forbidden'

The problem

Renault integration cannot connect anymore to Renault servers.

This happend after upgrading to core-2023.4.5

Logger: homeassistant.config_entries
Source: components/renault/renault_hub.py:59 
First occurred: 10:56:08 (1 occurrences) 
Last logged: 10:56:08

Error setting up entry Renault for renault
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/renault/__init__.py", line 29, in async_setup_entry
    await renault_hub.async_initialise(config_entry)
  File "/usr/src/homeassistant/homeassistant/components/renault/renault_hub.py", line 59, in async_initialise
    vehicles = await self._account.get_vehicles()
  File "/usr/local/lib/python3.10/site-packages/renault_api/renault_account.py", line 62, in get_vehicles
    return await self.session.get_account_vehicles(
  File "/usr/local/lib/python3.10/site-packages/renault_api/renault_session.py", line 188, in get_account_vehicles
    return await kamereon.get_account_vehicles(
  File "/usr/local/lib/python3.10/site-packages/renault_api/kamereon/__init__.py", line 239, in get_account_vehicles
    await request(
  File "/usr/local/lib/python3.10/site-packages/renault_api/kamereon/__init__.py", line 160, in request
    http_response.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url=URL('https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/<uuid>/vehicles?country=FR')
Logger: homeassistant.components.renault.renault_vehicle
Source: helpers/update_coordinator.py:193 
Integration: Renault (documentation, issues) 
First occurred: 10:53:28 (2 occurrences) 
Last logged: 10:53:28

Error requesting <vin> cockpit data: 403, message='Forbidden', url=URL('https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/<uuid>//kamereon/kca/car-adapter/v2/cars/<vin>/cockpit?country=FR')
Error requesting <vin> location data: 403, message='Forbidden', url=URL('https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/<uuid>//kamereon/kca/car-adapter/v1/cars/<vin>/location?country=FR')

What version of Home Assistant Core has the issue?

core-2023.4.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

renault

Link to integration documentation on our website

https://www.home-assistant.io/integrations/renault/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 10
  • Comments: 70 (17 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks - proxy is block on Android.

The new key is YjkKtHmGfaceeuExUDKGxrLZGGvtVS0J Do you want to do the honours and update the KAMEREON_APIKEY in the constant file on renault-api repository? https://github.com/hacf-fr/renault-api/blob/d838c59b823ed25a7a6ce7c0bdd2bc7ff993fd30/src/renault_api/const.py#L21

@Tx3Roulio this is how I did it:

  1. install SSH & Web Terminal addon
  2. disable Protection mode from addon settings
  3. restart addon
  4. ssh to homeassistant
  5. docker exec -it homeassistant /bin/bash
  6. vi /usr/src/homeassistant/homeassistant/components/renault/manifest.json
    • change renault-api==0.1.12 to renault-api==0.1.13
    • save file
  7. restart homeassistant

May I compliment you guys with the fast response to this? Thanks! Sounds like I won’t have to wait too long for it to be fixed.

i try a thing… i use Postman, enable Proxy… in my iPhone (with Proxy), i have open MyRenault. And this the result (With a google API)

Maybe it will help you ?

Screenshot 2023-04-18 at 14 44 12

The solution works for HA OS, but you need to use the correct add-on Good => “SSH & Web Terminal” Bad => “Terminal & SSH”

I run HA in a docker container (homeassistant/home-assistant sha256:bd5b10c7e4ae2f87380c1a4da2f211864c2b3b93c03c14ec132d838486df490e) and would like this fixed before the next release.

So this is what I did. I entered the container with docker exec -it home-assistant bash. Then entered the directory for the renault api package, cd /usr/local/lib/python3.10/site-packages/renault_api. There is the file, const.py, which I edited with vi (vi const.py) and replaced the api key mentioned in this thread (YjkKtHmGfaceeuExUDKGxrLZGGvtVS0J). After a HA restart it all worked again.

Thanks - proxy is block on Android.

The new key is YjkKtHmGfaceeuExUDKGxrLZGGvtVS0J Do you want to do the honours and update the KAMEREON_APIKEY in the constant file on renault-api repository? https://github.com/hacf-fr/renault-api/blob/d838c59b823ed25a7a6ce7c0bdd2bc7ff993fd30/src/renault_api/const.py#L21

For Android, you need ton install Postman certificate ^^ like iOS ^^ https://learning.postman.com/docs/sending-requests/capturing-request-data/capturing-https-traffic/#android

Hello,

And those who have a normal HA can’t do anything to explore the code and just modify the Manifest?

I don’t want to wait several weeks.

I copied the Renault folder and put it in the custom folder but it is not taken into account in the integrations.

Just need to change 0.1.12 to 0.1.13

it would be great to have an update to change the version of Renault-api in the integration settings

it was simpler before when it was not integrated into the HA code

PR created https://github.com/home-assistant/core/pull/91609 Need to wait for merge and for the next patch release.

In the mean time, you can either:

  • wait patiently
  • or extract to a custom component (I’m sure there are tutorials available) and adjust the package version

If you are extra motivated, you can create a PR to add an option flow so that next year the key can be set manually without waiting for a review process.

2023.4.6 released. Closing this issue now

@Tx3Roulio this is how I did it:

  1. install SSH & Web Terminal addon

  2. disable Protection mode from addon settings

  3. restart addon

  4. ssh to homeassistant

  5. docker exec -it homeassistant /bin/bash

  6. vi /usr/src/homeassistant/homeassistant/components/renault/manifest.json

    • change renault-api==0.1.12 to renault-api==0.1.13
    • save file
  7. restart homeassistant

Thanks a lot, it works like a charm 😃

I had to dig it up, but what I wanted to suggest is to edit instead this file: /usr/src/homeassistant/homeassistant/components/renault/manifest.json There you can just set "requirements": ["renault-api==0.1.13"]

I think it is better to match the patch PR 😃

I run HA in a docker container and would like this fixed before the next release. So this is what I did. I entered the container with docker exec -it home-assistant bash. Then entered the directory for the renault api package, cd /usr/local/lib/python3.10/site-packages/renault_api. There is the file, const.py, which I edited with vi (vi const.py) and replaced the api key mentioned in this thread (YjkKtHmGfaceeuExUDKGxrLZGGvtVS0J). After a HA restart it all worked again.

You shouldn’t do this. You should instead make the same update as my PR: update the manifest file to use latest renault-api package version.

This was the easiest for me without the need to learn anything. Just read the error message, copy the key from this thread and then paste it in a file. I doesn’t really matter anyway since the next time I update the container the change will be gone.

  • Renault does not share the keys easily. If you find an easy way to get the key from Renault then a PR is welcome. See https://github.com/hacf-fr/renault-api/pull/184 but it hasn’t gone very far

  • After someone finds the new key, I usually publish a package update within a few hours and if the PR is approved here it is available in the next release. It should be possible to make the key configurable but I have found until now easier to simply publish a new release. Again, a PR is welcome if you want to participate.

thank you ! I found my zoe ! it’s work !

I have HA OS and even with “SSH & Web Terminal” this is not working and I do not have access at all to the HA system.

You didn’t run step 5

5. docker exec -it homeassistant /bin/bash

nano isn’t available currently. Look on the web for tutorials on using vi

@Tx3Roulio this is how I did it:

  1. install SSH & Web Terminal addon

  2. disable Protection mode from addon settings

  3. restart addon

  4. ssh to homeassistant

  5. docker exec -it homeassistant /bin/bash

  6. vi /usr/src/homeassistant/homeassistant/components/renault/manifest.json

    • change renault-api==0.1.12 to renault-api==0.1.13
    • save file
  7. restart homeassistant

Not for HA OS…

It will automatically pick up the new package on restart.

I just think that using manifest.json instead of const.py mirrors better what will happen inside the next patch. If there is an issue (I don’t expect any but you never know) it will be spotted earlier…

Same problem here (it_IT)