homebridge-zwave-usb 2.8.4 → 2.8.7

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.
@@ -42,6 +42,11 @@ class ZWaveAccessory {
42
42
  const nodeName = this.node.name || this.node.deviceConfig?.label || `Node ${this.node.nodeId}`;
43
43
  if (existingAccessory) {
44
44
  this.platformAccessory = existingAccessory;
45
+ // Proactively sync name for cached accessories
46
+ if (this.platformAccessory.displayName !== nodeName) {
47
+ this.platform.log.info(`Updating cached accessory name for Node ${this.node.nodeId}: ${this.platformAccessory.displayName} -> ${nodeName}`);
48
+ this.platformAccessory.displayName = nodeName;
49
+ }
45
50
  }
46
51
  else {
47
52
  this.platform.log.info(`Creating new accessory for ${nodeName} (UUID: ${uuid})`);
@@ -59,10 +64,6 @@ class ZWaveAccessory {
59
64
  .setCharacteristic(this.platform.Characteristic.Manufacturer, manufacturer)
60
65
  .setCharacteristic(this.platform.Characteristic.Model, model)
61
66
  .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);
66
67
  /**
67
68
  * Helper to normalize UUIDs for reliable comparison during metadata pruning.
68
69
  */
@@ -92,24 +93,11 @@ class ZWaveAccessory {
92
93
  rename(newName) {
93
94
  this.platform.log.info(`Syncing HomeKit name for Node ${this.node.nodeId} -> ${newName}`);
94
95
  this.platformAccessory.displayName = newName;
95
- // Update the Accessory Information Service (Most Authoritative)
96
+ // Update the Accessory Information Service (Standard Characteristics Only)
96
97
  const infoService = this.platformAccessory.getService(this.platform.Service.AccessoryInformation);
97
- if (!infoService.testCharacteristic(this.platform.Characteristic.Name)) {
98
- infoService.addOptionalCharacteristic(this.platform.Characteristic.Name);
99
- }
100
- infoService.getCharacteristic(this.platform.Characteristic.Name)
101
- .setProps({
102
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
- perms: [settings_1.HAPPerm.PAIRED_READ, settings_1.HAPPerm.NOTIFY],
104
- });
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);
110
- // Update the Model and Serial if they were using the generic name
98
+ // Update the Model if it was using the generic name
111
99
  const model = this.node.deviceConfig?.label || newName;
112
- infoService.setCharacteristic(this.platform.Characteristic.Model, model);
100
+ infoService.updateCharacteristic(this.platform.Characteristic.Model, model);
113
101
  // Update all features
114
102
  for (const feature of this.features) {
115
103
  feature.rename(newName);
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseFeature = void 0;
4
- const settings_1 = require("../platform/settings");
5
4
  class BaseFeature {
6
5
  platform;
7
6
  accessory;
@@ -28,11 +27,10 @@ class BaseFeature {
28
27
  const serviceName = this.endpoint.index > 0 ? `${newName} ${this.endpoint.index}` : newName;
29
28
  this.platform.log.debug(`Feature Rename [Node ${this.node.nodeId}]: Updating ${this.managedServices.length} services to "${serviceName}"`);
30
29
  for (const service of this.managedServices) {
30
+ // Sync internal property
31
+ service.displayName = serviceName;
31
32
  if (service.testCharacteristic(this.platform.Characteristic.Name)) {
32
- service.updateCharacteristic(this.platform.Characteristic.Name, serviceName);
33
- }
34
- if (service.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
35
- service.updateCharacteristic(this.platform.Characteristic.ConfiguredName, serviceName);
33
+ service.getCharacteristic(this.platform.Characteristic.Name).updateValue(serviceName);
36
34
  }
37
35
  }
38
36
  }
@@ -81,28 +79,15 @@ class BaseFeature {
81
79
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
82
80
  this.accessory.addService(new serviceType(serviceName));
83
81
  }
82
+ // Sync internal property
83
+ service.displayName = serviceName;
84
84
  // Mark the first functional service as primary to help HomeKit with naming/tiles
85
85
  if (this.managedServices.length === 0) {
86
86
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
87
87
  service.setPrimaryService(true);
88
88
  }
89
- // Explicitly set the name characteristic with NOTIFY to ensure it's displayed correctly
90
- service.getCharacteristic(this.platform.Characteristic.Name)
91
- .setProps({
92
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
- perms: [settings_1.HAPPerm.PAIRED_READ, settings_1.HAPPerm.NOTIFY],
94
- });
95
- service.updateCharacteristic(this.platform.Characteristic.Name, serviceName);
96
- // Also set ConfiguredName which many HomeKit versions prioritize for plugin-side renaming
97
- if (!service.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
98
- service.addOptionalCharacteristic(this.platform.Characteristic.ConfiguredName);
99
- }
100
- service.getCharacteristic(this.platform.Characteristic.ConfiguredName)
101
- .setProps({
102
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
- perms: [settings_1.HAPPerm.PAIRED_READ, settings_1.HAPPerm.NOTIFY],
104
- });
105
- service.updateCharacteristic(this.platform.Characteristic.ConfiguredName, serviceName);
89
+ // Explicitly set the name characteristic to ensure it's displayed correctly
90
+ service.getCharacteristic(this.platform.Characteristic.Name).updateValue(serviceName);
106
91
  // Add Service Label Index for multi-endpoint devices to help with ordering/naming
107
92
  if (this.endpoint.index > 0) {
108
93
  if (!service.testCharacteristic(this.platform.Characteristic.ServiceLabelIndex)) {
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",
4
+ "version": "2.8.7",
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": {