]> git.basschouten.com Git - openhab-addons.git/commitdiff
[netatmo] Make the grant servlet always available (#12923)
authorlolodomo <lg.hc@free.fr>
Mon, 13 Jun 2022 06:08:36 +0000 (08:08 +0200)
committerGitHub <noreply@github.com>
Mon, 13 Jun 2022 06:08:36 +0000 (08:08 +0200)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/ApiBridgeHandler.java

index a332892fad6958adbed87d3f4b6e3267d34dc8f4..87aa07526cd68d9c4ee0000c956ef53f661897fb 100644 (file)
@@ -102,6 +102,9 @@ public class ApiBridgeHandler extends BaseBridgeHandler {
     public void initialize() {
         logger.debug("Initializing Netatmo API bridge handler.");
         updateStatus(ThingStatus.UNKNOWN);
+        GrantServlet servlet = new GrantServlet(this, httpService);
+        servlet.startListening();
+        this.grantServlet = servlet;
         scheduler.execute(() -> openConnection(null, null));
     }
 
@@ -115,9 +118,6 @@ public class ApiBridgeHandler extends BaseBridgeHandler {
                 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