Netatmo integration stopped working after update

Hi,

after updating to 2022.9.6 two days ago my netatmo integration stopped working.

here my current system data:

Home Assistant 2022.9.6
Supervisor 2022.09.1
Operating System 9.0
Frontend 20220907.2 - latest

I have the following error messages in the log:

2022-09-22 15:00:51.649 INFO (SyncWorker_2) [homeassistant.loader] Loaded netatmo from homeassistant.components.netatmo

2022-09-22 15:01:17.496 ERROR (MainThread) [homeassistant.components.homekit] HomeKit Netatmo Kamera Flur cannot startup: entity not available: {'include_domains': [], 'exclude_domains': [], 'include_entities': ['camera.netatmo_kamera_flur'], 'exclude_entities': [], 'exclude_entity_globs': [], 'include_entity_globs': []}

2022-09-22 15:02:00.975 INFO (MainThread) [homeassistant.components.netatmo.config_flow] Successfully authenticated

2022-09-22 15:02:00.981 INFO (MainThread) [homeassistant.setup] Setting up netatmo

2022-09-22 15:02:00.981 INFO (MainThread) [homeassistant.setup] Setup of domain netatmo took 0.0 seconds

2022-09-22 15:02:04.519 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Home Assistant Cloud for netatmo

File "/usr/src/homeassistant/homeassistant/components/netatmo/__init__.py", line 153, in async_setup_entry

File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 108, in async_setup

File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 204, in subscribe

File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 164, in async_fetch_data

Before the update everything was working perfectly.
Meanwhile I even reinstalled the integration (I suppose that was a stupid idea). Anyone with some ideas?

Regards
Oliver

By the looks of it this is not the full error/backtrace. Please check the logs and provide the complete error message to debug this.

Hi,

when reloading Netatmo I get the following log lines:

