[netatmo] Make the grant servlet always available (#12923)

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2022-06-13 08:08:36 +02:00 committed by GitHub
parent 770d32ce99
commit eb97ba2ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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