Netatmo Outdoor Lights are unavailable in Home Assistant

Hello,
I have Nabu Casa enables for my home assistant. I have configured the Netatmo component and created an app over at dev.netatmo.com. The app is activated and the webhook has a green check mark.

I also configured the secret key and client id in config yaml file. The logs say this:

2022-03-24 18:39:12 INFO (MainThread) [homeassistant.components.netatmo.config_flow] Successfully authenticated

2022-03-24 18:39:13 INFO (MainThread) [homeassistant.components.camera] Setting up camera.netatmo

2022-03-24 18:39:13 INFO (MainThread) [homeassistant.components.climate] Setting up climate.netatmo

2022-03-24 18:39:13 INFO (MainThread) [homeassistant.components.light] Setting up light.netatmo

2022-03-24 18:39:13 INFO (MainThread) [homeassistant.components.select] Setting up select.netatmo

2022-03-24 18:39:13 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.netatmo

2022-03-24 18:39:13 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new camera.netatmo entity: camera.netatmo_backyard_camera

2022-03-24 18:39:13 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new camera.netatmo entity: camera.netatmo_front_yard_camera

2022-03-24 18:39:13 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.netatmo entity: light.netatmo_backyard_camera

2022-03-24 18:39:13 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new light.netatmo entity: light.netatmo_front_yard_camera

2022-03-24 18:39:13 WARNING (MainThread) [homeassistant.components.sensor] Platform netatmo not ready yet: None; Retrying in background in 30 seconds

2022-03-24 18:39:14 INFO (MainThread) [homeassistant.components.netatmo] Register Netatmo webhook: https://hooks.nabu.casa/XXXXXXXXSOME LONG KEY

However, the lights for both of my camera remain unavailable.

Thanks,
Dave

Attaching my config.

Looks like for some reason the webhook did not register successfully. Please unregister and re-register the webhook manually via the service.

Thanks. I am not too sure how to unregister and register the webhook manually. Can you provide more instruction? I looked in Nabu Casa config where the webhook is defined but I don’t see any way to unregister it. Thanks again.

You’ll find that under Developer Tools: Services → Netatmo: Unregister webhook and Netatmo: Register webhook

I have the same issue. I do not use Nabu Casa, but a Reverse Proxy and a custom app in dev.netatmo.com. I added the reverse proxy configuration to the http integration and added my URL under Settings->Network->Home Assistant URL. The exposed port to the Internet is 443. I followed the steps to unban my webhook, since it has been banned.
In the following logs I replaced sensitive information
unregister:

