home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.44k stars 30.67k forks source link

Netatmo integration broke #51618

Closed oleg-78 closed 3 years ago

oleg-78 commented 3 years ago

The problem

Hello. After updating to the new version, core-2021.6.3, Netatmo integration does not work. All entities are unavailable. I tried to remove the integration and reboot, then installed it again. I tried both methods - through the cloud and through the configuration file in which the id and token are indicated. But no luck.

Log Details include.

What is version of Home Assistant Core has the issue?

core-2021.6.3

What was the last working version of Home Assistant Core?

core-2021.5.4

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Netatmo

Link to integration documentation on our website

https://www.home-assistant.io/integrations/netatmo/

Example YAML snippet

netatmo:
  client_id: хххxxxxxxxxxxxxxxx
  client_secret: xxxxxxxxxxxxxxx

Anything in the logs that might be useful for us?

Logger: homeassistant.components.sensor
Source: components/netatmo/data_handler.py:139
Integration: Sensor (documentation, issues)
First occurred: 9:45:09 AM (3 occurrences)
Last logged: 1:40:31 PM

Error while setting up netatmo platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/sensor.py", line 183, in async_setup_entry
    await data_handler.register_data_class(data_class_name, data_class_name, None)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 181, in register_data_class
    await self.async_fetch_data(data_class_entry)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 139, in async_fetch_data
    await self.data[data_class_entry].async_update()
  File "/usr/local/lib/python3.8/site-packages/pyatmo/weather_station.py", line 334, in async_update
    resp = await self.auth.async_post_request(url=self.url_req)
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
    if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'

Logger: homeassistant.components.climate
Source: components/netatmo/data_handler.py:139
Integration: Climate (documentation, issues)
First occurred: 9:45:09 AM (3 occurrences)
Last logged: 1:40:31 PM

