hacf-fr / renault-api

https://readthedocs.org/projects/renault-api/
MIT License
102 stars 34 forks source link

Dacia/Renault integration 'err.func.403',' access is denied for this resource' #1205

Open pedrofnm opened 1 month ago

pedrofnm commented 1 month ago

I Have this integration installed for some time now (1 year+/-) waiting for the day it gets fixed but so far it's always the same. I have a Dacia Spring and I'm able to add it to home assistant but it never worked properly. It shows many sensors but all its unavailable, the only available entities is the start/stop charging and AC ON but everytime I press on, it shows the err.func.403 error and does nothing. I searched for this topic in internet and it seems some people have this integration running fine. I wonder if this issue it's related to my country Renault server/api (Portugal) or it's something else. Thanks

pedrofnm commented 1 month ago

Here is the log:

2024-05-29 07:25:48.070 DEBUG (MainThread) [renault_api.kamereon] Send Kamereon POST request to https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/756de083-df4a-4bef-971f-4b2da6e2f134/kamereon/kca/car-adapter/v1/cars/UU1DBG004MU041359/actions/hvac-start?country=PT with body: {"data": {"type": "HvacStart", "attributes": {"action": "start", "targetTemperature": 21}}} 2024-05-29 07:25:48.071 DEBUG (MainThread) [renault_api.kamereon] Received Kamereon response 403 on POST to https://api-wired-prod-1-euw1.wrd-aws.com/commerce/v1/accounts/756de083-df4a-4bef-971f-4b2da6e2f134/kamereon/kca/car-adapter/v1/cars/UU1DBG004MU041359/actions/hvac-start?country=PT: {"type":"FUNCTIONAL","messages":[{"code":"err.func.403","message":"{"errors":[{"status":"403","code":"security.access","detail":"Access is denied for this resource"}]}"}],"errors":[{"errorCode":"err.func.403","errorMessage":"{"errors":[{"status":"403","code":"security.access","detail":"Access is denied for this resource"}]}"}],"error_reference":"FUNCTIONAL"} 2024-05-29 07:25:48.072 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547354111808] Unexpected exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/renault/renault_vehicle.py", line 42, in wrapper return await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/renault/renault_vehicle.py", line 170, in set_ac_start return await self._vehicle.set_ac_start(temperature, when) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/renault_api/renault_vehicle.py", line 395, in set_ac_start response = await self.session.set_vehicle_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/renault_api/renault_session.py", line 261, in set_vehicle_action return await kamereon.set_vehicle_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/renault_api/kamereon/init.py", line 364, in set_vehicle_action await request( File "/usr/local/lib/python3.12/site-packages/renault_api/kamereon/init.py", line 157, in request kamereon_response.raise_for_error_code() File "/usr/local/lib/python3.12/site-packages/renault_api/kamereon/models.py", line 136, in raise_for_error_code error.raise_for_error_code() File "/usr/local/lib/python3.12/site-packages/renault_api/kamereon/models.py", line 97, in raise_for_error_code raise error_type(self.errorCode, error_details) renault_api.kamereon.exceptions.AccessDeniedException: ('err.func.403', 'Access is denied for this resource')

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

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1047, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/button/init.py", line 134, in _async_press_action await self.async_press() File "/usr/src/homeassistant/homeassistant/components/renault/button.py", line 50, in async_press await self.entity_description.async_press(self) File "/usr/src/homeassistant/homeassistant/components/renault/renault_vehicle.py", line 44, in wrapper raise HomeAssistantError(err) from err

eltoro0815 commented 1 month ago

Hi:)

I have a Dacia Spring. Starting the HVAC works in my case. I'm from Germany.

Your request URL is correct.

The only difference I can spot to what is sent in my case is the additional parameter "id" which is an UUID:

{
  "data": {
    "type": "HvacStart",
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "attributes": {
      "action": "start",
      "targetTemperature": 21
    }
  }
}

If this "id" is also sent in your case and is just not displayed in the log, you should contact Renault. It is possible that this API Endpoint is configured wrong for your Account.