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

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

Closed
mathieucarbou opened this issue Apr 18, 2023 · 70 comments · Fixed by #91609 or #91833
Closed

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

mathieucarbou opened this issue Apr 18, 2023 · 70 comments · Fixed by #91609 or #91833
Assignees

Comments

@mathieucarbou
Copy link

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

@home-assistant
Copy link

Hey there @epenet, mind taking a look at this issue as it has been labeled with an integration (renault) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of renault can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign renault Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


renault documentation
renault source
(message by IssueLinks)

@epenet
Copy link
Contributor

epenet commented Apr 18, 2023

It looks like a change on the Renault servers - not linked to 2023.4.5
We might need a new API key, similar to hacf-fr/renault-api#552

Please open an issue on renault-api repository.

@mathieucarbou
Copy link
Author

mathieucarbou commented Apr 18, 2023

@epenet : from where these API key come from ? Is it something that can be made configurable in HA ? Could we generate some ?

OPENED hacf-fr/renault-api#847

@epenet
Copy link
Contributor

epenet commented Apr 18, 2023

  • 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 Move key retrieval to Firebase hacf-fr/renault-api#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.

@mathieucarbou

This comment was marked as outdated.

@epenet

This comment was marked as outdated.

@TheReiner
Copy link

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

@epenet
Copy link
Contributor

epenet commented Apr 18, 2023

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

@Jarige
Copy link

Jarige commented Apr 18, 2023

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.

@TheReiner
Copy link

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

@mathieucarbou
Copy link
Author

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 those with HA OS, do we have to wait for a new HA release ?

@epenet
Copy link
Contributor

epenet commented Apr 18, 2023

Step 1 => create a PR on renault-api to update the constant and then wait for merge + new release
Step 2 => create a PR on HA with the updated renault-api package and then wait for merge + new HA patch release

@mathieucarbou
Copy link
Author

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

Small PRs like that can be done directly online. I did it: hacf-fr/renault-api#848

epenet pushed a commit to hacf-fr/renault-api that referenced this issue Apr 18, 2023
@mathieucarbou
Copy link
Author

mathieucarbou commented Apr 18, 2023

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

@TheReiner : I've tried a while ago and the manifest of the renault app does not allow to trust all certificates. So this step from the doc cannot be achieved:

Need to capture requests from an Android app? To capture requests from an Android app, you need to add a network security configuration file to your app to trust the postman-proxy-ca.crt certificate. For more information, see Trust additional CAs on the Android Developers portal.

@JeedHome44

This comment was marked as outdated.

@Lantoit

This comment was marked as outdated.

@epenet
Copy link
Contributor

epenet commented Apr 18, 2023

PR created #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.

@mathieucarbou
Copy link
Author

@TheReiner : I've installed Postman + the certificates on both my Android phone and iPad (IOS) but both didn't work: I was unable to intercept any ssl traffic.
Maybe because of the new SSL TLS v3 spec which does not allow content renegotiation ?
I would be glad to know how you make that work...

@JeedHome44

This comment was marked as outdated.

@smgt

This comment was marked as outdated.

@epenet

This comment was marked as outdated.

@jladefoged
Copy link

jladefoged commented Apr 20, 2023

Looks like the issue is solved in the dev version of Home Assistant and the fix will be in the 2023.4.6 milestone release.

@PaulMuadDib
Copy link

it_IT back online ! thanks @epenet for pointing the good/bad ssh add-on ! la zoé ronronne à nouveau dans H.A. :o))

@Tx3Roulio
Copy link

@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 :)

@Paps42
Copy link

Paps42 commented Apr 20, 2023

fantastic, it worked for me on HA OS, with this procedure:
"
install SSH & Web Terminal addon
disable Protection mode from addon settings
restart addon
ssh to homeassistant
docker exec -it homeassistant /bin/bash
vi /usr/src/homeassistant/homeassistant/components/renault/manifest.json
change renault-api==0.1.12 to renault-api==0.1.13
save file
restart homeassistant
"
you are the best, thank you so much.

My Zoé is now to return, i'm so happy

@MilorES
Copy link

MilorES commented Apr 20, 2023

imagen
Are you sure the folder is correct?

@epenet
Copy link
Contributor

epenet commented Apr 20, 2023

Are you sure the folder is correct?

You didn't run step 5

5. docker exec -it homeassistant /bin/bash

@MilorES
Copy link

MilorES commented Apr 20, 2023

oh, of course it's a docker that runs on the operating system!

Thanks and sorry!

@Cagiva-Raptor
Copy link

Here this solved my issue aswel thx a lot

@0sasu0
Copy link

0sasu0 commented Apr 21, 2023

Many thanks for this solution!

@kafka0
Copy link

kafka0 commented Apr 21, 2023

@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

Thank you! It worked great for me.

@ctrlaltdude
Copy link

I didn't have this add-on installed yet. So I guess I'm out of luck until it gets updated since I don't have this installed.

@epenet
Copy link
Contributor

epenet commented Apr 21, 2023

See steps 1/2/3 => you can just install it.

@ctrlaltdude
Copy link

I understand that you need to disable Protection mode from the SSH addon. But I don't see that option. This is what I read about it: "You can disable Protection Mode in the SSH add-on, not in the ESPHome add-on.
Add-ons will use the Home Assistant DNS provider, your own Docker containers won't. That's why it probably enables you to use your LAN FQDNs."

I also don't have docker. Running docker exec doesn't work.

SSH works fine though.

@epenet
Copy link
Contributor

epenet commented Apr 21, 2023

Are you using the correct addon?

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

@ctrlaltdude
Copy link

Lol that's tricky!
I used the wrong add-on.

Got it working now. Thanks a lot!

The vi version is a bit tricky though. :wq doesn't work. You need to press i to get into edit mode. And then use escape to get out of it. Then use w to save. And ctrl-z to exit.

@epenet epenet linked a pull request Apr 21, 2023 that will close this issue
@piet1951
Copy link

I have the same "renault-problem"
How can I resolve this problem when ha is running within proxmox ?
Thanks !!

@Cagiva-Raptor
Copy link

  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

@epenet
Copy link
Contributor

epenet commented Apr 22, 2023

2023.4.6 released.
Closing this issue now

@epenet epenet closed this as completed Apr 22, 2023
@jontybrook
Copy link

I can confirm that upgrading to 2023.4.6 resolved this for me.

Thanks to all involved for fixing this so quickly. This is OSS at it's best!

@Cagiva-Raptor
Copy link

After the upgrade to 2023.4.6 mine now gives all unavailable values

@jncanches
Copy link

It seems like even the official Renault app cannot get data from the car. Maybe there is a problem Renault side

@mathieucarbou
Copy link
Author

It seems like even the official Renault app cannot get data from the car. Maybe there is a problem Renault side

probably a temporary issue because it was working fine today.

@jncanches
Copy link

Yes I agree. Wait and see :-)

@jncanches
Copy link

@Cagiva-Raptor
Copy link

Damn, I was still able to see it on my iPhone, but was to curious if it would stop working when I updated the app....(v 5.1.3)
so sure , it no longer works in the native Renault App

@Cagiva-Raptor
Copy link

all works again, was outage at Renault I assume

@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.