2022-05-11 10:46:06 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547608488592] Received {'type': 'execute_script', 'sequence': [{'service': 'netatmo.unregister_webhook', 'data': {}}], 'id': 102}
2022-05-11 10:46:06 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2022-05-11 10:46:06 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2022-05-11 10:46:06 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=netatmo, service=unregister_webhook, service_data=>
2022-05-11 10:46:06 DEBUG (MainThread) [homeassistant.components.netatmo] Unregister Netatmo webhook (<ID>)
2022-05-11 10:46:06 INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook unregistered
2022-05-11 10:46:06 DEBUG (Recorder) [homeassistant.components.recorder] Processing task: EventTask(event=<Event call_service[L]: domain=netatmo, service=unregister_webhook, service_data=>)
2022-05-11 10:46:06 DEBUG (MainThread) [pyatmo.auth] dropwebhook: <ClientResponse(https://api.netatmo.com/api/dropwebhook) [200 OK]>
<CIMultiDictProxy('Server': 'nginx', 'Date': 'Wed, 11 May 2022 08:46:06 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache, must-revalidate', 'Expires': '0', 'X-XSS-Protection': '1; mode=block', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Powered-By': 'Netatmo')>

2022-05-11 10:46:06 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547608488592] Sending {"id":102,"type":"result","success":true,"result":{"context":{"id":"<ID>","parent_id":null,"user_id":"<ID>"}}}

I unbanned the Webhook and register again:

2022-05-11 10:48:09 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547608488592] Received {'type': 'execute_script', 'sequence': [{'service': 'netatmo.register_webhook', 'data': {}}], 'id': 103}
2022-05-11 10:48:09 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2022-05-11 10:48:09 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2022-05-11 10:48:09 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=netatmo, service=register_webhook, service_data=>
2022-05-11 10:48:09 DEBUG (Recorder) [homeassistant.components.recorder] Processing task: EventTask(event=<Event call_service[L]: domain=netatmo, service=register_webhook, service_data=>)
2022-05-11 10:48:09 DEBUG (MainThread) [pyatmo.auth] addwebhook: <ClientResponse(https://api.netatmo.com/api/addwebhook) [200 OK]>
<CIMultiDictProxy('Server': 'nginx', 'Date': 'Wed, 11 May 2022 08:48:09 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache, must-revalidate', 'Expires': '0', 'X-XSS-Protection': '1; mode=block', 'Access-Control-Allow-Origin': '*', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Powered-By': 'Netatmo')>

2022-05-11 10:48:09 INFO (MainThread) [homeassistant.components.netatmo] Register Netatmo webhook: https://<URL>/api/webhook/<ID>
2022-05-11 10:48:09 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547608488592] Sending {"id":103,"type":"result","success":true,"result":{"context":{"id":"<ID>","parent_id":null,"user_id":"<ID>"}}}

The Light Switch in the Dashboard stays grey. I tried to call the Set Light-Mode service, but the light does not turn on:

2022-05-11 10:50:30 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547608488592] Received {'type': 'execute_script', 'sequence': [{'service': 'netatmo.set_camera_light', 'data': {'camera_light_mode': 'on'}, 'target': {'entity_id': 'light.netatmo_gartenkamera'}}], 'id': 110}
2022-05-11 10:50:30 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2022-05-11 10:50:30 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2022-05-11 10:50:30 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=netatmo, service=set_camera_light, service_data=camera_light_mode=on, entity_id=['light.netatmo_gartenkamera']>
2022-05-11 10:50:30 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.netatmo_gartenkamera
2022-05-11 10:50:30 DEBUG (Recorder) [homeassistant.components.recorder] Processing task: EventTask(event=<Event call_service[L]: domain=netatmo, service=set_camera_light, service_data=camera_light_mode=on, entity_id=['light.netatmo_gartenkamera']>)
2022-05-11 10:50:30 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547608488592] Sending {"id":110,"type":"result","success":true,"result":{"context":{"id":"<ID>","parent_id":null,"user_id":"<ID>"}}}

HA Details:

Version	core-2022.5.2
Installation Type	Home Assistant OS
Development	false
Supervisor	true
Docker	true
User	root
Virtual Environment	false
Python Version	3.9.9
Operating System Family	Linux
Operating System Version	5.10.103-v8
CPU Architecture	aarch64
Timezone	Europe/Berlin
Home Assistant Community Store
GitHub API	ok
GitHub Content	ok
GitHub Web	ok
GitHub API Calls Remaining	4957
Installed Version	1.24.5
Stage	running
Available Repositories	1123
Downloaded Repositories	6
Home Assistant Cloud
Logged In	false
Reach Certificate Server	ok
Reach Authentication Server	ok
Reach Home Assistant Cloud	ok
Home Assistant Supervisor
Host Operating System	Home Assistant OS 7.6
Update Channel	stable
Supervisor Version	supervisor-2022.05.1
Docker Version	20.10.9
Disk Total	118.5 GB
Disk Used	9.4 GB
Healthy	true
Supported	true
Board	rpi4-64
Supervisor API	ok
Version API	ok
Installed Add-ons	SSH & Web Terminal (10.1.3), Studio Code Server (5.0.2), MariaDB (2.4.0), InfluxDB (4.4.1), Grafana (7.5.2), Samba Backup (5.0.0), Check Home Assistant configuration (3.10.0), Mosquitto broker (6.1.1)

I seem to have the same issue, the control to toggle the floodlight on my camera reports: Unavailable.

I have tried to unregister an register the webhook, but this did not resolve the issue. I have looked in the Netatmo portal in my app if any webhooks were baned, but I don’t see anything.

I have altered debug logs on the homeassistant.components.netatmo, and I can see that events are sent and received through the webhook.

