New Netatmo binding (starting OH 3.3 M5)

You mean that this part of the documentation, in particular step 2, is not enough clear for you ?

  1. Press the “Authorize Thing” button. This will take you either to the login page of Netatmo Connect or directly to the authorization screen. Login and/or authorize the application. You will be returned and the entry should go green.
  2. The binding will be updated with a refresh token and go ONLINE. The refresh token is used to re-authorize the bridge with Netatmo Connect Web API whenever required.
  3. If you’re using file based .things config file, copy the provided refresh token in the refreshToken parameter of your thing definition (example below).

I can replace the second point with: The bridge configuration will be updated with a refresh token and go ONLINE. The refresh token is used to re-authorize the bridge with Netatmo Connect Web API whenever required. So you can consult this token by opening the Thing page in MainUI, this is the value of the advanced parameter named “Refresh Token”.

That is strange, that would mean the Healthy Home Coach humidity is not provided the same way as for the weather station.
How is defined your item, in case it is defined in a config file ?

I have a weird issue since this night (21.10.22 exactly 02.00 am GMT+2). The netatmo Account is online but the main station (bridge) stays offline. When disabling an re-enabling it, the log says:

Thing ‘netatmo:weather-station:3f1eb0814b:70ee50135f3c’ changed from UNKNOWN to OFFLINE: Data seems quite old

right after, it does actually update as seen here:
Item ‘Netatmo_Main_Co2’ changed from 954 ppm to 944 ppm

The data of the main station is up to date in openhab. But all the other temperature sensors don’t update anymore because the bridge is offline. Inside the GUI the same message “data seems quite old” appears below the OFFLINE text.

Any ideas? What I already did is recreating the refresh token, removing the main station thin and re adding it but with no success, I still get the same message.

thanks for your help!

Patrick

Your weather station is probably disconnected from Internet and so does no more send data to the Netatmo cloud servers.
Just unplug your weather station and then plug it again. It should resolve your problem. Nothing to do in OH.

@michaeljoos : I checked the code and found there are a min and a max value for each measurement channel and for the rain (sum), the max is set to 150 mm.
@glhopital : I see two solutions to fix the issue, either setting a big max or making min/max optional (in the current case, we should not have any max value).
Issue created in Github:

I submitted of a proposal for a fix:

@tetrahaedron : for your humidity problem for your Healthy Home Coach, could you please enable the TRACE logs for the netatmo binding (log:set TRACE org.openhab.binding.netatmo) and show to us how look your retrieved humidity value.

Here is a partial copy&paste of an example of what I get with the weather station.
What is important is the Humidity value in the dashboard_data.

