From 8dcc7cd0e6c998e3220800132f77209bc4e2788b Mon Sep 17 00:00:00 2001 From: David Hislop Date: Sun, 7 Feb 2021 16:55:08 +1100 Subject: [PATCH] Update the cachedAccessories displayName when it differs from the name in the configuration. This allows you to re-purpose an accessory while eliminating potentially confusing log messages that show different names. --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index f409b04..c568abb 100644 --- a/index.js +++ b/index.js @@ -214,6 +214,13 @@ class TuyaLan { isCached = false; } + if (accessory && accessory.displayName !== deviceConfig.name) { + this.log.info( + "Configuration name %s differs from cached displayName %s. Updating cached displayName to %s ", + deviceConfig.name, accessory.displayName, deviceConfig.name); + accessory.displayName = deviceConfig.name; + } + this.cachedAccessories.set(deviceConfig.UUID, new Accessory(this, accessory, device, !isCached)); }