node-red-contrib-homebridge-automation 0.1.12-beta.36 → 0.1.12-beta.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-homebridge-automation",
3
- "version": "0.1.12-beta.36",
3
+ "version": "0.1.12-beta.37",
4
4
  "description": "NodeRED Automation for HomeBridge",
5
5
  "main": "src/HAP-NodeRed.js",
6
6
  "scripts": {
@@ -183,7 +183,12 @@ class HBConfigNode {
183
183
  this.monitor.on('monitor-close', (instance, hadError) => {
184
184
  debug('monitor-close', instance.name, instance.ipAddress, instance.port, hadError)
185
185
  this.disconnectClientNodes(instance);
186
- this.refreshDevices();
186
+ // this.refreshDevices();
187
+ })
188
+ this.monitor.on('monitor-refresh', (instance, hadError) => {
189
+ debug('monitor-refresh', instance.name, instance.ipAddress, instance.port, hadError)
190
+ this.reconnectClientNodes(instance);
191
+ // this.refreshDevices();
187
192
  })
188
193
  this.monitor.on('monitor-error', (instance, hadError) => {
189
194
  debug('monitor-error', instance, hadError)
@@ -203,6 +208,18 @@ class HBConfigNode {
203
208
  });
204
209
  }
205
210
 
211
+ reconnectClientNodes(instance) {
212
+ debug('reconnectClientNodes', `${instance.ipAddress}:${instance.port}`);
213
+ const clientNodes = Object.values(this.clientNodes).filter(clientNode => {
214
+ return `${clientNode.hbDevice.instance.ipAddress}:${clientNode.hbDevice.instance.port}` === `${instance.ipAddress}:${instance.port}`;
215
+ });
216
+
217
+ clientNodes.forEach(clientNode => {
218
+ clientNode.status({ fill: 'green', shape: 'dot', text: 'connected' });
219
+ clientNode.emit('hbReady', clientNode.hbDevice);
220
+ });
221
+ }
222
+
206
223
  close() {
207
224
  debug('hb-config: close');
208
225
  this.hapClient?.destroy();
@@ -61,7 +61,7 @@
61
61
  "vt": "str"
62
62
  }
63
63
  ],
64
- "repeat": "60",
64
+ "repeat": "",
65
65
  "crontab": "",
66
66
  "once": true,
67
67
  "onceDelay": "60",
@@ -300,7 +300,7 @@
300
300
  "topic": "",
301
301
  "payload": "",
302
302
  "payloadType": "date",
303
- "x": 320,
303
+ "x": 280,
304
304
  "y": 260,
305
305
  "wires": [
306
306
  [
@@ -672,7 +672,7 @@
672
672
  "vt": "str"
673
673
  }
674
674
  ],
675
- "repeat": "60",
675
+ "repeat": "",
676
676
  "crontab": "",
677
677
  "once": true,
678
678
  "onceDelay": "60",
@@ -757,7 +757,7 @@
757
757
  "statusVal": "payload",
758
758
  "statusType": "msg",
759
759
  "x": 1190,
760
- "y": 300,
760
+ "y": 280,
761
761
  "wires": []
762
762
  }
763
763
  ]
@@ -300,7 +300,7 @@
300
300
  "topic": "",
301
301
  "payload": "",
302
302
  "payloadType": "date",
303
- "x": 320,
303
+ "x": 280,
304
304
  "y": 260,
305
305
  "wires": [
306
306
  [