Error while setting up netatmo platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/climate.py", line 114, in async_setup_entry
    await data_handler.register_data_class(
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 181, in register_data_class
    await self.async_fetch_data(data_class_entry)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 139, in async_fetch_data
    await self.data[data_class_entry].async_update()
  File "/usr/local/lib/python3.8/site-packages/pyatmo/thermostat.py", line 146, in async_update
    resp = await self.auth.async_post_request(url=_GETHOMESDATA_REQ)
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
    if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'

Logger: homeassistant.config_entries
Source: components/netatmo/__init__.py:190
First occurred: 1:39:07 PM (2 occurrences)
Last logged: 1:40:31 PM

Error setting up entry Configuration.yaml for netatmo
Error setting up entry Home Assistant Cloud for netatmo
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/netatmo/__init__.py", line 200, in async_setup_entry
    await register_webhook(None)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/__init__.py", line 190, in register_webhook
    await hass.data[DOMAIN][entry.entry_id][AUTH].async_addwebhook(webhook_url)
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 349, in async_addwebhook
    resp = await self.async_post_request(WEBHOOK_URL_ADD, {"url": webhook_url})
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
    if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'

Hello, I enabled logging for Netatmo component and tried to install the component again. Below is the log.

2021-06-29 11:16:51 INFO (MainThread) [homeassistant.components.netatmo.config_flow] Successfully authenticated
2021-06-29 11:16:51 INFO (MainThread) [homeassistant.components.camera] Setting up camera.netatmo
2021-06-29 11:16:51 INFO (MainThread) [homeassistant.components.climate] Setting up climate.netatmo
2021-06-29 11:16:51 INFO (MainThread) [homeassistant.components.light] Setting up light.netatmo
2021-06-29 11:16:51 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.netatmo
2021-06-29 11:16:51 WARNING (MainThread) [homeassistant.components.light] Platform netatmo not ready yet: None; Retrying in background in 30 seconds
2021-06-29 11:16:51 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Configuration.yaml for netatmo
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/netatmo/init.py", line 200, in async_setup_entry
await register_webhook(None)
File "/usr/src/homeassistant/homeassistant/components/netatmo/init.py", line 190, in register_webhook
await hass.data[DOMAIN][entry.entry_id][AUTH].async_addwebhook(webhook_url)
File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 349, in async_addwebhook
resp = await self.async_post_request(WEBHOOK_URL_ADD, {"url": webhook_url})
File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'
2021-06-29 11:16:51 ERROR (MainThread) [homeassistant.components.camera] Error while setting up netatmo platform for camera
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/netatmo/camera.py", line 55, in async_setup_entry
await data_handler.register_data_class(
File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 181, in register_data_class
await self.async_fetch_data(data_class_entry)
File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 139, in async_fetch_data
await self.data[data_class_entry].async_update()
File "/usr/local/lib/python3.8/site-packages/pyatmo/camera.py", line 595, in async_update
resp = await self.auth.async_post_request(
File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'
2021-06-29 11:16:51 ERROR (MainThread) [homeassistant.components.climate] Error while setting up netatmo platform for climate
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/netatmo/climate.py", line 114, in async_setup_entry
await data_handler.register_data_class(
File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 181, in register_data_class
await self.async_fetch_data(data_class_entry)
File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 139, in async_fetch_data
await self.data[data_class_entry].async_update()
File "/usr/local/lib/python3.8/site-packages/pyatmo/thermostat.py", line 146, in async_update
resp = await self.auth.async_post_request(url=_GETHOMESDATA_REQ)
File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'
2021-06-29 11:16:51 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up netatmo platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/netatmo/sensor.py", line 183, in async_setup_entry
await data_handler.register_data_class(data_class_name, data_class_name, None)
File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 181, in register_data_class
await self.async_fetch_data(data_class_entry)
File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 139, in async_fetch_data
await self.data[data_class_entry].async_update()
File "/usr/local/lib/python3.8/site-packages/pyatmo/weather_station.py", line 334, in async_update
resp = await self.auth.async_post_request(url=self.url_req)
File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'

2021-06-29 11:17:21 DEBUG (MainThread) [homeassistant.components.netatmo] Unregister Netatmo webhook (b6de3f7977a94310552bc50e31f0f989020e3f40bf07b22b21b20d136a922f10)
2021-06-29 11:17:21 INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook unregistered
2021-06-29 11:17:21 INFO (MainThread) [homeassistant.components.light] Setting up light.netatmo
2021-06-29 11:17:21 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/netatmo/init.py", line 134, in unregister_webhook
await hass.data[DOMAIN][entry.entry_id][AUTH].async_dropwebhook()
File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 354, in async_dropwebhook
resp = await self.async_post_request(
File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'

Additional information

_No response_

probot-home-assistant[bot] commented 3 years ago

netatmo documentation netatmo source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @cgtobi, mind taking a look at this issue as its been labeled with an integration (netatmo) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

cgtobi commented 3 years ago

Thanks for reporting. I'll take a look ASAP.

msanchezt commented 3 years ago

Has anyone been able to have a look at this? Any idea what changed?

Klaveness commented 3 years ago

I have the same issue

cgtobi commented 3 years ago

I won't be able to fix this before next week.

cgtobi commented 3 years ago

Unfortunately I am not able to reproduce this issue. Please provide me with more information about your components and setup or reach out to me on Discord to debug this.

oleg-78 commented 3 years ago

Hello, I enabled logging for Netatmo component and tried to install the component again. Below is the log.

2021-06-29 11:16:51 INFO (MainThread) [homeassistant.components.netatmo.config_flow] Successfully authenticated
2021-06-29 11:16:51 INFO (MainThread) [homeassistant.components.camera] Setting up camera.netatmo
2021-06-29 11:16:51 INFO (MainThread) [homeassistant.components.climate] Setting up climate.netatmo
2021-06-29 11:16:51 INFO (MainThread) [homeassistant.components.light] Setting up light.netatmo
2021-06-29 11:16:51 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.netatmo
2021-06-29 11:16:51 WARNING (MainThread) [homeassistant.components.light] Platform netatmo not ready yet: None; Retrying in background in 30 seconds
2021-06-29 11:16:51 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Configuration.yaml for netatmo
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/netatmo/__init__.py", line 200, in async_setup_entry
    await register_webhook(None)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/__init__.py", line 190, in register_webhook
    await hass.data[DOMAIN][entry.entry_id][AUTH].async_addwebhook(webhook_url)
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 349, in async_addwebhook
    resp = await self.async_post_request(WEBHOOK_URL_ADD, {"url": webhook_url})
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
    if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'
2021-06-29 11:16:51 ERROR (MainThread) [homeassistant.components.camera] Error while setting up netatmo platform for camera
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/camera.py", line 55, in async_setup_entry
    await data_handler.register_data_class(
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 181, in register_data_class
    await self.async_fetch_data(data_class_entry)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 139, in async_fetch_data
    await self.data[data_class_entry].async_update()
  File "/usr/local/lib/python3.8/site-packages/pyatmo/camera.py", line 595, in async_update
    resp = await self.auth.async_post_request(
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
    if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'
2021-06-29 11:16:51 ERROR (MainThread) [homeassistant.components.climate] Error while setting up netatmo platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/climate.py", line 114, in async_setup_entry
    await data_handler.register_data_class(
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 181, in register_data_class
    await self.async_fetch_data(data_class_entry)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 139, in async_fetch_data
    await self.data[data_class_entry].async_update()
  File "/usr/local/lib/python3.8/site-packages/pyatmo/thermostat.py", line 146, in async_update
    resp = await self.auth.async_post_request(url=_GETHOMESDATA_REQ)
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
    if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'
2021-06-29 11:16:51 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up netatmo platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/sensor.py", line 183, in async_setup_entry
    await data_handler.register_data_class(data_class_name, data_class_name, None)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 181, in register_data_class
    await self.async_fetch_data(data_class_entry)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 139, in async_fetch_data
    await self.data[data_class_entry].async_update()
  File "/usr/local/lib/python3.8/site-packages/pyatmo/weather_station.py", line 334, in async_update
    resp = await self.auth.async_post_request(url=self.url_req)
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
    if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'

2021-06-29 11:17:21 DEBUG (MainThread) [homeassistant.components.netatmo] Unregister Netatmo webhook (b6de3f7977a94310552bc50e31f0f989020e3f40bf07b22b21b20d136a922f10)
2021-06-29 11:17:21 INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook unregistered
2021-06-29 11:17:21 INFO (MainThread) [homeassistant.components.light] Setting up light.netatmo
2021-06-29 11:17:21 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/netatmo/__init__.py", line 134, in unregister_webhook
    await hass.data[DOMAIN][entry.entry_id][AUTH].async_dropwebhook()
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 354, in async_dropwebhook
    resp = await self.async_post_request(
  File "/usr/local/lib/python3.8/site-packages/pyatmo/auth.py", line 317, in async_post_request
    if not resp.ok:
AttributeError: 'ClientResponse' object has no attribute 'ok'
cgtobi commented 3 years ago

Unfortunately this does not shed more light on the issue and I can't reproduce it locally. Do you use the HA Cloud Link or your individual netatmo dev account? If possible please contact me on Discord to dive deeper.

cgtobi commented 3 years ago

After a chat with @oleg-78 this issue seems to be caused by one (or more) custom components as he was not able to reproduce this problem with a freshly set up HA instance. If you have the same error please check whether you use custom components and try to find out which causes interference.

Klaveness commented 3 years ago

I performed quite a bit of reconfiguration to my solution (and also re-installed the integration), and like the morning dew, the issue was suddenly gone :-)

cgtobi commented 3 years ago

I'll close this issue as this has been resolved without clear indication what might have caused the breakage.