node-red-contrib-homebridge-automation 0.2.1-beta.0 → 0.2.1-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-homebridge-automation",
3
- "version": "0.2.1-beta.0",
3
+ "version": "0.2.1-beta.1",
4
4
  "description": "NodeRED Automation for HomeBridge",
5
5
  "main": "src/HAP-NodeRed.js",
6
6
  "scripts": {
@@ -26,36 +26,20 @@ class HBConfigNode {
26
26
 
27
27
  this.hapClient.on('instance-discovered', this.waitForNoMoreDiscoveries);
28
28
  this.hapClient.on('discovery-ended', this.hapClient.refreshInstances);
29
- this.waitForNoMoreDiscoveries();
30
29
  this.on('close', this.close.bind(this));
31
30
  this.refreshInProcess = true; // Prevents multiple refreshes, hapClient kicks of a discovery on start
32
31
  }
33
32
  }
34
33
 
35
- /**
36
- * Start device discovery after monitor reports issues
37
- */
38
-
39
- refreshDevices = () => {
40
- if (!this.refreshInProcess) {
41
-
42
- this.monitor.finish();
43
- this.debug('Monitor reported homebridge stability issues, refreshing devices');
44
- this.hapClient.on('instance-discovered', this.waitForNoMoreDiscoveries);
45
- this.hapClient.resetInstancePool();
46
- this.waitForNoMoreDiscoveries();
47
- }
48
- };
49
-
50
34
  /**
51
35
  * Wait for no more instance discoveries to be made before publishing services
52
36
  */
