homebridge-zwave-usb 2.9.6 → 3.0.2
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.
|
@@ -61,21 +61,11 @@ class ZWaveAccessory {
|
|
|
61
61
|
const model = this.node.deviceConfig?.label || `Node ${this.node.nodeId}`;
|
|
62
62
|
const serial = `Node ${this.node.nodeId}`;
|
|
63
63
|
const infoService = this.platformAccessory.getService(this.platform.Service.AccessoryInformation);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
if (infoService.getCharacteristic(this.platform.Characteristic.SerialNumber).value !== serial) {
|
|
71
|
-
infoService.updateCharacteristic(this.platform.Characteristic.SerialNumber, serial);
|
|
72
|
-
}
|
|
73
|
-
// Add ServiceLabelNamespace to help with naming multi-service accessories
|
|
74
|
-
if (!infoService.testCharacteristic(this.platform.Characteristic.ServiceLabelNamespace)) {
|
|
75
|
-
infoService.addOptionalCharacteristic(this.platform.Characteristic.ServiceLabelNamespace);
|
|
76
|
-
}
|
|
77
|
-
// 1 = Arabic numerals (1, 2, 3...)
|
|
78
|
-
infoService.updateCharacteristic(this.platform.Characteristic.ServiceLabelNamespace, 1);
|
|
64
|
+
infoService
|
|
65
|
+
.setCharacteristic(this.platform.Characteristic.Manufacturer, manufacturer)
|
|
66
|
+
.setCharacteristic(this.platform.Characteristic.Model, model)
|
|
67
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, serial)
|
|
68
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.node.firmwareVersion || '1.0.0');
|
|
79
69
|
/**
|
|
80
70
|
* Helper to normalize UUIDs for reliable comparison during metadata pruning.
|
|
81
71
|
*/
|
|
@@ -105,18 +95,6 @@ class ZWaveAccessory {
|
|
|
105
95
|
rename(newName) {
|
|
106
96
|
this.platform.log.info(`Syncing HomeKit name for Node ${this.node.nodeId} -> ${newName}`);
|
|
107
97
|
this.platformAccessory.displayName = newName;
|
|
108
|
-
// Update the Accessory Information Service (Standard Characteristics Only)
|
|
109
|
-
const infoService = this.platformAccessory.getService(this.platform.Service.AccessoryInformation);
|
|
110
|
-
// Update Name (NOTIFY removed to respect user overrides)
|
|
111
|
-
if (!infoService.testCharacteristic(this.platform.Characteristic.Name)) {
|
|
112
|
-
infoService.addOptionalCharacteristic(this.platform.Characteristic.Name);
|
|
113
|
-
}
|
|
114
|
-
const nameChar = infoService.getCharacteristic(this.platform.Characteristic.Name);
|
|
115
|
-
nameChar.setProps({
|
|
116
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
|
-
perms: [settings_1.HAPPerm.PAIRED_READ],
|
|
118
|
-
});
|
|
119
|
-
nameChar.updateValue(newName);
|
|
120
98
|
// Update all features
|
|
121
99
|
for (const feature of this.features) {
|
|
122
100
|
feature.rename(newName);
|
|
@@ -38,14 +38,6 @@ class BaseFeature {
|
|
|
38
38
|
});
|
|
39
39
|
nameChar.updateValue(serviceName);
|
|
40
40
|
}
|
|
41
|
-
if (service.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
42
|
-
const configuredNameChar = service.getCharacteristic(this.platform.Characteristic.ConfiguredName);
|
|
43
|
-
configuredNameChar.setProps({
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
-
perms: [settings_1.HAPPerm.PAIRED_READ, settings_1.HAPPerm.PAIRED_WRITE, settings_1.HAPPerm.NOTIFY],
|
|
46
|
-
});
|
|
47
|
-
configuredNameChar.updateValue(serviceName);
|
|
48
|
-
}
|
|
49
41
|
}
|
|
50
42
|
}
|
|
51
43
|
getServices() {
|
|
@@ -95,25 +87,19 @@ class BaseFeature {
|
|
|
95
87
|
}
|
|
96
88
|
// Sync internal property
|
|
97
89
|
service.displayName = serviceName;
|
|
98
|
-
// 1. Standard Name: Notify removed
|
|
90
|
+
// 1. Standard Name: Notify removed
|
|
99
91
|
if (service.testCharacteristic(this.platform.Characteristic.Name)) {
|
|
100
92
|
const nameChar = service.getCharacteristic(this.platform.Characteristic.Name);
|
|
101
93
|
nameChar.setProps({
|
|
102
94
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
95
|
perms: [settings_1.HAPPerm.PAIRED_READ],
|
|
104
96
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
97
|
+
// Only update if current value is generic "Node X" to respect user overrides
|
|
98
|
+
const currentValue = nameChar.value;
|
|
99
|
+
if (!currentValue || currentValue.startsWith('Node ')) {
|
|
100
|
+
nameChar.updateValue(serviceName);
|
|
101
|
+
}
|
|
110
102
|
}
|
|
111
|
-
const configuredNameChar = service.getCharacteristic(this.platform.Characteristic.ConfiguredName);
|
|
112
|
-
configuredNameChar.setProps({
|
|
113
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
114
|
-
perms: [settings_1.HAPPerm.PAIRED_READ, settings_1.HAPPerm.PAIRED_WRITE, settings_1.HAPPerm.NOTIFY],
|
|
115
|
-
});
|
|
116
|
-
configuredNameChar.updateValue(serviceName);
|
|
117
103
|
// Add Service Label Index for multi-endpoint devices to help with ordering/naming
|
|
118
104
|
if (this.endpoint.index > 0) {
|
|
119
105
|
if (!service.testCharacteristic(this.platform.Characteristic.ServiceLabelIndex)) {
|
|
@@ -344,8 +344,10 @@ class ZWaveUsbPlatform {
|
|
|
344
344
|
if (existing || this.discoveryInFlight.has(node.nodeId)) {
|
|
345
345
|
if (existing) {
|
|
346
346
|
existing.updateNode(node);
|
|
347
|
-
//
|
|
348
|
-
|
|
347
|
+
// Only sync name if it has actually changed in the Z-Wave network
|
|
348
|
+
// This prevents overwriting user-defined names in HomeKit on every startup
|
|
349
|
+
if (existing.platformAccessory.displayName !== nodeName) {
|
|
350
|
+
this.log.info(`Node ${node.nodeId} name changed: "${existing.platformAccessory.displayName}" -> "${nodeName}"`);
|
|
349
351
|
existing.rename(nodeName);
|
|
350
352
|
}
|
|
351
353
|
existing.refresh();
|
|
@@ -50,6 +50,7 @@ export interface IZWaveNode {
|
|
|
50
50
|
ready: boolean;
|
|
51
51
|
interviewStage: InterviewStage;
|
|
52
52
|
status: number;
|
|
53
|
+
firmwareVersion?: string;
|
|
53
54
|
getValue(valueId: ValueID): unknown;
|
|
54
55
|
setValue(valueId: ValueID, value: unknown): Promise<SetValueResult>;
|
|
55
56
|
supportsCC(cc: number): boolean;
|
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": "
|
|
4
|
+
"version": "3.0.2",
|
|
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": {
|