HomeAssistant-Mods / home-assistant-miele

Miele integration for Home assistant
138 stars 32 forks source link

Authentication fails after update of Homeassistant to 2023.5.0 #153

Closed heikone closed 1 year ago

heikone commented 1 year ago

Hello,

after updating the HA to 2023.5.0 this morning, the integration fails to authenticate as described by the following log:

Logger: homeassistant.setup
Source: custom_components/miele/miele_at_home.py:174 
Integration: miele (documentation, issues) 
First occurred: 17:51:01 (1 occurrences) 
Last logged: 17:51:01

Error during setup of component miele
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 257, in _async_setup_component
    result = await task
  File "/config/custom_components/miele/__init__.py", line 152, in async_setup
    data_get_devices = await client.get_devices(lang)
  File "/config/custom_components/miele/miele_at_home.py", line 48, in get_devices
    home_devices = await self._get_devices_raw(lang)
  File "/config/custom_components/miele/miele_at_home.py", line 32, in _get_devices_raw
    if await self._session.refresh_token(self.hass):
  File "/config/custom_components/miele/miele_at_home.py", line 165, in refresh_token
    self._token = await hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/miele/miele_at_home.py", line 174, in sync_refresh_token
    return self._session.refresh_token(
  File "/usr/local/lib/python3.10/site-packages/requests_oauthlib/oauth2_session.py", line 452, in refresh_token
    self.token = self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 427, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 448, in validate_token_parameters
    raise_from_error(params.get('error'), params)
  File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 399, in raise_from_error
    raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) 

Before, the integration was running perfectly. Hope anybody can advice how to solve this.

If some more information is needed to analyze, just let me know!

Greetings Heiko

heikone commented 1 year ago

Tried this bugfix #152, but I that doesn't solve it for me setup.

heikone commented 1 year ago

Fixed with update to v0.9.4. The Home Assistant system asked to reauthorize and now the integration works as before. Thanks for the update!