Error during webhook registration - 400 - Bad request

Tags: #<Tag:0x00007f7399b40e10>

After a fresh new installation, netatmo returns error. Can someone help me ?

2020-04-14 11:53:25 DEBUG (SyncWorker_15) [homeassistant.components.netatmo.sensor] weather station detected!
2020-04-14 11:53:25 DEBUG (SyncWorker_15) [homeassistant.components.netatmo.sensor] Adding module Indoor 70:ee:xx:xx:xx:xx
2020-04-14 11:53:25 DEBUG (SyncWorker_15) [homeassistant.components.netatmo.sensor] Adding module Abri 02:00:xx:xx:xx:xx
2020-04-14 11:53:25 DEBUG (SyncWorker_31) [homeassistant.components.netatmo.climate] Setting up home 5c8525fed6e33fxxxxxxxxxx ...
2020-04-14 11:53:25 DEBUG (SyncWorker_15) [homeassistant.components.netatmo.sensor] No home coach entities found
2020-04-14 11:53:25 ERROR (SyncWorker_31) [pyatmo.thermostat] Errors in response: {'status': 'ok', 'time_server': 1586865206, 'body': {'home': {'id': '5c8525fed6e33fxxxxxxxxxx'}, 'errors': [{'code': 6, 'id': '70:ee:xx:xx:xx:xx'}]}}
2020-04-14 11:53:25 DEBUG (SyncWorker_31) [homeassistant.components.netatmo.climate] No climate devices for None (5c8525fed6e33fxxxxxxxxxx)
2020-04-14 11:53:34 ERROR (MainThread) [homeassistant.components.netatmo] Error during webhook registration - 400 - Bad request - Allowed ports for webhooks are 443 and 80. (21) when accessing ''


Additional logs :

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pyatmo/", line 129, in query
    rsp =, data=params, timeout=timeout)
  File "/usr/local/lib/python3.7/site-packages/requests/", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/", line 198, in add_token
    raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) `Preformatted text`

I added the netatmo informations in the configuration file. Now I have all the information but the error Error during webhook registration - 400 - Bad request - Allowed ports for webhooks are 443 and 80. (21) when accessing ' keep going to show

Error during webhook registration - 400 - Bad request - Allowed ports for webhooks are 443 and 80. (21) when accessing '

This error means that you’re HA instance is not reachable on ports 443 or 80, therefore you can’t make use of webhook events.

Is it possible to modify these ports ?
80 and 443 are already redirect to a let’s encrypt docker image

No, those ports are specified by Netatmo not HA.

Hello, I get exactly the same last log ERROR message at HA start. Plus I’m not able to turn off/on the Netatmo Welcome camera from HA (but live image is ok).

In my case (Windows 10), a system process is using TCP port 80 (Port 443 looks not used). When I look at the firewall rules, the only allowed AND activated service on TCP local port 80 for incoming traffic is “HTTP World Wide Web Services”, so I’m confused.

Any clue?

Thanks for your help.

Apparently you’re instance is not accessible from the internet hence the webhook registration fails.

I strongly do not advise to expose a machine directly to the internet if you don’t know exactly what you are doing. Windows even more so.

Please consider using a proxy or Nabu Casa.

About turning the camera on/off, it is not supported right now. Please take a look at the pre-release custom component: Testers wanted - Netatmo integration

Actually I do use Nabu Casa for external access so I should be both visible and safe :wink:
In my netatmo app config, I did not fill “Redirect URI” and “Webhook URI” fields. Should I put my Nabu casa URL here?
To be more precise:

  1. the error message is a “new” behavior (not 100% sure, but I think it’s from 0.111)
  2. Everything with Netamo works perfectly well (weather station + welcome camera).

BTW, Thanks for the link. I will be happy to test and help with Netatmo integration.

With Nabu Casa for remote access you shouldn’t need to configure anything and webhooks should work just fine. Also in the netatmo (dev) app no URIs need to be configured.

Please double check your external and intern URLs.

You’re right! It looks like my Cloud config had been lost for an unknown reason…

1 Like