2022-09-25 21:18:41.323 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Home Assistant Cloud for netatmo
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect
    return await fut
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('169.254.123.197', 80)
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 357, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/__init__.py", line 153, in async_setup_entry
    await data_handler.async_setup()
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 108, in async_setup
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 204, in subscribe
    await self.async_fetch_data(signal_name)
  File "/usr/src/homeassistant/homeassistant/components/netatmo/data_handler.py", line 164, in async_fetch_data
    await self.data[signal_name].async_update()
  File "/usr/local/lib/python3.10/site-packages/pyatmo/camera.py", line 649, in async_update
    await self._async_update_all_camera_urls()
  File "/usr/local/lib/python3.10/site-packages/pyatmo/camera.py", line 659, in _async_update_all_camera_urls
    await self.async_update_camera_urls(camera_id)
  File "/usr/local/lib/python3.10/site-packages/pyatmo/camera.py", line 724, in async_update_camera_urls
    ] = await self._async_check_url(
  File "/usr/local/lib/python3.10/site-packages/pyatmo/camera.py", line 731, in _async_check_url
    resp = await self.auth.async_post_request(url=f"{url}/command/ping")
  File "/usr/local/lib/python3.10/site-packages/pyatmo/auth.py", line 335, in async_post_request
    async with self.websession.post(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1138, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 169.254.123.197:80 ssl:default [Connect call failed ('169.254.123.197', 80)]

The IP address appears strange?!

Regards
Oliver

Please reboot your cameras to solve this issue.

Hi, that really did the job, would you please be so kind and add some explanation? I don’t want to die stupid. How come the ****** camera is preventing the integration from loading?

Regards
Oliver

For some reason the API has an invalid IP address that can’t be resolved. Should this issue come back with the next version of HA I need to investigate this further. So far I was not able to reproduce this issue in any of my environments.

Hi, I have this topic quit often. Happy to help here out with logs. Even you don’t reboot the devices the problem will be fixed in 2 to 3 days.
I reboot my ha instance quit often in one day. The problem is occurring seasonal all few weeks.
Weather, 4 presence and 2 welcome. The welcome seem to be the problem, for a couple of weeks I had only weather and 3 presence online, there wasn’t any issue.
But at all I have no access to the lights (nabu casa Remote Access is in place).
Pls let me know if you need traces or something else in the moment of this error.
Happy to help!

I cant control my cameras (and tried reboot them, with no luck) - how can it be fixed?
(wind and rain gauge work as i should be.)

HA 2022.10.2

Logger: homeassistant.components.stream.stream.camera.netatmo_udendors_kamera_2
Source: components/stream/init.py:428
Integration: Stream (documentation, issues)
First occurred: 18.19.42 (2 occurrences)
Last logged: 18.19.52

Error from stream worker: Error opening stream (HTTP_FORBIDDEN, Server returned 403 Forbidden (access denied)) http://192.168.1.19/ff853006e47009e929958e023/live/files/high/index.m3u8

Please provide debug logs and diagnostics to inspect.

how to find debug logs ?

(some times i can turn them off)

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.10.3",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "aarch64",
    "timezone": "Europe/Copenhagen",
    "os_name": "Linux",
    "os_version": "5.15.72",
    "supervisor": "2022.10.0",
    "host_os": "Home Assistant OS 9.2",
    "docker_version": "20.10.17",
    "chassis": "embedded",
    "run_as_root": true

  "integration_manifest": {
    "domain": "netatmo",
    "name": "Netatmo",
    "documentation": "https://www.home-assistant.io/integrations/netatmo",
    "requirements": [
      "pyatmo==7.1.1"
    ],
    "after_dependencies": [
      "cloud",
      "media_source"
    ],
    "dependencies": [
      "application_credentials",
      "webhook"
    ],
    "codeowners": [
      "@cgtobi"
    ],
    "config_flow": true,
    "homekit": {
      "models": [
        "Healty Home Coach",
        "Netatmo Relay",
        "Presence",
        "Welcome"
      ]
    },
    "iot_class": "cloud_polling",
    "loggers": [
      "pyatmo"
    ],
    "supported_brands": {
      "legrand": "Legrand",
      "bubendorff": "Bubendorff",
      "smarther": "Smarther",
      "bticino": "BTicino"
    },
    "is_built_in": true
  },
  "data": {
    "info": {
      "entry_id": "978c7e95ad70a1ad0d61256c8bd515dd",
      "version": 1,
      "domain": "netatmo",
      "title": "Configuration.yaml",
      "data": {
        "auth_implementation": "netatmo",
        "token": {
          "scope": [
            "access_camera",
            "access_presence",
            "read_camera",
            "read_homecoach",
            "read_presence",
            "read_smokedetector",
            "read_station",
            "read_thermostat",
            "write_camera",
            "write_presence",
            "write_thermostat"
          ],
          "access_token": "**REDACTED**",
          "refresh_token": "**REDACTED**",
          "expires_in": 10800,
          "expire_in": 10800,
          "restricted_access_token": "**REDACTED**",
          "restricted_refresh_token": "**REDACTED**",
          "expires_at": 1665643331.1620765
        },
        "webhook_id": "**REDACTED**",
        "cloudhook_url": "**REDACTED**"
      },
      "options": {
        "weather_areas": {}
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": "netatmo",
      "disabled_by": null,
      "webhook_registered": true
    },
    "data": {
      "account": {
        "homes": [
          {
            "id": "5bd1d77b2d3e0417008b52db",
            "name": "**REDACTED**",
            "altitude": 12,
            "coordinates": "**REDACTED**",
            "country": "DK",
            "timezone": "Europe/Copenhagen",
            "modules": [
              {
                "id": "70:ee:50:27:5d:c8",
                "type": "NAMain",
                "setup_date": 1613489026,
                "modules_bridged": [
                  "03:00:00:07:2c:f0",
                  "02:00:00:27:32:2a",
                  "05:00:00:06:30:24",
                  "06:00:00:06:11:a0"
                ]
              },
              {
                "id": "03:00:00:07:2c:f0",
                "type": "NAModule4",
                "name": "**REDACTED**",
                "setup_date": 1613489027,
                "bridge": "70:ee:50:27:5d:c8"
              },
              {
                "id": "02:00:00:27:32:2a",
                "type": "NAModule1",
                "name": "**REDACTED**",
                "setup_date": 1613489027,
                "bridge": "70:ee:50:27:5d:c8"
              },
              {
                "id": "05:00:00:06:30:24",
                "type": "NAModule3",
                "name": "**REDACTED**",
                "setup_date": 1628605437,
                "bridge": "70:ee:50:27:5d:c8"
              },
              {
                "id": "06:00:00:06:11:a0",
                "type": "NAModule2",
                "name": "**REDACTED**",
                "setup_date": 1646322575,
                "bridge": "70:ee:50:27:5d:c8"
              },
              {
                "id": "70:ee:50:59:9c:1c",
                "type": "NOC",
                "name": "**REDACTED**",
                "setup_date": 1576948564
              },
              {
                "id": "70:ee:50:30:3a:6e",
                "type": "NOC",
                "name": "**REDACTED**",
                "setup_date": 1584114474
              },
              {
                "id": "70:ee:50:3a:9a:c4",
                "type": "NOC",
                "name": "**REDACTED**",
                "setup_date": 1584277701
              },
              {
                "id": "70:ee:50:30:e6:79",
                "type": "NACamera",
                "name": "**REDACTED**",
                "setup_date": 1584015370
              }
            ],
            "persons": [
              {
                "id": "1f2f89ba-3335-476d-9614-4c7cc90e1a8b",
                "pseudo": "**REDACTED**",
                "url": "**REDACTED**"
              },
              {
                "id": "c6616258-ea1e-4f8f-9fe4-65aefb5e6cb9",
                "pseudo": "**REDACTED**",
                "url": "**REDACTED**"
              },
              {
                "id": "85570fe5-12e4-4fcc-ab8d-fe149267ddfe",
                "pseudo": "**REDACTED**",
                "url": "**REDACTED**"
              },
              {
                "id": "d6756706-a3d6-4a53-b849-519b647bb360",
                "pseudo": "**REDACTED**",
                "url": "**REDACTED**"
              }
            ]
          }
        ],
        "errors": []
      }
    }
  }
}

This bug was finally resolved for me only by using a beta integration via HACS

The beta integration should currently have the same state as the official release. Please let me know if the issue persists with that.

any news about this issue?