]> git.basschouten.com Git - openhab-addons.git/commitdiff
[easee] Fix binding not working after Easee cloud API has been unavailable (#13469)
authoralexf2015 <alexf2015@users.noreply.github.com>
Sun, 2 Oct 2022 16:28:33 +0000 (18:28 +0200)
committerGitHub <noreply@github.com>
Sun, 2 Oct 2022 16:28:33 +0000 (18:28 +0200)
* fix #13463

Signed-off-by: Alexander Friese <af944580@googlemail.com>
bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/connector/WebInterface.java

index 49a54660fa3a9d80527e3d5155cf7de0bbacbfe7..42d132903f711ef649d02d5b2546dc00551c72e0 100644 (file)
@@ -222,7 +222,7 @@ public class WebInterface implements AtomicReferenceTrait {
         private synchronized void refreshAccessToken() {
             Instant now = Instant.now();
 
-            if (now.isAfter(tokenExpiry.minus(WEB_REQUEST_TOKEN_EXPIRY_BUFFER_MINUTES, ChronoUnit.MINUTES))
+            if (now.plus(WEB_REQUEST_TOKEN_EXPIRY_BUFFER_MINUTES, ChronoUnit.MINUTES).isAfter(tokenExpiry)
                     || now.isAfter(tokenRefreshDate.plus(WEB_REQUEST_TOKEN_MAX_AGE_MINUTES, ChronoUnit.MINUTES))) {
                 logger.debug("access token needs to be refreshed, last refresh: {}, expiry: {}",
                         Utils.formatDate(tokenRefreshDate), Utils.formatDate(tokenExpiry));