]> git.basschouten.com Git - openhab-addons.git/commitdiff
[miio] only change the name if it is the default one (#9312)
authorMarcel <marcel@verpaalen.com>
Wed, 9 Dec 2020 22:23:18 +0000 (14:23 -0800)
committerGitHub <noreply@github.com>
Wed, 9 Dec 2020 22:23:18 +0000 (14:23 -0800)
Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoAbstractHandler.java

index 3d2f436a89665f42a69a349e16311e33a61e7e15..d6262ac2fc257876a80132a0c42e676bb9d9fe99 100644 (file)
@@ -490,9 +490,12 @@ public abstract class MiIoAbstractHandler extends BaseThingHandler implements Mi
             this.pollingJob = null;
         }
         miIoScheduler.schedule(() -> {
-            ThingBuilder thingBuilder = editThing();
-            thingBuilder.withLabel(miDevice.getDescription());
-            updateThing(thingBuilder.build());
+            String label = getThing().getLabel();
+            if (label == null || label.startsWith("Xiaomi Mi Device")) {
+                ThingBuilder thingBuilder = editThing();
+                thingBuilder.withLabel(miDevice.getDescription());
+                updateThing(thingBuilder.build());
+            }
             logger.info("Mi Device model {} identified as: {}. Does not match thingtype {}. Changing thingtype to {}",
                     modelId, miDevice.toString(), getThing().getThingTypeUID().toString(),
                     miDevice.getThingType().toString());