[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 <rob.nielsen@yahoo.com>
This commit is contained in:
robnielsen 2022-05-27 07:14:43 -05:00 committed by GitHub
parent 7f249872bc
commit 88e7ba3774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View 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.";