ha-postnl
ha-postnl copied to clipboard
Integration stops working
After setting up the integration, it will stop working after some time. Error being thrown:
Logger: homeassistant.config_entries
Source: config_entries.py:504
First occurred: 11:20:46 (2 occurrences)
Last logged: 15:40:41
Error setting up entry <id> for postnl
Traceback (most recent call last):
File "/config/custom_components/postnl/__init__.py", line 92, in check_and_refresh_token
await self.oauth_session.async_ensure_token_valid()
File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 519, 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 94, in async_refresh_token
new_token = await self._async_refresh_token(token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 184, in _async_refresh_token
new_token = await self._token_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 217, in _token_request
resp.raise_for_status()
File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1060, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://login.postnl.nl/<id>/login/token')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/postnl/__init__.py", line 35, in async_setup_entry
await auth.check_and_refresh_token()
File "/config/custom_components/postnl/__init__.py", line 98, in check_and_refresh_token
raise HomeAssistantError(exception) from exception
homeassistant.exceptions.HomeAssistantError: 400, message='Bad Request', url=URL('https://login.postnl.nl/<id>/login/token')
Also getting:
Logger: homeassistant.helpers.config_entry_oauth2_flow
Source: helpers/config_entry_oauth2_flow.py:211
First occurred: 11:20:46 (2 occurrences)
Last logged: 15:40:41
Token request for postnl_postnl failed (invalid_grant): refresh_token is invalid