New Netatmo binding (starting OH 3.3 M5)

I cannot add a bridge (Netatmo Account). I created an app and entered the credentials (ClientID, Client Secret, UserID and pwd), but I get the following in the log:

2022-05-18 19:43:16.766 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Initializing Netatmo API bridge handler.
2022-05-18 19:43:16.767 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Connecting to Netatmo API.
2022-05-18 19:43:16.768 [TRACE] [mo.internal.handler.ApiBridgeHandler] - executeUri POST  https://api.netatmo.com/oauth2/token 
2022-05-18 19:43:17.328 [TRACE] [mo.internal.handler.ApiBridgeHandler] - executeUri returned : code [400 Bad Request] body {"error":"invalid_grant"}

I guess without the webhook, a direct connection from the netatmo server to the OpenHAB server is not required.
Therefore my next question:
Which URL is used for the webhook, because I can add a config to the nginx proxy and allow unauthenticated access on a specific URL to allow the webhook connect to my instance.
https://my.public.url:9443/ ???

Yes, this may not have been tested completely. Can you file a bug report ?

Yes, sure. Can you tell me where to file the bug report and what do you need?

Were you able to authenticate with the old version of the binding with the same settings ?
Are you sure of your id/secret/username/password ?

I have not used the old binding.

And yes, I’m sure about the id/secret/username/password.

But I have already one app defined in the “My Apps” section, which I use for the webhook (Netatmo Doorbell) over the “httpListener” Binding:

Then I defined a second app for the Netatmo binding (same username/pwd, different id/secret).
Then I created a new Thing in OH from the Netatmo binding (Netatmo Account) where I use these credentials.

I have the same issue. Have been using the old binding for over a year w/o issue. Switched to 3.3.0M5, added the account thing, but getting the error:

**COMMUNICATION_ERROR**
Rest call failed: statusCode=UNKNOWN, message=Unexpected error deserializing '{"error":"invalid_grant"}'

Added:
Just saw the latest version of the docs on Netatmo - Bindings | openHAB I’m guessing the authorization process is about to be changed in M6? No more user/pass. So I guess I’ll wait a bit.

Yes the code grant process is available in the milestone version now

1 Like

I’ve just installed v3.3.0.M5 of the Netatmo binding and I cannot get it to start. After the command to start in openhab-console the binding is always waiting and an error is logged:

299 x Waiting x  80 x 3.3.0.M5              x org.openhab.binding.netatmo
2022-06-01 18:39:41.229 [WARN ] [ore.thing.internal.ThingRegistryImpl] - bundle org.openhab.core.thing:3.2.0 (212)[org.openhab.core.thing.internal.ThingRegistryImpl(247)] : Could not get service from ref {org.openhab.core.thing.binding.ThingHandlerFactory}={backgroundDiscovery=true, service.id=1994, service.bundleid=299, service.scope=bundle, service.pid=binding.netatmo, component.name=org.openhab.binding.netatmo.internal.NetatmoHandlerFactory, component.id=402}
2022-06-01 18:39:41.230 [WARN ] [ore.thing.internal.ThingRegistryImpl] - bundle org.openhab.core.thing:3.2.0 (212)[org.openhab.core.thing.internal.ThingRegistryImpl(247)] : DependencyManager : invokeBindMethod : Service not available from service registry for ServiceReference {org.openhab.core.thing.binding.ThingHandlerFactory}={backgroundDiscovery=true, service.id=1994, service.bundleid=299, service.scope=bundle, service.pid=binding.netatmo, component.name=org.openhab.binding.netatmo.internal.NetatmoHandlerFactory, component.id=402} for reference ThingHandlerFactory

I used the following command to install the binding:

 https://openhab.jfrog.io/artifactory/libs-milestone-local/org/openhab/addons/bundles/org.openhab.binding.netatmo/3.3.0.M5/org.openhab.binding.netatmo-3.3.0.M5.jar

Not sure if I need to do something else. Does anyone have any idea?

Thanks.

What‘s your base openHAB version ?

Looks like you are using 3.2.0 need to use 3.3.0-M5 or higher. I’d wait until M6 since there are some breaking changes between M5 and M6

FYI: I have pretty much everything back online using the current milestone. Thanks for your work!

1 Like

Hello,
my Netatmo worked finally well with 3.3.0M5, but failed after doing the upgrade to M6 this morning.

I created a new token and updated the binding, but still get below:

Unexpected error deserializing '{"error":"invalid_grant"}'

Any idea?

thanks
Stefan

Update your bridge parameters by removing username and password, they are not needed anymore. Then follow the steps here.

1 Like

Hello Chris,

thanks for your reply - I don’ use username and password, but the following config.

UID: netatmo:account:xxxxx
label: Netatmo Account
thingTypeUID: netatmo:account
configuration:
  reconnectInterval: 300
  clientSecret: xxxxxx
  clientId: xxxxxx
  refreshToken: xxxxx

However, step 5. doesn’t work for me

5. Go to the authorization page of your server. http://<your openHAB address>:8080/netatmo/connect/<_CLIENT_ID_>. Your newly added bridge should be listed there (no need for you to expose your openHAB server outside your local network for this).

When I enter the Client ID and the IP of my OH server, it page doesn’t exist.

Sorry

Requested content not found.

I guess its not an issue that I use a different port - 8192 instead 8080.

Of course port 8192 in the URL if this is the port you setup for openHAB.

Doesn’t work with 8192 unfortunately either.
Something got broken from M5 to M6.

I have not tested recently as it works perfectly in my case.
You should see at binding startup a log entry of this kind: Registered Netatmo servlet at xxxxxxx
It should help you to understand what is the path to use to access the special page.

The path should be http://<openhab_ip>:8080/netatmo/connect/<account_id>

This is what I use already, as below:

http://<OH3-IPAddress>:8192/netatmo/connect/<Client_ID>

However, this URL does not link to a valid page.

As mentioned, I used 3.3.0M5 for some weeks and everything worked well. I didn’t use username/password but the new format, using the ClientID and ClientSecret.

This worked for me with M5, but suddenly stopped working once I upgraded to 3.3.0M6.

Does this trace helps?

2022-06-06 22:31:37.938 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Initializing Netatmo API bridge handler.
2022-06-06 22:31:37.939 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'netatmo:account:7814b6f340' changed from INITIALIZING to UNKNOWN
2022-06-06 22:31:37.939 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Connecting to Netatmo API.
2022-06-06 22:31:38.174 [TRACE] [mo.internal.handler.ApiBridgeHandler] - executeUri POST  https://api.netatmo.com/oauth2/token 
2022-06-06 22:31:38.264 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'netatmo:account:7814b6f340' changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR): Unexpected error deserializing '{"error":"invalid_grant"}'
2022-06-06 22:31:41.740 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Shutting down Netatmo API bridge handler.
2022-06-06 22:31:41.740 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Initializing Netatmo API bridge handler.
2022-06-06 22:31:41.740 [DEBUG] [mo.internal.handler.ApiBridgeHandler] - Connecting to Netatmo API.