homebridge-zwave-usb 2.9.7 → 3.0.3
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);
|
|
@@ -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();
|
|
@@ -56,9 +56,10 @@ export declare class ZWaveController extends EventEmitter implements IZWaveContr
|
|
|
56
56
|
removeFailedNode(nodeId: number): Promise<void>;
|
|
57
57
|
/**
|
|
58
58
|
* Updates the user-defined name for a node in the Z-Wave network.
|
|
59
|
-
* This
|
|
59
|
+
* This uses the Node Naming and Location CC to send the name to the device.
|
|
60
|
+
* If the device doesn't support this CC, falls back to local-only storage.
|
|
60
61
|
*/
|
|
61
|
-
setNodeName(nodeId: number, name: string): void
|
|
62
|
+
setNodeName(nodeId: number, name: string): Promise<void>;
|
|
62
63
|
getAvailableFirmwareUpdates(nodeId: number): Promise<unknown[]>;
|
|
63
64
|
beginFirmwareUpdate(nodeId: number, update: unknown): Promise<void>;
|
|
64
65
|
abortFirmwareUpdate(nodeId: number): Promise<void>;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ZWaveController = void 0;
|
|
7
7
|
const zwave_js_1 = require("zwave-js");
|
|
8
|
+
const core_1 = require("@zwave-js/core");
|
|
8
9
|
const events_1 = require("events");
|
|
9
10
|
const path_1 = __importDefault(require("path"));
|
|
10
11
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -673,15 +674,26 @@ class ZWaveController extends events_1.EventEmitter {
|
|
|
673
674
|
}
|
|
674
675
|
/**
|
|
675
676
|
* Updates the user-defined name for a node in the Z-Wave network.
|
|
676
|
-
* This
|
|
677
|
+
* This uses the Node Naming and Location CC to send the name to the device.
|
|
678
|
+
* If the device doesn't support this CC, falls back to local-only storage.
|
|
677
679
|
*/
|
|
678
|
-
setNodeName(nodeId, name) {
|
|
680
|
+
async setNodeName(nodeId, name) {
|
|
679
681
|
const node = this.nodes.get(nodeId);
|
|
680
682
|
if (!node) {
|
|
681
683
|
throw new Error(`Node ${nodeId} not found`);
|
|
682
684
|
}
|
|
683
685
|
this.log.info(`Updating name for Node ${nodeId} to: "${name}"`);
|
|
684
|
-
|
|
686
|
+
// Check if the device supports Node Naming and Location CC (0x77)
|
|
687
|
+
const supportsNamingCC = typeof node.supportsCC === 'function' &&
|
|
688
|
+
node.supportsCC(core_1.CommandClasses['Node Naming and Location']);
|
|
689
|
+
if (supportsNamingCC) {
|
|
690
|
+
await node.commandClasses['Node Naming and Location'].setName(name);
|
|
691
|
+
}
|
|
692
|
+
else {
|
|
693
|
+
// Fall back to local-only storage if CC is not supported
|
|
694
|
+
this.log.warn(`Node ${nodeId} does not support Node Naming and Location CC, storing name locally only`);
|
|
695
|
+
node.name = name;
|
|
696
|
+
}
|
|
685
697
|
}
|
|
686
698
|
async getAvailableFirmwareUpdates(nodeId) {
|
|
687
699
|
if (nodeId === 1) {
|
|
@@ -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.3",
|
|
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": {
|