2022-08-12 15:28:45.005 DEBUG (MainThread) [homeassistant.components.netatmo.webhook] Got webhook data: {'user_id': 'xxxxx', 'event_type': 'light_mode', 'device_id': 'xxxxx', 'home_id': 'xxxxx', 'camera_id': 'xxxxx', 'home_name': 'xxxxx', 'sub_type': 'auto', 'push_type': 'NOC-light_mode'}
2022-08-12 15:28:45.006 DEBUG (MainThread) [homeassistant.components.netatmo.webhook] light_mode: {'user_id': 'xxxxx', 'event_type': 'light_mode', 'device_id': 'xxxxx', 'home_id': 'xxxxx', 'camera_id': '70:ee:50:6d:4f:f0', 'home_name': 'xxxxx', 'sub_type': 'auto', 'push_type': 'NOC-light_mode'}

So probably I’m missing something. Is there anything I can do to resolve this issue?

@cgtobi I’m really sorry to mention you, but do you know where I can see my webhooks are banned?

That is visible in the Netatmo dev portal.

Hi,
I have a nabu casa account and the dev.netatmo.com shows unbanned.
But I’m getting the lights not available, what could I do?
I removed the complete integration, credentials etc., no webhook was in HA, nothing in config.
Rebooted, checked the portal, wait for 1h, checked the portal for unbanned.
Integrated netatmo vi integration and web out on the netatmo page, everything beside the lights is working.
What could I check to get the lights working?

Raise the log level for the Netatmo integration to INFO and restart either the integration or HA. Watch the log for Netatmo entries, it should say something like INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook successfully registered . Also make sure that your instance is exposed over port 443 and that the external URL is set correctly.

Is it exposed If I could reach my HA via the nabu casa url?:

Yes, the Nabu Casa remote URL is totally valid.

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

grafik

Logger: homeassistant.config_entries
Source: components/netatmo/data_handler.py:164
First occurred: 08:01:30 (1 occurrences)
Last logged: 08:01:30

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.119.216', 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.119.216:80 ssl:default [Connect call failed ('169.254.119.216', 80)]

logs → supervisor:
no additional netatmo entrys.

after unregister and register (cloud status is unbanned):

Logger: homeassistant.helpers.script.websocket_api_script
Source: components/webhook/__init__.py:46
First occurred: 08:36:13 (1 occurrences)
Last logged: 08:36:13

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Handler is already defined!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/components/netatmo/__init__.py", line 198, in register_webhook
    webhook_register(
  File "/usr/src/homeassistant/homeassistant/components/webhook/__init__.py", line 46, in async_register
    raise ValueError("Handler is already defined!")
ValueError: Handler is already defined!

and

Logger: homeassistant.components.websocket_api.http.connection
Source: components/webhook/__init__.py:46
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 08:36:13 (1 occurrences)
Last logged: 08:36:13

[139906964148416] Error handling message: Unknown error (unknown_error)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 646, in handle_execute_script
    await script_obj.async_run(msg.get("variables"), context=context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/components/netatmo/__init__.py", line 198, in register_webhook
    webhook_register(
  File "/usr/src/homeassistant/homeassistant/components/webhook/__init__.py", line 46, in async_register
    raise ValueError("Handler is already defined!")
ValueError: Handler is already defined!

Thx for your reply!
The web hook was not banned. But it is working again. Ik removed the button from my dashboard and readied it and it works again.

1 Like

For every one where the netatmo outdoor camera lights are not working (and having a Nabu Casa Account / Home Assistant Cloud):

  • Delete the Netatmo integration.
  • reboot HA
  • create a dev.netatmo.com account and app (if already exit one reset the keys!)
  • go to integrations burger / three dot menu application credentials and add the credentials for netamo: Application Credentials - Home Assistant
  • reboot HA
  • go to integrations and add netatmo, (select via configuration/ choose the name you gave in application credentials.
  • done!
5 Likes

Thank you! This solved the issues I have been having with my Netatmo Presence cameras.
I have never been able to get any netatmo_events through my Nabu Casa account until I followed your instruction.

thanks, it works this way even without Nabu Casa

everything works fine, I also created a script to disconnect and reconnect the webhook when needed, since very often I find the lamp unavailable.
However, I haven’t found a way to automatically run the script once the lamp turns out to be unavailable. I did the automation but it doesn’t start, too bad, but I will be able to survive
one thing I would like to be able to do, however, is to set the lamp to on or off as the netatmo app says, but instead I noticed that turning it off always returns the lamp in netatmo to “auto” and not to off. Do you know if it’s possible to do this somehow?

image