From 852f19f5c29230f39443b21522c7f53a4863e836 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 29 Nov 2020 06:03:44 +0100 Subject: [PATCH] [miio] Update channels only if they are linked (#9163) * [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 --- .../binding/miio/internal/handler/MiIoBasicHandler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoBasicHandler.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoBasicHandler.java index 874051dfa..b6d12d877 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoBasicHandler.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoBasicHandler.java @@ -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();