mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[miio] force start cloudconnector after credentials are updated (#11459)
Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
This commit is contained in:
parent
264e19dbfc
commit
ad54da1638
@ -82,7 +82,7 @@ public class MiIoHandlerFactory extends BaseThingHandlerFactory {
|
|||||||
cloudConnector.setCredentials(username, password, country);
|
cloudConnector.setCredentials(username, password, country);
|
||||||
try {
|
try {
|
||||||
if (!scheduler.isShutdown()) {
|
if (!scheduler.isShutdown()) {
|
||||||
scheduledTask = scheduler.submit(() -> cloudConnector.isConnected());
|
scheduledTask = scheduler.submit(() -> cloudConnector.isConnected(true));
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Unexpected: ScheduledExecutorService is shutdown.");
|
logger.debug("Unexpected: ScheduledExecutorService is shutdown.");
|
||||||
}
|
}
|
||||||
|
@ -104,10 +104,17 @@ public class CloudConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
|
return isConnected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConnected(boolean force) {
|
||||||
final MiCloudConnector cl = cloudConnector;
|
final MiCloudConnector cl = cloudConnector;
|
||||||
if (cl != null && cl.hasLoginToken()) {
|
if (cl != null && cl.hasLoginToken()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (force) {
|
||||||
|
logonCache.invalidateValue();
|
||||||
|
}
|
||||||
final @Nullable Boolean c = logonCache.getValue();
|
final @Nullable Boolean c = logonCache.getValue();
|
||||||
if (c != null && c.booleanValue()) {
|
if (c != null && c.booleanValue()) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user