]> git.basschouten.com Git - openhab-addons.git/commitdiff
[miio] Update channels only if they are linked (#9163)
authorMarcel <marcelrv@users.noreply.github.com>
Sun, 29 Nov 2020 05:03:44 +0000 (06:03 +0100)
committerGitHub <noreply@github.com>
Sun, 29 Nov 2020 05:03:44 +0000 (21:03 -0800)
* [miio] Update channels only if they are linked

With introduction of miot devices with enormous amount of channels
refreshes can become slow. With this change only relevant updates are
done.

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoBasicHandler.java

index 874051dfae2d1859306922945d54a6b98c1ef5e4..b6d12d8775d305e63391d7eff34e40d894a8d41e 100644 (file)
@@ -318,6 +318,11 @@ public class MiIoBasicHandler extends MiIoAbstractHandler {
         int maxProperties = device.getDevice().getMaxProperties();
         JsonArray getPropString = new JsonArray();
         for (MiIoBasicChannel miChannel : refreshList) {
+            if (!isLinked(miChannel.getChannel())) {
+                logger.debug("Skip refresh of channel {} for {} as it is not linked", miChannel.getChannel(),
+                        getThing().getUID());
+                continue;
+            }
             JsonElement property;
             if (miChannel.isMiOt()) {
                 JsonObject json = new JsonObject();