node-red-contrib-homebridge-automation 0.1.12-beta.40 → 0.1.12-beta.42

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.
package/README.md CHANGED
@@ -183,6 +183,7 @@ With a plugin, you can see if it supports Real Time events, by opening the Home
183
183
  ### Dec 15, 2024 - Version 0.2.0
184
184
 
185
185
  - Major code base refresh, and migration from hap-node-client to hap-client ( Potential fix for #120 )
186
+ - With the change in connectivity to homebridge, please validate all your nodes are connected after the update. And pay particular attention to `Camera` nodes, as for some devices the name has changed.
186
187
  - Testing and Development was completed on Node-RED version: v4.0.2 and Node.js version: v20.18.1
187
188
 
188
189
  # Backlog / Roadmap
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-homebridge-automation",
3
- "version": "0.1.12-beta.40",
3
+ "version": "0.1.12-beta.42",
4
4
  "description": "NodeRED Automation for HomeBridge",
5
5
  "main": "src/HAP-NodeRed.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@ module.exports = function (RED) {
13
13
 
14
14
  class hbConfigNode extends HBConfigNode {
15
15
  constructor(config) {
16
- debug('hbConfigNode', config);
16
+ debug('hbConfigNode', JSON.stringify(config));
17
17
  super(config, RED);
18
18
  }
19
19
  }
@@ -28,7 +28,6 @@ module.exports = function (RED) {
28
28
 
29
29
  class hbEventNode extends HbEventNode {
30
30
  constructor(config) {
31
- debug('hbEventNode', config);
32
31
  super(config, RED);
33
32
  }
34
33
  }
@@ -37,7 +36,6 @@ module.exports = function (RED) {
37
36
 
38
37
  class hbResumeNode extends HbResumeNode {
39
38
  constructor(config) {
40
- debug('hbResumeNode', config);
41
39
  super(config, RED);
42
40
  }
43
41
  }
@@ -46,7 +44,6 @@ module.exports = function (RED) {
46
44
 
47
45
  class hbControlNode extends HbControlNode {
48
46
  constructor(config) {
49
- debug('hbControlNode', config);
50
47
  super(config, RED);
51
48
  }
52
49
  }
@@ -55,7 +52,6 @@ module.exports = function (RED) {
55
52
 
56
53
  class hbStatusNode extends HbStatusNode {
57
54
  constructor(config) {
58
- debug('hbStatusNode', config);
59
55
  super(config, RED);
60
56
  }
61
57
  }
package/src/hbBaseNode.js CHANGED
@@ -2,7 +2,7 @@ const debug = require('debug')('hapNodeRed:hbBaseNode');
2
2
 
3
3
  class HbBaseNode {
4
4
  constructor(config, RED) {
5
- debug("Constructor:", config);
5
+ debug("Constructor:", config.type, JSON.stringify(config));
6
6
  RED.nodes.createNode(this, config);
7
7
 
8
8
  if (!config.conf) {
@@ -31,7 +31,7 @@ class HbBaseNode {
31
31
  }
32
32
 
33
33
  handleHBEventMessage(service) {
34
- debug('hbEvent for', this.id, service.serviceName, service.values);
34
+ debug('hbEvent for', this.id, this.type, service.serviceName, JSON.stringify(service.values));
35
35
 
36
36
  this.status({
37
37
  text: JSON.stringify(service.values),
@@ -76,7 +76,6 @@ class HBConfigNode {
76
76
  this.hbDevices.push(updatedService);
77
77
  }
78
78
  });
79
-
80
79
  this.evDevices = this.toList({ perms: 'ev' });
81
80
  this.ctDevices = this.toList({ perms: 'pw' });
82
81
  this.log(`Devices initialized: evDevices: ${this.evDevices.length}, ctDevices: ${this.ctDevices.length}`);
@@ -92,7 +91,6 @@ class HBConfigNode {
92
91
  'Outlet', 'Smoke Sensor', 'Speaker', 'Stateless Programmable Switch', 'Switch',
93
92
  'Television', 'Temperature Sensor', 'Thermostat', 'Contact Sensor',
94
93
  ]);
95
-
96
94
  return filterUnique(this.hbDevices)
97
95
  .filter(service => supportedTypes.has(service.humanType))
98
96
  .map(service => ({
@@ -144,7 +142,7 @@ class HBConfigNode {
144
142
  clientNode.hbDevice = matchedDevice;
145
143
  clientNode.status({ fill: 'green', shape: 'dot', text: 'connected' });
146
144
  clientNode.emit('hbReady', matchedDevice);
147
- debug('_Registered: %s type: %s', matchedDevice.type, matchedDevice.serviceName, matchedDevice.instance);
145
+ debug('_Registered: %s type: %s', clientNode.type, matchedDevice.type, matchedDevice.serviceName);
148
146
  } else {
149
147
  this.error(`ERROR: Device registration failed ${clientNode.name}`);
150
148
  }
@@ -158,7 +156,7 @@ class HBConfigNode {
158
156
  const uniqueDevices = new Set();
159
157
 
160
158
  const monitorNodes = Object.values(this.clientNodes)
161
- .filter(node => ['hb-status', 'hb-control'].includes(node.type)) // Filter by type
159
+ .filter(node => ['hb-status', 'hb-control', 'hb-event', 'hb-resume'].includes(node.type)) // Filter by type
162
160
  .filter(node => {
163
161
  if (uniqueDevices.has(node.device)) {
164
162
  return false; // Exclude duplicates
@@ -176,6 +174,7 @@ class HBConfigNode {
176
174
  const eventNodes = Object.values(this.clientNodes).filter(clientNode =>
177
175
  clientNode.config.device === `${service.instance.name}${service.instance.username}${service.accessoryInformation.Manufacturer}${service.serviceName}${service.uuid.slice(0, 8)}`
178
176
  );
177
+ // debug('service-update', service.serviceName, eventNodes);
179
178
  eventNodes.forEach(eventNode => eventNode.emit('hbEvent', service));
180
179
  });
181
180
  });
@@ -230,7 +229,7 @@ class HBConfigNode {
230
229
  const filterUnique = (data) => {
231
230
  const seen = new Set();
232
231
  return data.filter(item => {
233
- const uniqueKey = `${item.aid}-${item.serviceName}-${item.instance.username}-${item.instance.port}`;
232
+ const uniqueKey = `${item.aid}-${item.serviceName}-${item.humanType}-${item.instance.username}-${item.instance.port}`;
234
233
  if (seen.has(uniqueKey)) return false;
235
234
  seen.add(uniqueKey);
236
235
  return true;