19:08:46.124 [TRACE] [tmo.internal.handler.ApiBridgeHandler] - executeUri GET  https://api.netatmo.com/api/getstationsdata?device_id=xxx&get_favorites=false
19:08:46.225 [TRACE] [tmo.internal.handler.ApiBridgeHandler] - executeUri returned : code [200 OK] body {"body":{"devices":[{"_id":"xxx", ... "dashboard_data":{"time_utc":1667063269,"Temperature":21.8,"CO2":701,"Humidity":67,"Noise":37,"Pressure":1010.7,"AbsolutePressure":1003.2,"min_temp":20.5,"max_temp":22.4,"date_max_temp":1667056334,"date_min_temp":1667018050,"temp_trend":"down","pressure_trend":"down"},...

As you can observe, I got value 67. What kind of value do you get with the Healthy Home Coach ?

Chances for replies may be higher when you do your posts in English.

You are right, thanks for the reminder. I repeat my post in English
:slight_smile:

My Netatmo-binding (account) for my weatherstation (openhab version 3.3 in a docker image) works fine with no problems. Since last week i receive a communication error without any changes on the configuration, system or docker image. The connect to netatmo did not work. I tried different opportunities without any success. I reveive the message"invalid grant" or “scope does not fit”. I tried different combination for the authorisation the app, nothing works.

Additional i used a second docker-image only with Netatmo-thing/-bind with the same result, also my raspberry with openhab v3.3 and Netatmo :frowning:

Log-Output:
2022-11-01 23:28:23.073 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Initializing Netatmo API bridge handler.
2022-11-01 23:28:23.077 [INFO ] [etatmo.internal.servlet.GrantServlet] - Registered Netatmo servlet at ‘/netatmo/connect/…’
2022-11-01 23:28:23.078 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Connecting to Netatmo API.
2022-11-01 23:28:23.078 [TRACE] [mo.internal.handler.ApiBridgeHandler] - executeUri POST https://api.netatmo.com/oauth2/token
2022-11-01 23:28:23.107 [TRACE] [mo.internal.handler.ApiBridgeHandler] - executeUri returned : code [400 Bad Request] body {“error”:“invalid_request”,"err>

I choose this post, because there was similar problems in the different posts.

The connect to the weatherstation from my website with the cridentials are fine und works.

I hope anybody can me help?

The problem was the invalid resfreh token. I don’t know why. The solution was to remove my netatmo additional channel definition (netatmo.things) and create a new refresh token. The things go online und works. In the next step I created the file netatmo.things new with an actual refresh token.

Hello,
I found the issue which lead me to delete and renew the refresh token every time I restart docker container :smiley:. The problem was caused by reuse the same Netatmo login data for my weewx instance :sweat_smile:. I noticed that weewx stopped working getting data from the Netatmo account when I exchanged the refresh token.
The solution was to create a separate app data account for openHAB netatmo binding. After that the binding was working after the reboot for both without issues.

1 Like

*** this is now working, not sure how/why but data is now coming through. I will leave here for reference ***
I am struggling to get the webhook working so I can get updated information from my doorbell.
I have the binding running on a OH3.4.0M4 setup and the standard information is coming through ok.
However no matter what I try I cannot get any luck using the webhook.
The account info was manually entered, and the rest was automatically configured using the scan function of the binding.

Log from openhab.log - logging set to DEBUG

2022-11-16 11:48:12.832 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Initializing Netatmo API bridge handler.
2022-11-16 11:48:12.865 [INFO ] [etatmo.internal.servlet.GrantServlet] - Registered Netatmo servlet at '/netatmo/connect/"Client ID"'
2022-11-16 11:48:20.789 [DEBUG] [etatmo.internal.servlet.GrantServlet] - Netatmo auth callback servlet received GET request /netatmo/connect/"Client ID".
2022-11-16 11:48:47.030 [DEBUG] [etatmo.internal.servlet.GrantServlet] - Netatmo auth callback servlet received GET request /netatmo/connect/"Client ID".
2022-11-16 11:48:47.031 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Connecting to Netatmo API.
2022-11-16 11:48:47.136 [INFO ] [atmo.internal.servlet.WebhookServlet] - Registered Netatmo servlet at '/netatmo/webhook/"Client ID"'
2022-11-16 11:48:47.136 [INFO ] [atmo.internal.servlet.WebhookServlet] - Setting up WebHook at Netatmo to http://"IP Address of router":88/netatmo/webhook/"Client ID"
2022-11-16 11:51:07.463 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'netatmo:home:"Account ID":"Home ID"' to inbox.
2022-11-16 11:51:07.467 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'netatmo:doorbell:"Account ID":"Home ID":"Doorbell ID"' to inbox.
2022-11-16 11:51:28.791 [DEBUG] [tatmo.internal.handler.DeviceHandler] - Initializing handler for bridge netatmo:home:"Account ID":"Home ID"
2022-11-16 11:51:44.428 [DEBUG] [tatmo.internal.handler.ModuleHandler] - Initializing handler for thing netatmo:doorbell:"Account ID":"Home ID":"Doorbell ID"
2022-11-16 11:51:47.087 [DEBUG] [handler.capability.RefreshCapability] - Module refreshed, next one in 180 s

From events.log

2022-11-16 15:59:59.412 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_LiveSnapshot' changed from raw type (image/jpeg): 137879 bytes to raw type (image/jpeg): 135674 bytes
2022-11-16 15:59:59.412 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_SubEventTimestamp' changed from 2022-11-16T15:56:13.000+0000 to 2022-11-16T15:57:56.000+0000
2022-11-16 15:59:59.412 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_EventTimestamp' changed from 2022-11-16T15:56:13.000+0000 to 2022-11-16T15:57:56.000+0000
2022-11-16 15:59:59.412 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_VideoLocalURL' changed from http://"Rest of line deleted for securtiy"
2022-11-16 15:59:59.412 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_VideoVPNURL' changed from https://"Rest of line deleted for securtiy"
2022-11-16 16:03:00.666 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_LiveSnapshot' changed from raw type (image/jpeg): 135674 bytes to raw type (image/jpeg): 127746 bytes
2022-11-16 16:03:00.666 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_Signal' changed from 57 dBm to 60 dBm
2022-11-16 16:06:02.565 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_LiveSnapshot' changed from raw type (image/jpeg): 127746 bytes to raw type (image/jpeg): 122738 bytes
2022-11-16 16:09:03.717 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_LiveSnapshot' changed from raw type (image/jpeg): 122738 bytes to raw type (image/jpeg): 120332 bytes
2022-11-16 16:09:03.717 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_Signal' changed from 60 dBm to 57 dBm
2022-11-16 16:12:04.879 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_LiveSnapshot' changed from raw type (image/jpeg): 120332 bytes to raw type (image/jpeg): 125154 bytes
2022-11-16 16:12:04.879 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_Signal' changed from 57 dBm to 58 dBm
2022-11-16 16:15:06.598 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_LiveSnapshot' changed from raw type (image/jpeg): 125154 bytes to raw type (image/jpeg): 121121 bytes
2022-11-16 16:18:07.926 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_LiveSnapshot' changed from raw type (image/jpeg): 121121 bytes to raw type (image/jpeg): 121754 bytes
2022-11-16 16:18:07.926 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_Signal' changed from 58 dBm to 57 dBm
2022-11-16 16:21:08.813 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_LiveSnapshot' changed from raw type (image/jpeg): 121754 bytes to raw type (image/jpeg): 111315 bytes
2022-11-16 16:21:08.813 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Doorbell_Signal' changed from 57 dBm to 58 dBm

In OH I have set the client ID and Client Secret and authenticated using

http://<your openHAB address>:8080/netatmo/connect/<_CLIENT_ID_>

This appears to work correctly I then take the redirect URL from this page and add this to the Netatmo website.
This also appears to work as I get

2022-11-16 11:48:47.030 [DEBUG] [etatmo.internal.servlet.GrantServlet] - Netatmo auth callback servlet received GET request /netatmo/connect/"Client ID".

I then try and set the webhook I enter the IP of my router and port 88 to webhook field of OH. (I have enabled port forwarding for this port) I used the syntax http://“my router IP”:88
This shows

2022-11-16 11:48:47.136 [INFO ] [atmo.internal.servlet.WebhookServlet] - Registered Netatmo servlet at '/netatmo/webhook/"Client ID"'
2022-11-16 11:48:47.136 [INFO ] [atmo.internal.servlet.WebhookServlet] - Setting up WebHook at Netatmo to http://"IP Address of router":88/netatmo/webhook/"Client ID"

But no data comes through.
Eventually the webhook gets blocked by Netatmo.
I tried manually filling in the webhook url on the Netatmo website but get the same result.

Not sure where this is breaking down, I would appreciate any guidance on testing this.

Update, changed port to 443 and changed the logging to TRACE and noticed that when OH is restarted I get

2022-11-17 14:18:22.133 [INFO ] [atmo.internal.servlet.WebhookServlet] - Error setting webhook : Unexpected error deserializing '<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
'

After

2022-11-16 11:48:47.136 [INFO ] [atmo.internal.servlet.WebhookServlet] - Registered Netatmo servlet at '/netatmo/webhook/"Client ID"'
2022-11-16 11:48:47.136 [INFO ] [atmo.internal.servlet.WebhookServlet] - Setting up WebHook at Netatmo to http://"IP Address of router":443/netatmo/webhook/"Client ID"

Changed port to 80, no error message but no data?

Hope this helps.

Hi,
something I don’t understand. When I go on
http://:8080/netatmo/connect/<CLIENT_ID>
I clic on the green button.
I’m go on the next page and this time I clic on “Yes, I Accept”. But I just come back in the first page.

And my Netatmo Brigde stay Offline.
Someone can please help me to understand what I miss?
I have a client-id a secret-id a acessTocken and a refreshToken
In my .things I use the client_id the secret_id and the refreshToken
I try to add in healthy coach
This text will be hidden

When I go on
http://:8080/netatmo/connect/<CLIENT_ID >
I clic on the green button.
I’m go on the next page and this time I clic on “Yes, I Accept”. But I just come back in the first page.

this is working fine for me. try to use another browser?

Look at documentation (configure the bridge) , in particular steps 6, 7 and 8.

thanks!
Actually, the problem for me was identifying the “home id”. I am not sure I can repeat all the steps, but luckily I found it and now I can manage and control all the netatmo valves from openhab.

Starting today I have a problem connecting to my netatmo account. The things stays offline with the error ‘user usage reached’. Do you know if something is changed on connections limit for Netatmo API? I never had this problem before…

Netatmo have been having some problems their end. If you look at Netatmo support on twitter they normally post updates.
It could be related to that