From e868d3264a651324126f014c97b14c1adeaf145a Mon Sep 17 00:00:00 2001 From: clinique Date: Sat, 4 Jan 2025 10:59:42 +0100 Subject: [PATCH] Simplyfy status logic check Signed-off-by: clinique --- .../handler/capability/RefreshCapability.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/RefreshCapability.java b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/RefreshCapability.java index 1199465faf6..9c8bf1f28c4 100644 --- a/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/RefreshCapability.java +++ b/bundles/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/handler/capability/RefreshCapability.java @@ -86,17 +86,14 @@ public class RefreshCapability extends Capability { private void proceedWithUpdate() { Duration delay; handler.proceedWithUpdate(); - if (!ThingStatus.ONLINE.equals(handler.getThing().getStatus())) { - if (handler.getAccountHandler() instanceof ApiBridgeHandler accountHandler - && !ThingStatus.ONLINE.equals(accountHandler.getThing().getStatus())) { - delay = accountHandler.getTimeBeforeReconnect(); - delay = delay != null ? delay.plus(ASAP) : OFFLINE_DELAY; - logger.debug("Bridge is not ONLINE, will wait for him to come-back {}", delay); - } else { - delay = OFFLINE_DELAY; - logger.debug("Thing '{}' is not ONLINE, special refresh interval {} used", thingUID, delay); - } - + if (handler.getAccountHandler() instanceof ApiBridgeHandler accountHandler + && !ThingStatus.ONLINE.equals(accountHandler.getThing().getStatus())) { + delay = accountHandler.getTimeBeforeReconnect(); + delay = delay != null ? delay.plus(ASAP) : OFFLINE_DELAY; + logger.debug("Bridge is not ONLINE, will wait for him to come-back {}", delay); + } else if (!ThingStatus.ONLINE.equals(handler.getThing().getStatus())) { + delay = OFFLINE_DELAY; + logger.debug("Thing '{}' is not ONLINE, special refresh interval {} used", thingUID, delay); } else { delay = calcDelay(); }