sander1988 / Indego

Home Assistant Custom Component for Bosch Indego Lawn Mower
Apache License 2.0
92 stars 29 forks source link

Error: 400 #206

Closed antoinevandenhurk closed 3 months ago

antoinevandenhurk commented 9 months ago

I have noticed the following problem for a few days now, how can I solve this?

2023-11-24 21:24:19.576 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry indego (XXXXXXXX) for indego Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/indego/init.py", line 230, in async_setup_entry await indego_hub.update_generic_data_and_load_platforms(load_platforms) File "/config/custom_components/indego/init.py", line 389, in update_generic_data_and_load_platforms generic_data = await self._update_generic_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/indego/init.py", line 638, in _update_generic_data await self._indego_client.update_generic_data() File "/usr/local/lib/python3.11/site-packages/pyIndego/indego_async_client.py", line 262, in update_generic_data self._update_generic_data(await self.get(f"alms/{self.serial}")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyIndego/indego_async_client.py", line 548, in get return await self._request(method=Methods.GET, path=path, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pyIndego/indego_async_client.py", line 477, in _request self._token = await self._token_refresh_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/indego/init.py", line 334, in async_token_refresh await session.async_ensure_token_valid() File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 503, in async_ensure_token_valid new_token = await self.implementation.async_refresh_token(self.token) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 92, in async_refresh_token new_token = await self._async_refresh_token(token) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 182, in _async_refresh_token new_token = await self._token_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 209, in _token_request resp.raise_for_status() File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/b2c_1a_signup_signin/oauth2/v2.0/token')

sander1988 commented 9 months ago

Your token has expired. This might happen when your HA instance is offline for more than 24 hours. We can't fix this as the Bosch API only generates renewal tokens for max 24 hours. See #171 for more details.

sander1988 commented 9 months ago

The solution is to remove the component and add it again.