homebridge-zwave-usb 2.7.0 → 2.8.1

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.
@@ -26,6 +26,7 @@ class BaseFeature {
26
26
  */
27
27
  rename(newName) {
28
28
  const serviceName = this.endpoint.index > 0 ? `${newName} ${this.endpoint.index}` : newName;
29
+ this.platform.log.debug(`Feature Rename [Node ${this.node.nodeId}]: Updating ${this.managedServices.length} services to "${serviceName}"`);
29
30
  for (const service of this.managedServices) {
30
31
  if (service.testCharacteristic(this.platform.Characteristic.Name)) {
31
32
  service.updateCharacteristic(this.platform.Characteristic.Name, serviceName);
@@ -81,15 +82,15 @@ class BaseFeature {
81
82
  this.accessory.addService(new serviceType(serviceName));
82
83
  }
83
84
  // Explicitly set the name characteristic to ensure it's displayed correctly
84
- const nameChar = service.getCharacteristic(this.platform.Characteristic.Name);
85
- nameChar
85
+ service
86
+ .getCharacteristic(this.platform.Characteristic.Name)
86
87
  .setProps({
87
88
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
89
  format: settings_1.HAPFormat.STRING,
89
90
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
90
91
  perms: [settings_1.HAPPerm.PAIRED_READ, settings_1.HAPPerm.NOTIFY],
91
- })
92
- .updateValue(serviceName);
92
+ });
93
+ service.updateCharacteristic(this.platform.Characteristic.Name, serviceName);
93
94
  // Also set ConfiguredName which many HomeKit versions prioritize for plugin-side renaming
94
95
  if (!service.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
95
96
  service.addOptionalCharacteristic(this.platform.Characteristic.ConfiguredName);
@@ -101,8 +102,8 @@ class BaseFeature {
101
102
  format: settings_1.HAPFormat.STRING,
102
103
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
104
  perms: [settings_1.HAPPerm.PAIRED_READ, settings_1.HAPPerm.NOTIFY],
104
- })
105
- .updateValue(serviceName);
105
+ });
106
+ service.updateCharacteristic(this.platform.Characteristic.ConfiguredName, serviceName);
106
107
  // Add Service Label Index for multi-endpoint devices to help with ordering/naming
107
108
  if (this.endpoint.index > 0) {
108
109
  if (!service.testCharacteristic(this.platform.Characteristic.ServiceLabelIndex)) {
@@ -344,7 +344,8 @@ class ZWaveUsbPlatform {
344
344
  if (existing || this.discoveryInFlight.has(node.nodeId)) {
345
345
  if (existing) {
346
346
  existing.updateNode(node);
347
- if (existing.platformAccessory.displayName !== nodeName) {
347
+ // Force sync names on every ready event if we have a friendly name
348
+ if (node.name) {
348
349
  existing.rename(nodeName);
349
350
  }
350
351
  existing.refresh();
@@ -355,10 +356,9 @@ class ZWaveUsbPlatform {
355
356
  try {
356
357
  const accessory = AccessoryFactory_1.AccessoryFactory.create(this, node, homeId);
357
358
  this.zwaveAccessories.set(node.nodeId, accessory);
358
- if (accessory.platformAccessory.displayName !== nodeName) {
359
- accessory.rename(nodeName);
360
- }
361
- accessory.initialize();
359
+ accessory.initialize(); // Initialize first to create functional services
360
+ // Force sync names immediately after initialization
361
+ accessory.rename(nodeName);
362
362
  }
363
363
  finally {
364
364
  this.discoveryInFlight.delete(node.nodeId);
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.7.0",
4
+ "version": "2.8.1",
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": {