]> git.basschouten.com Git - openhab-addons.git/commitdiff
[insteon] set device to offline if network is not online after initialization (#12790)
authorrobnielsen <rob.nielsen@yahoo.com>
Fri, 27 May 2022 12:14:43 +0000 (07:14 -0500)
committerGitHub <noreply@github.com>
Fri, 27 May 2022 12:14:43 +0000 (14:14 +0200)
* [insteon] set device to offline if network is not online during initialization

Signed-off-by: Rob Nielsen <rob.nielsen@yahoo.com>
bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/handler/InsteonDeviceHandler.java

index 2baf82e04273784c36a0837da2b003415b0d0aef..d4046b66bf7b6374f7db35e49f8675a0fc1db27b 100644 (file)
@@ -136,7 +136,8 @@ public class InsteonDeviceHandler extends BaseThingHandler {
         config = getConfigAs(InsteonDeviceConfiguration.class);
 
         scheduler.execute(() -> {
-            if (getBridge() == null) {
+            final Bridge bridge = getBridge();
+            if (bridge == null) {
                 String msg = "An Insteon network bridge has not been selected for this device.";
                 logger.warn("{} {}", thing.getUID().getAsString(), msg);
 
@@ -371,7 +372,11 @@ public class InsteonDeviceHandler extends BaseThingHandler {
                     }
                 });
 
-                updateStatus(ThingStatus.ONLINE);
+                if (ThingStatus.ONLINE == bridge.getStatus()) {
+                    updateStatus(ThingStatus.ONLINE);
+                } else {
+                    updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
+                }
             } else {
                 String msg = "Product key '" + productKey
                         + "' does not have any features that match existing channels.";