Skip to content

Commit

Permalink
[miio] only change the name if it is the default one (openhab#9312)
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Verpaalen <[email protected]>
  • Loading branch information
marcelrv authored Dec 9, 2020
1 parent 654db27 commit 6fe75cb
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,12 @@ private void changeType(final String modelId) {
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());
Expand Down

0 comments on commit 6fe75cb

Please sign in to comment.