Netatmo webhook with Nabu Casa

Hi all
I was not able to get webhook from my netatmo cameras. I guess I did all required:

  1. Register to Nabu casa - up and running
  2. Make Netatmo integration with cloud. success! all Netatmo components are present on HA camera streaming are received.
  3. Create new app on NetatmoConnect. Client ID and Client Secret created (NOTE: redirect URI and webbook URI left blank)
    It shows Webhook Status OK
  4. Configuration YAML
netatmo:
   client_id: "61xxxxxxxxxxxxxxxxxx5e5"
   client_secret: "QyyyyyyyyyyyyyyyyyyyyyyyyFZ45"

homeassistant:
  external_url: "http://xxxxxx.dns.org:8123"
  internal_url: "http://192.168.X.YY:8123"

logs:
   homeassistant.components.netatmo: info
  1. Webhook created in a certain automation Automation…
mode: single
- id: '1642010261139'
  alias: EntrataMotion Detection
  description: ''
  trigger:
  - platform: webhook
    webhook_id: mymotiondetectionWH
  condition: []
  action:
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.netatmo_entrata_motion
  1. Webhook correctly present on NABU CASA and Activated (I get the url and tested the url with curl -XPOST … it works correctly and I receive the webhook and the automation works perfectly.

Unfortunately I do not receive any webhook from Netatmo. Nothing on logs!!
Where I am wrong. How can I test the whebhook is registered?

Thank you

I strongly recommend to use a Netatmo dev account to reliably use webhook events as the cloud account has issues due to limitations of the API.

I am using a dev account. I login on https://dev.netatmo.com. I can read the relevant documentation, create apps etc…
Is there any difference I don’t know?

Ok, great. In that case please look at these instructions.

When I try to register the webhook it keeps unregistered after few seconds:

2022-01-18 12:01:03 INFO (MainThread) [homeassistant.components.netatmo] Register Netatmo webhook: https://hooks.nabu.casa/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=

2022-01-18 12:01:32 DEBUG (MainThread) [homeassistant.components.netatmo] Unregister Netatmo webhook (e24cc6c178d293ec45aecea47656dd75b11ad4c90de00a51c07fc369332f1b73)

Did you configure the external url correctly?

You can find it here and should set it to your WAN facing url.

I suppose it is correctly configured since I can access from outside without problems.

homeassistant:
  external_url: "http://xxxxxx.dns.org:8123"
  internal_url: "http://192.168.X.YY:8123"

I did not set https. I am using http. Could this give problems?

Yes, this is definitely a problem as for webhook Netatmo only supports a hand full of ports. I strongly suggest to use https over (the standard) port 443.

Exposing your instance unencrypted is something I would strongly advise against.

I know but I was just testing the installation before introducing another potential problem.
I am using nabu casa. Can I expose as external_url the nabu casa remote ui?

Ports 80, 443 and 8123 are forwarded on my router. Of course just for testing. Still unable to register webhook. Netatmo webhook is a true mystery!!!

In my knowledge using nabu casa, netatmo webhook should be managed by the cloud. Netatmo should post the webhook to nabu casa that transparently redirect the hook to my instance. This should be the way. I am really get confused…

Ah, now the title makes more sense. Sorry that I didn’t spot that earlier. Using Nabu Casa should solve all your problems. Simply set your external url to your Nabu Casa remote url. Nothing else should be configured to make it working as far as I can remember.

Thank you for the valuable information not written in the nabu casa documentation.
Unfortunately does not work. I just invoke the service netatmo.register_webhook but this is the log results:

2022-01-19 11:47:33 INFO (MainThread) [homeassistant.components.netatmo] Register Netatmo webhook: https://hooks.nabu.casa/xxxxxxxxxxxxxxxxxxxxkCaEl-ZaQGGb8SpNqHyf8oJ-7sz9KpPA6JLNezF6c0MuIsYvF0uCy9KckLD7fxsjDrwgCMsEB9Xk3MXZs6zfqU4FmkH0S0G5q7NN4qHy9YSYd-AqZsuCTk_Rhh2DCvk0TnzhxxZZrpSfRL3y1x3xhJ_gcUhg4E06p5s=

2022-01-19 11:48:02 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 334, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered'"
2022-01-19 11:48:02 DEBUG (MainThread) [homeassistant.components.netatmo] Unregister Netatmo webhook (e24cc6c178d293ec45aecea47656dd75b11ad4c90de00a51c07fc369332f1b73)
2022-01-19 11:48:02 INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook unregistered

Netatmo dev page shows Webhook status OK.
I don’t know if this mean the webhook is not banned or it is still possible is banned. Is there any way to check?
I asked also to nabu casa support without any answer.
Thank you in advance for any info you can give to solve this stupid problem…

Not sure what you mean, but the documentation about this is on the integration documentation page.

Whether the webhook is banned by Netatmo is shown on the application page on their dev portal.

image

The Netatmo support wont be able to help with this.

What I mean is that I checked everything:

  • Use DDNS and open ports 80 and 443.
  • Use Nabu Casa and set the nabu casa personal URL configured as external_url
  • Use Nabu casa and set my DDNS as external_url
    Any combination of what is written in the documentation. Without any success!!!
    I understand that the only way is to set a client platform and test the Netatmo API. It is a lot of time spending but at the end I will understand and finally let you know. May be we can improve the “documentation”. Thank you for your effort.

You might have changed too much. When you’re using the Nabu Casa remote service you don’t need to set any DDNS whatsoever.