Skip to content

Commit

Permalink
[netatmo] Make the grant servlet always available (openhab#12923)
Browse files Browse the repository at this point in the history
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
  • Loading branch information
lolodomo authored and andan67 committed Nov 5, 2022
1 parent 6598e7d commit 07a2063
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ public ApiBridgeHandler(Bridge bridge, HttpClient httpClient, NADeserializer des
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));
}

Expand All @@ -115,9 +118,6 @@ public void openConnection(@Nullable String code, @Nullable String redirectUri)
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
Expand Down

0 comments on commit 07a2063

Please sign in to comment.