53
- waitForNoMoreDiscoveries = () => {
37
+ waitForNoMoreDiscoveries = (instance) => {
38
+ debug('Instance discovered: %s - %s %s:%s', instance?.name, instance?.username, instance?.ipAddress, instance?.port);
54
39
  if (!this.discoveryTimeout) {
55
40
  clearTimeout(this.discoveryTimeout);
56
41
  this.discoveryTimeout = setTimeout(() => {
57
42
  this.debug('No more instances discovered, publishing services');
58
- this.hapClient.removeListener('instance-discovered', this.waitForNoMoreDiscoveries);
59
43
  this.handleReady();
60
44
  this.discoveryTimeout = null;
61
45
  this.refreshInProcess = false;
@@ -2094,26 +2094,35 @@ describe('HBConfigNode', () => {
2094
2094
  ];
2095
2095
  });
2096
2096
 
2097
- test('toList filters and maps devices correctly', () => {
2097
+ test('toList filters and maps camera devices correctly', () => {
2098
2098
  const result = node.toList({ perms: 'ev' });
2099
2099
  expect(result).toEqual([
2100
2100
  {
2101
- name: 'Living Room Light',
2102
- fullName: 'Living Room Light - Lightbulb',
2103
- sortName: 'Living Room Light:Lightbulb',
2104
- uniqueId: 'Bridge100:11:22:33:44:55AcmeLiving Room Light12345678',
2105
- homebridge: 'Bridge1',
2106
- service: 'Lightbulb',
2107
- manufacturer: 'Acme',
2101
+ name: 'Backyard',
2102
+ fullName: 'Backyard - CameraRTPStreamManagement',
2103
+ sortName: 'Backyard:CameraRTPStreamManagement',
2104
+ uniqueId: 'homebridge0E:89:A7:DA:D3:21EufyBackyard00000110',
2105
+ homebridge: 'homebridge',
2106
+ service: 'CameraRTPStreamManagement',
2107
+ manufacturer: 'Eufy'
2108
2108
  },
2109
2109
  {
2110
- name: 'Kitchen Switch',
2111
- fullName: 'Kitchen Switch - Switch',
2112
- sortName: 'Kitchen Switch:Switch',
2113
- uniqueId: 'Bridge211:22:33:44:55:66AcmeKitchen Switch87654321',
2114
- homebridge: 'Bridge2',
2115
- service: 'Switch',
2116
- manufacturer: 'Acme',
2110
+ name: 'Backyard',
2111
+ fullName: 'Backyard - MotionSensor',
2112
+ sortName: 'Backyard:MotionSensor',
2113
+ uniqueId: 'homebridge0E:89:A7:DA:D3:21EufyBackyard00000085',
2114
+ homebridge: 'homebridge',
2115
+ service: 'MotionSensor',
2116
+ manufacturer: 'Eufy'
2117
+ },
2118
+ {
2119
+ "fullName": "Canoe 5036 - CameraRTPStreamManagement",
2120
+ "homebridge": "ECI-T24F2",
2121
+ "manufacturer": "HikVision",
2122
+ "name": "Canoe 5036",
2123
+ "service": "CameraRTPStreamManagement",
2124
+ "sortName": "Canoe 5036:CameraRTPStreamManagement",
2125
+ "uniqueId": "ECI-T24F25C:EE:FE:4D:64:B4HikVisionCanoe 503600000110",
2117
2126
  },
2118
2127
  {
2119
2128
  "fullName": "Canoe - MotionSensor",
@@ -2125,28 +2134,28 @@ describe('HBConfigNode', () => {
2125
2134
  "uniqueId": "ECI-T24F25C:EE:FE:4D:64:B4HikVisionCanoe00000085",
2126
2135
  },
2127
2136
  {
2128
- "fullName": "Canoe 5036 - CameraRTPStreamManagement",
2129
- "homebridge": "ECI-T24F2",
2130
- "manufacturer": "HikVision",
2131
- "name": "Canoe 5036",
2132
- "service": "CameraRTPStreamManagement",
2133
- "sortName": "Canoe 5036:CameraRTPStreamManagement",
2134
- "uniqueId": "ECI-T24F25C:EE:FE:4D:64:B4HikVisionCanoe 503600000110",
2137
+ name: 'Kitchen Switch',
2138
+ fullName: 'Kitchen Switch - Switch',
2139
+ sortName: 'Kitchen Switch:Switch',
2140
+ uniqueId: 'Bridge211:22:33:44:55:66AcmeKitchen Switch87654321',
2141
+ homebridge: 'Bridge2',
2142
+ service: 'Switch',
2143
+ manufacturer: 'Acme',
2135
2144
  },
2136
2145
  {
2137
- name: 'Backyard',
2138
- fullName: 'Backyard - MotionSensor',
2139
- sortName: 'Backyard:MotionSensor',
2140
- uniqueId: 'homebridge0E:89:A7:DA:D3:21EufyBackyard00000085',
2141
- homebridge: 'homebridge',
2142
- service: 'MotionSensor',
2143
- manufacturer: 'Eufy'
2146
+ name: 'Living Room Light',
2147
+ fullName: 'Living Room Light - Lightbulb',
2148
+ sortName: 'Living Room Light:Lightbulb',
2149
+ uniqueId: 'Bridge100:11:22:33:44:55AcmeLiving Room Light12345678',
2150
+ homebridge: 'Bridge1',
2151
+ service: 'Lightbulb',
2152
+ manufacturer: 'Acme',
2144
2153
  },
2145
2154
  {
2146
- name: 'Backyard',
2147
- fullName: 'Backyard - CameraRTPStreamManagement',
2148
- sortName: 'Backyard:CameraRTPStreamManagement',
2149
- uniqueId: 'homebridge0E:89:A7:DA:D3:21EufyBackyard00000110',
2155
+ name: 'Side door',
2156
+ fullName: 'Side door - CameraRTPStreamManagement',
2157
+ sortName: 'Side door:CameraRTPStreamManagement',
2158
+ uniqueId: 'homebridge0E:89:A7:DA:D3:21EufySide door00000110',
2150
2159
  homebridge: 'homebridge',
2151
2160
  service: 'CameraRTPStreamManagement',
2152
2161
  manufacturer: 'Eufy'
@@ -2160,15 +2169,6 @@ describe('HBConfigNode', () => {
2160
2169
  service: 'MotionSensor',
2161
2170
  manufacturer: 'Eufy'
2162
2171
  },
2163
- {
2164
- name: 'Side door',
2165
- fullName: 'Side door - CameraRTPStreamManagement',
2166
- sortName: 'Side door:CameraRTPStreamManagement',
2167
- uniqueId: 'homebridge0E:89:A7:DA:D3:21EufySide door00000110',
2168
- homebridge: 'homebridge',
2169
- service: 'CameraRTPStreamManagement',
2170
- manufacturer: 'Eufy'
2171
- }
2172
2172
  ]);
2173
2173
 
2174
2174
  // Ensure the unsupported type was filtered out
@@ -429,7 +429,7 @@
429
429
  },
430
430
  "node-red-contrib-homebridge-automation": {
431
431
  "name": "node-red-contrib-homebridge-automation",
432
- "version": "0.2.0",
432
+ "version": "0.2.1",
433
433
  "local": false,
434
434
  "user": false,
435
435
  "nodes": {
@@ -429,7 +429,7 @@
429
429
  },
430
430
  "node-red-contrib-homebridge-automation": {
431
431
  "name": "node-red-contrib-homebridge-automation",
432
- "version": "0.1.12",
432
+ "version": "0.2.0",
433
433
  "local": false,
434
434
  "user": false,
435
435
  "nodes": {
@@ -1882,7 +1882,8 @@
1882
1882
  "y": 140,
1883
1883
  "wires": [
1884
1884
  [
1885
- "49a103299064c61a"
1885
+ "49a103299064c61a",
1886
+ "4d03a7e3277b96e4"
1886
1887
  ]
1887
1888
  ]
1888
1889
  },
@@ -825,7 +825,7 @@
825
825
  "Manufacturer": "Tasmota",
826
826
  "Service": "Lightbulb",
827
827
  "device": "homebridge1C:22:3D:E3:CF:34TasmotaMaster00000043",
828
- "conf": "557aec8e8c47e61e",
828
+ "conf": "7e647d67.f33acc",
829
829
  "sendInitialState": true,
830
830
  "x": 170,
831
831
  "y": 280,
@@ -22,14 +22,14 @@
22
22
 
23
23
  module.exports = {
24
24
 
25
- /*******************************************************************************
26
- * Flow File and User Directory Settings
27
- * - flowFile
28
- * - credentialSecret
29
- * - flowFilePretty
30
- * - userDir
31
- * - nodesDir
32
- ******************************************************************************/
25
+ /*******************************************************************************
26
+ * Flow File and User Directory Settings
27
+ * - flowFile
28
+ * - credentialSecret
29
+ * - flowFilePretty
30
+ * - userDir
31
+ * - nodesDir
32
+ ******************************************************************************/
33
33
 
34
34
  /** The file containing the flows. If not set, defaults to flows_<hostname>.json **/
35
35
  flowFile: 'flows.json',
@@ -60,15 +60,15 @@ module.exports = {
60
60
  */
61
61
  //nodesDir: '/home/nol/.node-red/nodes',
62
62
 
63
- /*******************************************************************************
64
- * Security
65
- * - adminAuth
66
- * - https
67
- * - httpsRefreshInterval
68
- * - requireHttps
69
- * - httpNodeAuth
70
- * - httpStaticAuth
71
- ******************************************************************************/
63
+ /*******************************************************************************
64
+ * Security
65
+ * - adminAuth
66
+ * - https
67
+ * - httpsRefreshInterval
68
+ * - requireHttps
69
+ * - httpNodeAuth
70
+ * - httpStaticAuth
71
+ ******************************************************************************/
72
72
 
73
73
  /** To password protect the Node-RED editor and admin API, the following
74
74
  * property can be used. See https://nodered.org/docs/security.html for details.
@@ -125,22 +125,22 @@ module.exports = {
125
125
  //httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
126
126
  //httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
127
127
 
128
- /*******************************************************************************
129
- * Server Settings
130
- * - uiPort
131
- * - uiHost
132
- * - apiMaxLength
133
- * - httpServerOptions
134
- * - httpAdminRoot
135
- * - httpAdminMiddleware
136
- * - httpAdminCookieOptions
137
- * - httpNodeRoot
138
- * - httpNodeCors
139
- * - httpNodeMiddleware
140
- * - httpStatic
141
- * - httpStaticRoot
142
- * - httpStaticCors
143
- ******************************************************************************/
128
+ /*******************************************************************************
129
+ * Server Settings
130
+ * - uiPort
131
+ * - uiHost
132
+ * - apiMaxLength
133
+ * - httpServerOptions
134
+ * - httpAdminRoot
135
+ * - httpAdminMiddleware
136
+ * - httpAdminCookieOptions
137
+ * - httpNodeRoot
138
+ * - httpNodeCors
139
+ * - httpNodeMiddleware
140
+ * - httpStatic
141
+ * - httpStaticRoot
142
+ * - httpStaticCors
143
+ ******************************************************************************/
144
144
 
145
145
  /** the tcp port that the Node-RED web server is listening on */
146
146
  uiPort: process.env.PORT || 1880,
@@ -269,16 +269,16 @@ module.exports = {
269
269
  // mode: "legacy", // legacy mode is for non-strict previous proxy determination logic (node-red < v4 compatible)
270
270
  // },
271
271
 
272
- /*******************************************************************************
273
- * Runtime Settings
274
- * - lang
275
- * - runtimeState
276
- * - diagnostics
277
- * - logging
278
- * - contextStorage
279
- * - exportGlobalContextKeys
280
- * - externalModules
281
- ******************************************************************************/
272
+ /*******************************************************************************
273
+ * Runtime Settings
274
+ * - lang
275
+ * - runtimeState
276
+ * - diagnostics
277
+ * - logging
278
+ * - contextStorage
279
+ * - exportGlobalContextKeys
280
+ * - externalModules
281
+ ******************************************************************************/
282
282
 
283
283
  /** Uncomment the following to run node-red in your preferred language.
284
284
  * Available languages include: en-US (default), ja, de, zh-CN, zh-TW, ru, ko
@@ -324,7 +324,7 @@ module.exports = {
324
324
  * trace - record very detailed logging + debug + info + warn + error + fatal errors
325
325
  * off - turn off all logging (doesn't affect metrics or audit)
326
326
  */
327
- level: "info",
327
+ level: "debug",
328
328
  /** Whether or not to include metric events in the log output */
329
329
  metrics: false,
330
330
  /** Whether or not to include audit events in the log output */
@@ -381,11 +381,11 @@ module.exports = {
381
381
  },
382
382
 
383
383
 
384
- /*******************************************************************************
385
- * Editor Settings
386
- * - disableEditor
387
- * - editorTheme
388
- ******************************************************************************/
384
+ /*******************************************************************************
385
+ * Editor Settings
386
+ * - disableEditor
387
+ * - editorTheme
388
+ ******************************************************************************/
389
389
 
390
390
  /** The following property can be used to disable the editor. The admin API
391
391
  * is not affected by this option. To disable both the editor and the admin
@@ -468,28 +468,28 @@ module.exports = {
468
468
  },
469
469
  },
470
470
 
471
- /*******************************************************************************
472
- * Node Settings
473
- * - fileWorkingDirectory
474
- * - functionGlobalContext
475
- * - functionExternalModules
476
- * - functionTimeout
477
- * - nodeMessageBufferMaxLength
478
- * - ui (for use with Node-RED Dashboard)
479
- * - debugUseColors
480
- * - debugMaxLength
481
- * - debugStatusLength
482
- * - execMaxBufferSize
483
- * - httpRequestTimeout
484
- * - mqttReconnectTime
485
- * - serialReconnectTime
486
- * - socketReconnectTime
487
- * - socketTimeout
488
- * - tcpMsgQueueSize
489
- * - inboundWebSocketTimeout
490
- * - tlsConfigDisableLocalFiles
491
- * - webSocketNodeVerifyClient
492
- ******************************************************************************/
471
+ /*******************************************************************************
472
+ * Node Settings
473
+ * - fileWorkingDirectory
474
+ * - functionGlobalContext
475
+ * - functionExternalModules
476
+ * - functionTimeout
477
+ * - nodeMessageBufferMaxLength
478
+ * - ui (for use with Node-RED Dashboard)
479
+ * - debugUseColors
480
+ * - debugMaxLength
481
+ * - debugStatusLength
482
+ * - execMaxBufferSize
483
+ * - httpRequestTimeout
484
+ * - mqttReconnectTime
485
+ * - serialReconnectTime
486
+ * - socketReconnectTime
487
+ * - socketTimeout
488
+ * - tcpMsgQueueSize
489
+ * - inboundWebSocketTimeout
490
+ * - tlsConfigDisableLocalFiles
491
+ * - webSocketNodeVerifyClient
492
+ ******************************************************************************/
493
493
 
494
494
  /** The working directory to handle relative file paths from within the File nodes
495
495
  * defaults to the working directory of the Node-RED process.