diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoHandlerFactory.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoHandlerFactory.java index 523efc256..afb8073b1 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoHandlerFactory.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoHandlerFactory.java @@ -82,7 +82,7 @@ public class MiIoHandlerFactory extends BaseThingHandlerFactory { cloudConnector.setCredentials(username, password, country); try { if (!scheduler.isShutdown()) { - scheduledTask = scheduler.submit(() -> cloudConnector.isConnected()); + scheduledTask = scheduler.submit(() -> cloudConnector.isConnected(true)); } else { logger.debug("Unexpected: ScheduledExecutorService is shutdown."); } diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/cloud/CloudConnector.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/cloud/CloudConnector.java index 626b7515c..137c65774 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/cloud/CloudConnector.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/cloud/CloudConnector.java @@ -104,10 +104,17 @@ public class CloudConnector { } public boolean isConnected() { + return isConnected(false); + } + + public boolean isConnected(boolean force) { final MiCloudConnector cl = cloudConnector; if (cl != null && cl.hasLoginToken()) { return true; } + if (force) { + logonCache.invalidateValue(); + } final @Nullable Boolean c = logonCache.getValue(); if (c != null && c.booleanValue()) { return true;