From 88e7ba3774045325c6e85c613eeefb468db2ecef Mon Sep 17 00:00:00 2001 From: robnielsen Date: Fri, 27 May 2022 07:14:43 -0500 Subject: [PATCH] [insteon] set device to offline if network is not online after initialization (#12790) * [insteon] set device to offline if network is not online during initialization Signed-off-by: Rob Nielsen --- .../insteon/internal/handler/InsteonDeviceHandler.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/handler/InsteonDeviceHandler.java b/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/handler/InsteonDeviceHandler.java index 2baf82e042..d4046b66bf 100644 --- a/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/handler/InsteonDeviceHandler.java +++ b/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/handler/InsteonDeviceHandler.java @@ -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."; -- 2.47.3