homebridge-zwave-usb 2.8.1 → 2.8.4
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.
|
@@ -39,13 +39,13 @@ class ZWaveAccessory {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
const existingAccessory = this.platform.accessories.find((accessory) => accessory.UUID === uuid);
|
|
42
|
+
const nodeName = this.node.name || this.node.deviceConfig?.label || `Node ${this.node.nodeId}`;
|
|
42
43
|
if (existingAccessory) {
|
|
43
44
|
this.platformAccessory = existingAccessory;
|
|
44
45
|
}
|
|
45
46
|
else {
|
|
46
|
-
|
|
47
|
-
this.platform.
|
|
48
|
-
this.platformAccessory = new this.platform.api.platformAccessory(accessoryName, uuid);
|
|
47
|
+
this.platform.log.info(`Creating new accessory for ${nodeName} (UUID: ${uuid})`);
|
|
48
|
+
this.platformAccessory = new this.platform.api.platformAccessory(nodeName, uuid);
|
|
49
49
|
this.platform.api.registerPlatformAccessories('homebridge-zwave-usb', 'ZWaveUSB', [
|
|
50
50
|
this.platformAccessory,
|
|
51
51
|
]);
|
|
@@ -53,12 +53,16 @@ class ZWaveAccessory {
|
|
|
53
53
|
}
|
|
54
54
|
// Set accessory information
|
|
55
55
|
const manufacturer = this.node.deviceConfig?.manufacturer || 'Unknown';
|
|
56
|
-
const model = this.node.deviceConfig?.label ||
|
|
57
|
-
this.platformAccessory
|
|
58
|
-
|
|
56
|
+
const model = this.node.deviceConfig?.label || nodeName;
|
|
57
|
+
const infoService = this.platformAccessory.getService(this.platform.Service.AccessoryInformation);
|
|
58
|
+
infoService
|
|
59
59
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, manufacturer)
|
|
60
60
|
.setCharacteristic(this.platform.Characteristic.Model, model)
|
|
61
61
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, `Node ${this.node.nodeId}`);
|
|
62
|
+
if (!infoService.testCharacteristic(this.platform.Characteristic.Name)) {
|
|
63
|
+
infoService.addOptionalCharacteristic(this.platform.Characteristic.Name);
|
|
64
|
+
}
|
|
65
|
+
infoService.updateCharacteristic(this.platform.Characteristic.Name, nodeName);
|
|
62
66
|
/**
|
|
63
67
|
* Helper to normalize UUIDs for reliable comparison during metadata pruning.
|
|
64
68
|
*/
|
|
@@ -96,11 +100,13 @@ class ZWaveAccessory {
|
|
|
96
100
|
infoService.getCharacteristic(this.platform.Characteristic.Name)
|
|
97
101
|
.setProps({
|
|
98
102
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
-
format: settings_1.HAPFormat.STRING,
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
103
|
perms: [settings_1.HAPPerm.PAIRED_READ, settings_1.HAPPerm.NOTIFY],
|
|
102
104
|
});
|
|
103
105
|
infoService.updateCharacteristic(this.platform.Characteristic.Name, newName);
|
|
106
|
+
// Force metadata invalidation by updating the revision
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
108
|
+
const version = require('../../package.json').version;
|
|
109
|
+
infoService.updateCharacteristic(this.platform.Characteristic.SoftwareRevision, version);
|
|
104
110
|
// Update the Model and Serial if they were using the generic name
|
|
105
111
|
const model = this.node.deviceConfig?.label || newName;
|
|
106
112
|
infoService.setCharacteristic(this.platform.Characteristic.Model, model);
|
|
@@ -81,12 +81,14 @@ class BaseFeature {
|
|
|
81
81
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
82
|
this.accessory.addService(new serviceType(serviceName));
|
|
83
83
|
}
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
.getCharacteristic(this.platform.Characteristic.Name)
|
|
87
|
-
.setProps({
|
|
84
|
+
// Mark the first functional service as primary to help HomeKit with naming/tiles
|
|
85
|
+
if (this.managedServices.length === 0) {
|
|
88
86
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
|
-
|
|
87
|
+
service.setPrimaryService(true);
|
|
88
|
+
}
|
|
89
|
+
// Explicitly set the name characteristic with NOTIFY to ensure it's displayed correctly
|
|
90
|
+
service.getCharacteristic(this.platform.Characteristic.Name)
|
|
91
|
+
.setProps({
|
|
90
92
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
91
93
|
perms: [settings_1.HAPPerm.PAIRED_READ, settings_1.HAPPerm.NOTIFY],
|
|
92
94
|
});
|
|
@@ -95,12 +97,9 @@ class BaseFeature {
|
|
|
95
97
|
if (!service.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
96
98
|
service.addOptionalCharacteristic(this.platform.Characteristic.ConfiguredName);
|
|
97
99
|
}
|
|
98
|
-
service
|
|
99
|
-
.getCharacteristic(this.platform.Characteristic.ConfiguredName)
|
|
100
|
+
service.getCharacteristic(this.platform.Characteristic.ConfiguredName)
|
|
100
101
|
.setProps({
|
|
101
102
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
-
format: settings_1.HAPFormat.STRING,
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
104
103
|
perms: [settings_1.HAPPerm.PAIRED_READ, settings_1.HAPPerm.NOTIFY],
|
|
105
104
|
});
|
|
106
105
|
service.updateCharacteristic(this.platform.Characteristic.ConfiguredName, serviceName);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-zwave-usb",
|
|
3
3
|
"displayName": "Homebridge Z-Wave USB",
|
|
4
|
-
"version": "2.8.
|
|
4
|
+
"version": "2.8.4",
|
|
5
5
|
"description": "A Homebridge dynamic platform plugin for Z-Wave USB controllers using zwave-js.",
|
|
6
6
|
"license": "Polyform-Noncommercial-1.0.0",
|
|
7
7
|
"funding": {
|