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.
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:
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.
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.
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.
I just tested and I can confirm it is no more working, same result as @stefan13 .
An issue has to be created in Git and a fast fix has to be provided (before 3.3 is released).
The GrantServlet is created by the ApiBridgeHandler as soon as clientSecret and clientID are provided in the account counfiguration.
public void openConnection(@Nullable String code, @Nullable String redirectUri) {
ApiHandlerConfiguration configuration = getConfiguration();
ConfigurationLevel level = configuration.check();
switch (level) {
case EMPTY_CLIENT_ID:
case EMPTY_CLIENT_SECRET:
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, level.message);
break;
case REFRESH_TOKEN_NEEDED:
if (code == null || redirectUri == null) {
GrantServlet servlet = new GrantServlet(this, httpService);
servlet.startListening();
this.grantServlet = servlet;
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, level.message);
break;
} // else we can proceed to get the token refresh
@stefan13 : can you please file a bug report in github so we can study this. I’ll not be that available in the next coming days but should be able to find some time before end of the week.
So the servlet and the page is not available if a refresh token is already setup?
That explains why the page is falling for both of us.
Shouldn’t this psge be available everytime, in case you would like to restart the process? Or do you consider that the refresh token must be cleared first in the config to trigger the start of the servlet?
That could make sense and there might be finally no bug. But something to mention in the documentation because not very intuitive.