Netatmo webhook unregisters immediately after registration

I’ve had the Netatmo integration for a while, it loads all my sensors, and appears to work fine. My HA instance works perfectly outside of my LAN via a reverse proxy.

Out of curiosity, I wanted to configure webhooks to test some further automation possibilities. So I configured the client_id and client_secret of a personal application registered with Netatmo. However, for some reason, the hook registration does not seem to be working properly.

After not receiving any calls to the hook, I set the Netatmo log level to debug and can see the following during loading:

14:29:13 INFO (MainThread) [homeassistant.components.netatmo] Register Netatmo webhook: https://my.domain.com/api/webhook/WEBHOOKID
14:29:42 DEBUG (MainThread) [homeassistant.components.netatmo] Unregister Netatmo webhook (WEBHOOKID)
14:29:42 INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook unregistered

I’m guessing that the “webhook unregistered” a few seconds after “Register Netatmo webhook” would explain why I don’t get any calls.

Any ideas on how to debug/fix this?

Thanks

The most common oversight in this context is setting the external url correctly. You can find it here and should set it to your WAN facing url.

You can use the service netatmo.register_webhook to re-register the webhook without the need for a restart. Also double check that the webhook is not banned by Netatmo via dev.netatmo.com.

You might also have to configure use_x_forwarded_for and trusted_proxies in configuration.yaml.

Example:

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 192.168.1.42
1 Like

@madd0 were you able to fix your problem? I have the exact same problem occuring.

I have the same problem.
Do you find a fix ?

Did you check all the above?

Yes.
I have http config :

http:   
   use_x_forwarded_for: true
   trusted_proxies:
        - IP

My home assistant is available in https:XXX without problems.
But I have this log during registered webhook :

2022-01-18 11:57:06 INFO (MainThread) [homeassistant.components.netatmo] Register Netatmo webhook: https://XXX/api/webhook/WEBHOOKID
2022-01-18 11:57:36 DEBUG (MainThread) [homeassistant.components.netatmo] Unregister Netatmo webhook (WEBHOOKID)
2022-01-18 11:57:36 INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook unregistered

Did you also configure the external url correctly?

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

yes my external URL is https://XXX.freeboxos.fr and this url is available

If your app/account is not banned for webhook use by Netatmo I’d like to ask you to raise the log level to debug and try to un-register and register the webhook manually via the service netatmo.register_webhook.

Unregister :

2022-01-18 13:15:47 DEBUG (MainThread) [homeassistant.components.netatmo] Unregister Netatmo webhook (WEBHOOKID)
2022-01-18 13:15:47 INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook unregistered
2022-01-18 13:15:47 DEBUG (MainThread) [homeassistant.components.netatmo] No webhook to be dropped for WEBHOOKID

Registered :

2022-01-18 13:16:07 INFO (MainThread) [homeassistant.components.netatmo] Register Netatmo webhook: https://XXXX.freeboxos.fr/api/webhook/WEBHOOKID
2022-01-18 13:16:37 DEBUG (MainThread) [homeassistant.components.netatmo] Unregister Netatmo webhook (WEBHOOKID)
2022-01-18 13:16:37 INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook unregistered

For log level, I have this in my config :

logger:
  logs:
    homeassistant.components.netatmo: debug

How know if I banned by Netamo ? On https://dev.netatmo.com/, my app is available and webhook status is OK.

Yes, that would be the place. I assume you’re on the latest patch release of HA?

Thanks for your different reply.
I uninstalled “netatmo integration” / remove configuration in yaml / restart HA. Then, reput netatmo configuration / restart then reinstall “netatmo integration”. And all work fine, strange :wink: :slight_smile:

 2022-01-18 13:52:28 DEBUG (MainThread) [homeassistant.components.netatmo.webhook] None: {'user_id': 'XXXX', 'user': {'id': 'XXXX', 'email': 'XXXX'}, 'push_type': 'webhook_activation'}
2022-01-18 13:52:28 INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook successfully registered

Ok, strange. Thanks for the patience.

Hello,
I’m having the same issue: webhook systematically unregistered 30 seconds after registration:

2022-02-15 13:36:57 INFO (MainThread) [homeassistant.components.netatmo] Register Netatmo webhook: https://hooks.nabu.casa/savasvas=
2022-02-15 13:37:27 DEBUG (MainThread) [homeassistant.components.netatmo] Unregister Netatmo webhook (2a3cd081e44f5c25448a0bcd4724a6e0327705bc3d2bd77bad478071233c70f8)
2022-02-15 13:37:27 INFO (MainThread) [homeassistant.components.netatmo.data_handler] Netatmo webhook unregistered

Using nabu hosting,I did setup the external URL, the netatmo client and secret IDs and the trusted proxy

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24
    - 10.32.2.0/24

Don’t know where to look at :frowning:

Problem seems to be fixed after following actions:

  • remove netatmo integration
  • restart HA
  • add netatmo
  • configure using configuration.yaml file

Webhook succesfully registered and events are received in HA

This trick works but just the first time. If you restart HA, timeout happen and webhook is unregistered :frowning:

Any news for the issue….afte restart oh ha, mostly webhooks not registered……

I assume you are using the HA Cloud Link. Webhook are not functional with that method due to limitation of the Netatmo API. Please use your own dev account.

No, I‘m useing my own dev account in config.yaml.
But also installed the netatmo Addon.

Like this ?!