@homebridge-plugins/homebridge-govee 11.34.2-beta.11 → 11.34.2-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -74,17 +74,27 @@ export function applyDeviceContext(platform, accessory, device, deviceConf, join
74
74
  // label in the configuration.
75
75
  //
76
76
  // ⚠️ This used to run for LAN-only devices only, so every other device kept
77
- // whatever name it was discovered under, forever. Renaming in the Govee app
78
- // did nothing, and a name HAP complains about (brackets, say) could not be
79
- // cleared without deleting the cached accessory and losing its room and
80
- // automations (#1344).
77
+ // whatever name it was discovered under, forever. A name HAP complains about
78
+ // (brackets, say) could then not be cleared without deleting the cached
79
+ // accessory and losing its room and automations (#1344).
81
80
  //
82
- // The AccessoryInformation characteristics are set alongside displayName
83
- // because addAccessory sets all three, and HAP's own warning reads the
84
- // characteristic rather than the display name.
81
+ // ⚠️ This does NOT rename anything in the Home app. HomeKit fixes the name a
82
+ // user sees when the accessory is first added, and a rename made there never
83
+ // comes back to us either. What this fixes is the name Homebridge itself
84
+ // shows and, through the Name characteristic, the HAP warning.
85
+ //
86
+ // `updateDisplayName` is the supported way to do it - assigning to
87
+ // `displayName` sets only Homebridge's copy and leaves the HAP accessory
88
+ // behind. It arrived in Homebridge v1.10.0, and this plugin still supports
89
+ // ^1.6.0, hence the check.
85
90
  if (device.deviceName && accessory.displayName !== device.deviceName) {
86
91
  platform.log('[%s] %s [%s].', accessory.displayName, platformLang.devRenamed, device.deviceName)
87
- accessory.displayName = device.deviceName
92
+
93
+ if (typeof accessory.updateDisplayName === 'function') {
94
+ accessory.updateDisplayName(device.deviceName)
95
+ } else {
96
+ accessory.displayName = device.deviceName
97
+ }
88
98
 
89
99
  const hapChar = platform.api?.hap?.Characteristic
90
100
  const infoService = accessory.getService?.(platform.api?.hap?.Service?.AccessoryInformation)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@homebridge-plugins/homebridge-govee",
3
3
  "alias": "Govee",
4
4
  "type": "module",
5
- "version": "11.34.2-beta.11",
5
+ "version": "11.34.2-beta.12",
6
6
  "description": "Homebridge plugin to integrate Govee devices into HomeKit.",
7
7
  "author": {
8
8
  "name": "bwp91",