core: increasing number of errors (token expired) with netatmo

The problem

Netatmo throws an increasing numer of errors. Last 24 Hours around 20 times. The issue appeared first in 118.5 and still remains in 2020.12.2 (already updated)

Environment

  • Home Assistant Core release with the issue: 2020.12.12
  • Last working Home Assistant Core release (if known): 117.x
  • Operating environment (OS/Container/Supervised/Core):
  • Integration causing this issue:
  • Link to integration documentation on our website:

Problem-relevant configuration.yaml


Traceback/Error logs

Logger: homeassistant
Source: components/cloud/account_link.py:146
First occurred: 16:16:49 (1 occurrences)
Last logged: 16:16:49

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 146, in query
    rsp = self._oauth.post(url=url, data=params, timeout=timeout)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 477, in request
    url, headers, data = self._client.add_token(
  File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token
    raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 93, in async_update
    await self.async_fetch_data(
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 117, in async_fetch_data
    self.data[data_class_entry] = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/site-packages/pyatmo/home_coach.py", line 22, in __init__
    super().__init__(auth, url_req=_GETHOMECOACHDATA_REQ)
  File "/usr/local/lib/python3.8/site-packages/pyatmo/weather_station.py", line 30, in __init__
    resp = self.auth.post_request(url=self.url_req)
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 161, in post_request
    resp = query(url, params, timeout, 3)
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 155, in query
    self._oauth.token = self.refresh_tokens()
  File "/usr/src/homeassistant/homeassistant/components/netatmo/api.py", line 30, in refresh_tokens
    run_coroutine_threadsafe(
  File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 465, 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 84, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/usr/src/homeassistant/homeassistant/components/cloud/account_link.py", line 146, in _async_refresh_token
    return await account_link.async_fetch_access_token(
  File "/usr/local/lib/python3.8/site-packages/hass_nabucasa/account_link.py", line 112, in async_fetch_access_token
    resp.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1002, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://account-link.nabucasa.com/refresh_token/netatmo')


Additional information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 44 (13 by maintainers)

Most upvoted comments

I think, we can close this as the errors disappeared as they came

@cgtobi After over a week there is now more errors regarding tokens on netatmo integrations.

I’ve not received any errors anymore since using configuration.yaml. So it seems this does happen only when using cloud integration.