Netatmo stopped working after 0.107.7

Hi,

I’ve just upgraded to 0.107.7 (from 0.106.x) and this broke Netatmo.
I’ve only got temperature sensors (no Netatmo camera) and the only thing that looks related is

ERROR (MainThread) [homeassistant.components.netatmo] Error during webhook registration - 400 - Bad request - Allowed ports for webhooks are 443 and 80. (21) when accessing 'https://api.netatmo.com/api/addwebhook'

in the log.

Dev-Tools show state “unknown” for each Netatmo sensor:

I’ve seen the breaking change mentioned in https://www.home-assistant.io/blog/2020/03/18/release-107/ (The unreliable binary sensors are removed since they don’t provide much value due to their polling nature. To trigger automations it is recommended to use the event netatmo_event), but I don’t know if this affects my setup at all.

Thanks.

The error just means that the webhook could not be established.

What do you mean by temperature sensors? The indoor sensor (home coach)?

I am talking about this product: https://www.netatmo.com/de-de/weather/weatherstation
None of the sensors (temp, CO2, etc) shows current data.

And they did work in 0.106? Please restart and if that doesn’t help turn on debug logging for the netatmo integration. Without any errors it is really difficult to help.

Hello,
i have the same error: [homeassistant.components.netatmo] Error during webhook registration - 400 - Bad request - Allowed ports for webhooks are 443 and 80. (21) when accessing 'https://api.netatmo.com/api/addwebhook'
I have netatmo thermovalves and never saw this error before ( using HA since 1 year ).
BTW if set a temp on a valve thru HA it’s working anyway, so i don’t know what kind of severity is, as an error.

p.s. i’m always updated with the versions of HA and plugins.

That error is purely about the webhook not working and should not affect any other devices.

1 Like

Must have been something at Netatmo’s end. I’ve enabled debug logging and the issue solved itself in the following night (not saying that debug logging fixed it though).

1 Like

I have same problem. I added inside my configuration.yaml

logger:
  default: error
  logs:
    homeassistant.components.netatmo: debug

And the problem is there again.
The output of home-assistant.log is:

2020-04-11 11:00:33 DEBUG (SyncWorker_12) [homeassistant.components.netatmo.climate] No thermostat devices available
2020-04-11 11:00:33 DEBUG (SyncWorker_18) [homeassistant.components.netatmo.sensor] weather station detected!
2020-04-11 11:00:33 DEBUG (SyncWorker_18) [homeassistant.components.netatmo.sensor] Adding module Indoor XXXXXXXXXXXXXXX [CENSORED BY ME]
2020-04-11 11:00:33 DEBUG (SyncWorker_18) [homeassistant.components.netatmo.sensor] Adding module Esterno XXXXXXXXXXXXXXX [CENSORED BY ME]
2020-04-11 11:00:34 DEBUG (SyncWorker_4) [homeassistant.components.netatmo.camera] No cameras found
2020-04-11 11:00:36 DEBUG (SyncWorker_18) [homeassistant.components.netatmo.sensor] No home coach entities found
2020-04-11 11:00:44 ERROR (MainThread) [homeassistant.components.netatmo] Error during webhook registration - 400 - Bad request - Allowed ports for webhooks are 443 and 80. (21) when accessing 'https://api.netatmo.com/api/addwebhook'

It’s impossible for me open port 443 and 80 becouse I opened them for other services…
Do you have a solution?
However the sensors work well. I can read them and use them in my automation and in general in home assistant.

Can someone explain what is the problem if the “webhook” doesn’t work?

Can you please describe your actual problem?

The webhook error simply means that you can’t use webhook based events from Netatmo.

If you just have a weather station you can safely ignore it.

Thanks a lot. I have only weather station.
The problems are these log messages:

  • token_expired
  • database is locked
  • Too many retries

With so many “errors” is difficult for me to read the log file… in a day it becomes huge.
Maybe could you advice me to use old configuration file to receive update from my netatmo weather station? (it works again or is it deprecated?)

Following the log file:

