@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.
- package/lib/utils/device-context.js +18 -8
- package/package.json +1 -1
|
@@ -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.
|
|
78
|
-
//
|
|
79
|
-
//
|
|
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
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
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
|
-
|
|
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