[insteon] handle cases when channelLinked is not called after initialization (#8803)

Signed-off-by: Rob Nielsen <rob.nielsen@yahoo.com>
This commit is contained in:
robnielsen 2020-10-20 17:54:40 -05:00 committed by GitHub
parent 62109eef64
commit 0f3112d3f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -314,6 +314,12 @@ public class InsteonDeviceHandler extends BaseThingHandler {
getInsteonNetworkHandler().initialized(getThing().getUID(), msg);
channels.forEach(channel -> {
if (isLinked(channel.getUID())) {
channelLinked(channel.getUID());
}
});
updateStatus(ThingStatus.ONLINE);
} else {
String msg = "Product key '" + productKey
@ -358,6 +364,10 @@ public class InsteonDeviceHandler extends BaseThingHandler {
@Override
public void channelLinked(ChannelUID channelUID) {
if (getInsteonNetworkHandler().isChannelLinked(channelUID)) {
return;
}
Map<String, @Nullable String> params = new HashMap<>();
Channel channel = getThing().getChannel(channelUID.getId());

View File

@ -201,6 +201,10 @@ public class InsteonNetworkHandler extends BaseBridgeHandler {
deviceInfo.remove(uid.getAsString());
}
public boolean isChannelLinked(ChannelUID uid) {
return channelInfo.containsKey(uid.getAsString());
}
public void linked(ChannelUID uid, String msg) {
channelInfo.put(uid.getAsString(), msg);
}