2020-04-11 13:48:39 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.netatmo_netatmo_indoor_temperature fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 129, in query
    rsp = self._oauth.post(url=url, data=params, timeout=timeout)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/srv/homeassistant/lib/python3.7/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 "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 225, in update
    self.netatmo_data.update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 550, in update
    self.station_data = self.station_data.__class__(self.auth)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/weather_station.py", line 24, in __init__
    resp = self.authData.post_request(url=self.urlReq)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 143, in post_request
    resp = query(url, params, timeout, 3)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 137, in query
    self._oauth.token = self.refresh_tokens()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/api.py", line 32, in refresh_tokens
    self.session.async_ensure_token_valid(), self.hass.loop
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 413, in async_ensure_token_valid
    new_token = await self.implementation.async_refresh_token(self.token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 78, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/cloud/account_link.py", line 143, in _async_refresh_token
    self.hass.data[DOMAIN], self.service, token["refresh_token"]
  File "/srv/homeassistant/lib/python3.7/site-packages/hass_nabucasa/account_link.py", line 112, in async_fetch_access_token
    resp.raise_for_status()
  File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 946, in raise_for_status
    headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 504, message='Gateway Time-out', url='https://account-link.nabucasa.com/refresh_token/netatmo
2020-04-11 13:49:40 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.netatmo_netatmo_indoor_co2 fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 129, in query
    rsp = self._oauth.post(url=url, data=params, timeout=timeout)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/srv/homeassistant/lib/python3.7/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 "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 225, in update
    self.netatmo_data.update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 550, in update
    self.station_data = self.station_data.__class__(self.auth)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/weather_station.py", line 24, in __init__
    resp = self.authData.post_request(url=self.urlReq)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 143, in post_request
    resp = query(url, params, timeout, 3)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 137, in query
    self._oauth.token = self.refresh_tokens()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/api.py", line 32, in refresh_tokens
    self.session.async_ensure_token_valid(), self.hass.loop
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 413, in async_ensure_token_valid
    new_token = await self.implementation.async_refresh_token(self.token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 78, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/cloud/account_link.py", line 143, in _async_refresh_token
    self.hass.data[DOMAIN], self.service, token["refresh_token"]
  File "/srv/homeassistant/lib/python3.7/site-packages/hass_nabucasa/account_link.py", line 112, in async_fetch_access_token
    resp.raise_for_status()
  File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 946, in raise_for_status
    headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 504, message='Gateway Time-out', url='https://account-link.nabucasa.com/refresh_token/netatmo
2020-04-11 13:50:40 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.netatmo_netatmo_indoor_humidity fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 129, in query
    rsp = self._oauth.post(url=url, data=params, timeout=timeout)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/srv/homeassistant/lib/python3.7/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 "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 225, in update
    self.netatmo_data.update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 550, in update
    self.station_data = self.station_data.__class__(self.auth)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/weather_station.py", line 24, in __init__
    resp = self.authData.post_request(url=self.urlReq)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 143, in post_request
    resp = query(url, params, timeout, 3)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 137, in query
    self._oauth.token = self.refresh_tokens()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/api.py", line 32, in refresh_tokens
    self.session.async_ensure_token_valid(), self.hass.loop
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 413, in async_ensure_token_valid
    new_token = await self.implementation.async_refresh_token(self.token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 78, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/cloud/account_link.py", line 143, in _async_refresh_token
    self.hass.data[DOMAIN], self.service, token["refresh_token"]
  File "/srv/homeassistant/lib/python3.7/site-packages/hass_nabucasa/account_link.py", line 112, in async_fetch_access_token
    resp.raise_for_status()
  File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 946, in raise_for_status
    headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 504, message='Gateway Time-out', url='https://account-link.nabucasa.com/refresh_token/netatmo
2020-04-11 14:10:45 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal read error on socket transport
Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/selector_events.py", line 801, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
TimeoutError: [Errno 110] Connection timed out
2020-04-11 14:24:46 ERROR (SyncWorker_2) [homeassistant.components.recorder.util] Error executing query: (sqlite3.OperationalError) database is locked
(Background on this error at: http://sqlalche.me/e/e3q8)
2020-04-11 14:35:05 ERROR (SyncWorker_15) [homeassistant.components.recorder.util] Error executing query: (sqlite3.OperationalError) database is locked
(Background on this error at: http://sqlalche.me/e/e3q8)
2020-04-11 14:35:07 ERROR (MainThread) [homeassistant.components.webhook] Error processing webhook 9b9cceb4bcd1883ec9b7c24f0dacab85b67d25bbdf9315a6180290ddb1180f17
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/webhook/__init__.py", line 77, in async_handle_webhook
    response = await webhook["handler"](hass, webhook_id, request)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/mobile_app/webhook.py", line 186, in handle_webhook
    return await WEBHOOK_COMMANDS[webhook_type](hass, config_entry, webhook_payload)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/mobile_app/webhook.py", line 131, in validate_and_run
    return await func(hass, config_entry, data)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/mobile_app/webhook.py", line 439, in webhook_update_sensor_states
    await hass.data[DOMAIN][DATA_STORE].async_save(safe)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/storage.py", line 136, in async_save
    await self._async_handle_write_data()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/storage.py", line 197, in _async_handle_write_data
    self._write_data, self.path, data
concurrent.futures._base.CancelledError
2020-04-11 14:45:05 ERROR (SyncWorker_16) [homeassistant.components.recorder.util] Error executing query: (sqlite3.OperationalError) database is locked
(Background on this error at: http://sqlalche.me/e/e3q8)
2020-04-11 15:07:34 ERROR (SyncWorker_15) [homeassistant.components.recorder.util] Error executing query: (sqlite3.OperationalError) database is locked
(Background on this error at: http://sqlalche.me/e/e3q8)
2020-04-11 16:58:00 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.netatmo_netatmo_indoor_temperature fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 129, in query
    rsp = self._oauth.post(url=url, data=params, timeout=timeout)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/srv/homeassistant/lib/python3.7/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 "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 225, in update
    self.netatmo_data.update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 550, in update
    self.station_data = self.station_data.__class__(self.auth)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/weather_station.py", line 24, in __init__
    resp = self.authData.post_request(url=self.urlReq)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 143, in post_request
    resp = query(url, params, timeout, 3)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 137, in query
    self._oauth.token = self.refresh_tokens()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/api.py", line 32, in refresh_tokens
    self.session.async_ensure_token_valid(), self.hass.loop
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 413, in async_ensure_token_valid
    new_token = await self.implementation.async_refresh_token(self.token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 78, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/cloud/account_link.py", line 143, in _async_refresh_token
    self.hass.data[DOMAIN], self.service, token["refresh_token"]
  File "/srv/homeassistant/lib/python3.7/site-packages/hass_nabucasa/account_link.py", line 112, in async_fetch_access_token
    resp.raise_for_status()
  File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 946, in raise_for_status
    headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 504, message='Gateway Time-out', url='https://account-link.nabucasa.com/refresh_token/netatmo
2020-04-11 16:59:00 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.netatmo_netatmo_indoor_co2 fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 129, in query
    rsp = self._oauth.post(url=url, data=params, timeout=timeout)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/srv/homeassistant/lib/python3.7/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 "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 225, in update
    self.netatmo_data.update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 550, in update
    self.station_data = self.station_data.__class__(self.auth)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/weather_station.py", line 24, in __init__
    resp = self.authData.post_request(url=self.urlReq)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 143, in post_request
    resp = query(url, params, timeout, 3)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 137, in query
    self._oauth.token = self.refresh_tokens()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/api.py", line 32, in refresh_tokens
    self.session.async_ensure_token_valid(), self.hass.loop
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 413, in async_ensure_token_valid
    new_token = await self.implementation.async_refresh_token(self.token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 78, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/cloud/account_link.py", line 143, in _async_refresh_token
    self.hass.data[DOMAIN], self.service, token["refresh_token"]
  File "/srv/homeassistant/lib/python3.7/site-packages/hass_nabucasa/account_link.py", line 112, in async_fetch_access_token
    resp.raise_for_status()
  File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 946, in raise_for_status
    headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 504, message='Gateway Time-out', url='https://account-link.nabucasa.com/refresh_token/netatmo
2020-04-11 17:00:00 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.netatmo_netatmo_indoor_humidity fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 129, in query
    rsp = self._oauth.post(url=url, data=params, timeout=timeout)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/srv/homeassistant/lib/python3.7/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 "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 225, in update
    self.netatmo_data.update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 550, in update
    self.station_data = self.station_data.__class__(self.auth)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/weather_station.py", line 24, in __init__
    resp = self.authData.post_request(url=self.urlReq)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 143, in post_request
    resp = query(url, params, timeout, 3)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 137, in query
    self._oauth.token = self.refresh_tokens()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/api.py", line 32, in refresh_tokens
    self.session.async_ensure_token_valid(), self.hass.loop
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 413, in async_ensure_token_valid
    new_token = await self.implementation.async_refresh_token(self.token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 78, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/cloud/account_link.py", line 143, in _async_refresh_token
    self.hass.data[DOMAIN], self.service, token["refresh_token"]
  File "/srv/homeassistant/lib/python3.7/site-packages/hass_nabucasa/account_link.py", line 112, in async_fetch_access_token
    resp.raise_for_status()
  File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 946, in raise_for_status
    headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 504, message='Gateway Time-out', url='https://account-link.nabucasa.com/refresh_token/netatmo
2020-04-11 17:01:00 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.netatmo_netatmo_indoor_noise fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 129, in query
    rsp = self._oauth.post(url=url, data=params, timeout=timeout)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/srv/homeassistant/lib/python3.7/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 "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 225, in update
    self.netatmo_data.update()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/sensor.py", line 550, in update
    self.station_data = self.station_data.__class__(self.auth)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/weather_station.py", line 24, in __init__
    resp = self.authData.post_request(url=self.urlReq)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 143, in post_request
    resp = query(url, params, timeout, 3)
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 137, in query
    self._oauth.token = self.refresh_tokens()
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/netatmo/api.py", line 32, in refresh_tokens
    self.session.async_ensure_token_valid(), self.hass.loop
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 413, in async_ensure_token_valid
    new_token = await self.implementation.async_refresh_token(self.token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/config_entry_oauth2_flow.py", line 78, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/cloud/account_link.py", line 143, in _async_refresh_token
    self.hass.data[DOMAIN], self.service, token["refresh_token"]
  File "/srv/homeassistant/lib/python3.7/site-packages/hass_nabucasa/account_link.py", line 112, in async_fetch_access_token
    resp.raise_for_status()
  File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 946, in raise_for_status
    headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 504, message='Gateway Time-out', url='https://account-link.nabucasa.com/refresh_token/netatmo
2020-04-11 17:02:01 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.netatmo_netatmo_indoor_pressure fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/pyatmo/auth.py", line 129, in query
    rsp = self._oauth.post(url=url, data=params, timeout=timeout)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/srv/homeassistant/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token
    raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) 

I have the same issue, only having the Netatmo Weather Station, configured via integration (ie not via configuration.yaml). The typical error messages that are filling up the HA log :

2020-04-17 01:30:38 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.netatmo_indoor_temperature fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pyatmo/auth.py", line 129, in query
    rsp = self._oauth.post(url=url, data=params, timeout=timeout)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/usr/local/lib/python3.7/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/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/sensor.py", line 225, in update
    self.netatmo_data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/sensor.py", line 550, in update
    self.station_data = self.station_data.__class__(self.auth)
  File "/usr/local/lib/python3.7/site-packages/pyatmo/weather_station.py", line 24, in __init__
    resp = self.authData.post_request(url=self.urlReq)
  File "/usr/local/lib/python3.7/site-packages/pyatmo/auth.py", line 143, in post_request
    resp = query(url, params, timeout, 3)
  File "/usr/local/lib/python3.7/site-packages/pyatmo/auth.py", line 137, in query
    self._oauth.token = self.refresh_tokens()
  File "/usr/src/homeassistant/homeassistant/components/netatmo/api.py", line 32, in refresh_tokens
    self.session.async_ensure_token_valid(), self.hass.loop
  File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 435, in result
    return self.__get_result()
  File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 413, 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 78, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/usr/src/homeassistant/homeassistant/components/cloud/account_link.py", line 143, in _async_refresh_token
    self.hass.data[DOMAIN], self.service, token["refresh_token"]
  File "/usr/local/lib/python3.7/site-packages/hass_nabucasa/account_link.py", line 112, in async_fetch_access_token
    resp.raise_for_status()
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 946, in raise_for_status
    headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 504, message='Gateway Time-out', url='https://account-link.nabucasa.com/refresh_token/netatmo

Just to understand this correctly, does the integration itself work and “just” spam the logs or does it actually fail in general?

only spam but not sure

Well, do you get values from you station? :grin:

Yes Yes! The values from the station are ok! :smile:

1 Like

Ok. I try to not forget it. But if you already have an account on GitHub I’d appreciate an issue in that topic.

I’m noob on github. I hope it’s ok:
issue

1 Like

Great, thanks

Hm, you wrote in the issue that Netatmo stopped working but here you wrote that it updates fine but just logs errors? Which is the case?

sorry I changed now the title topic…,

1 Like