mitch-dc / volkswagen_we_connect_id

Apache License 2.0
204 stars 54 forks source link

403 error when trying to add integration #222

Open peter-bosch opened 1 year ago

peter-bosch commented 1 year ago

Version of the custom_component

v0.1.8

Installation method (hacs / manual)

HACS

Installation method of hass (venv, docker, hassio,...)

docker

Configuration

N/A, added via integration

Describe the bug

When trying to add the integration, it takes a couple of minutes and the logs subsequently show a 403 error. All added entities are "unavailable" and lots of them are missing (SoC etc).

I do also have the Cupra WeConnect integration installed for my other half's car, not sure if that's conflicting?

I have tried removing the integration, reinstalling it, restarting HA (also between removing and reinstalling) but to no avail. Anyone else have any idea how to fix this?

Debug log


Logger: homeassistant.components.number
Source: helpers/update_coordinator.py:258
Integration: Number (documentation, issues)
First occurred: 21:13:20 (1 occurrences)
Last logged: 21:13:20

Error while setting up volkswagen_we_connect_id platform for number
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 242, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagen_we_connect_id/__init__.py", line 53, in async_update_data
    await hass.async_add_executor_job(_we_connect.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/weconnect/weconnect.py", line 193, in update
    self.updateVehicles(updateCapabilities=updateCapabilities, updatePictures=updatePictures, force=force, selective=selective)
  File "/usr/local/lib/python3.11/site-packages/weconnect/weconnect.py", line 202, in updateVehicles
    data = self.fetchData(url, force)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/weconnect/weconnect.py", line 388, in fetchData
    raise RetrievalError(f'Could not fetch data. Status Code was: {statusResponse.status_code}')
weconnect.errors.RetrievalError: Could not fetch data. Status Code was: 403

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 353, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/volkswagen_we_connect_id/number.py", line 28, in async_setup_entry
    await coordinator.async_config_entry_first_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in async_config_entry_first_refresh
    raise ex
homeassistant.exceptions.ConfigEntryNotReady: Could not fetch data. Status Code was: 403
sebking1971 commented 1 year ago

Having the same here - very occasionally will see a sensor display - same errors as above

legantois commented 1 year ago

same for me

bagges commented 1 year ago

Same here. Even increasing the interval to 90s does not help. I have registered two accounts.

akunia commented 1 year ago

Hi same problem for me. Isn't related to ? :

"We'd like to inform you that the ‘We Connect’ smartphone app will be deactivated and operations will cease on 08/11/2023.

From then on, you will be able to use the Volkswagen app to access We Connect functions previously run by the We Connect app. You can download the Volkswagen app here in the Google Play store or here in the Apple Store."

ColinRobbins commented 1 year ago

I’ve had the integration working for a long time, but am now seeing 403 error too.

aogriffiths commented 1 year ago

Me too. Here are the logs I’ve got.

This error originated from a custom integration.

Logger: custom_components.volkswagen_we_connect_id
Source: helpers/update_coordinator.py:290
Integration: Volkswagen We Connect ID
First occurred: 06:22:04 (2 occurrences)
Last logged: 06:22:04

Unexpected error fetching volkswagen_we_connect_id data: Could not fetch data. Status Code was: 403
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 246, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagen_we_connect_id/__init__.py", line 53, in async_update_data
    await hass.async_add_executor_job(_we_connect.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/weconnect/weconnect.py", line 193, in update
    self.updateVehicles(updateCapabilities=updateCapabilities, updatePictures=updatePictures, force=force, selective=selective)
  File "/usr/local/lib/python3.11/site-packages/weconnect/weconnect.py", line 202, in updateVehicles
    data = self.fetchData(url, force)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/weconnect/weconnect.py", line 388, in fetchData
    raise RetrievalError(f'Could not fetch data. Status Code was: {statusResponse.status_code}')
weconnect.errors.RetrievalError: Could not fetch data. Status Code was: 403
nyordanov commented 6 months ago

Same here. Lots of 403 errors since yesterday, and trying to set up the integration from scratch didn't help either:

Logger: custom_components.volkswagen_we_connect_id.config_flow
Source: custom_components/volkswagen_we_connect_id/config_flow.py:65
integration: Volkswagen We Connect ID
First occurred: 18:14:11 (1 occurrences)
Last logged: 18:14:11
Unexpected exception

Traceback (most recent call last):
  File "/config/custom_components/volkswagen_we_connect_id/config_flow.py", line 65, in async_step_user
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagen_we_connect_id/config_flow.py", line 40, in validate_input
    await hass.async_add_executor_job(update, we_connect)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/volkswagen_we_connect_id/__init__.py", line 223, in update
    api.update(updatePictures=False)
  File "/usr/local/lib/python3.12/site-packages/weconnect/weconnect.py", line 194, in update
    self.updateVehicles(updateCapabilities=updateCapabilities, updatePictures=updatePictures, force=force, selective=selective)
  File "/usr/local/lib/python3.12/site-packages/weconnect/weconnect.py", line 232, in updateVehicles
    raise catchedRetrievalError
  File "/usr/local/lib/python3.12/site-packages/weconnect/weconnect.py", line 216, in updateVehicles
    vehicle = Vehicle(weConnect=self, vin=vin, parent=self.__vehicles, fromDict=vehicleDict, fixAPI=self.fixAPI,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/weconnect/elements/vehicle.py", line 133, in __init__
    self.update(fromDict, updateCapabilities=updateCapabilities, updatePictures=updatePictures, selective=selective)
  File "/usr/local/lib/python3.12/site-packages/weconnect/elements/vehicle.py", line 227, in update
    self.updateStatus(updateCapabilities=updateCapabilities, force=force, selective=selective)
  File "/usr/local/lib/python3.12/site-packages/weconnect/elements/vehicle.py", line 338, in updateStatus
    data: Optional[Dict[str, Any]] = self.weConnect.fetchData(url, force)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/weconnect/weconnect.py", line 399, in fetchData
    raise RetrievalError(f'Could not fetch data. Status Code was: {statusResponse.status_code}')
weconnect.errors.RetrievalError: Could not fetch data. Status Code was: 403