node-red-contrib-homekit-bridged 1.7.0-dev.1 → 1.7.0-dev.11

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.
@@ -63,9 +63,14 @@
63
63
  <label for="node-config-input-allowMessagePassthrough" style="width: 70%;">&nbsp;&nbsp;<i class="fa fa-step-forward"></i> Allow Message Passthrough</label>
64
64
  </div>
65
65
  <hr>
66
+ <div class="form-row">
67
+ <label for="node-config-input-bind"><i class="fa fa-filter"></i> Bind</label>
68
+ <input type="text" id="node-config-input-bind" placeholder="::">
69
+ <input type="hidden" id="node-config-input-bindType">
70
+ </div>
66
71
  <div class="form-row">
67
72
  <input type="checkbox" id="node-config-input-customMdnsConfig" style="display: inline-block; width: auto; vertical-align: top;">
68
- <label for="node-config-input-customMdnsConfig" style="width: 70%;">&nbsp;&nbsp;<i class="fa fa-filter"></i> Custom MDNS Configuration</label>
73
+ <label for="node-config-input-customMdnsConfig" style="width: 70%;">&nbsp;&nbsp;<i class="fa fa-filter"></i> Custom MDNS Configuration (DEPRECATED, use Bind)</label>
69
74
  </div>
70
75
  <div id="mdns-configuration" style="display: none;">
71
76
  <div class="form-row">
@@ -114,8 +119,61 @@
114
119
  <li><strong>Hardware Revision</strong>: Should be a version number string in the form of <em>MAJOR.MINOR.REVISION</em> e.g. <em>1.2.0</em>. Other types of strings are ignored and won't be displayed.</li>
115
120
  <li><strong>Software Revision</strong>: Should be a version number string in the form of <em>MAJOR.MINOR.REVISION</em> e.g. <em>1.2.0</em>. Other types of strings are ignored and won't be displayed.</li>
116
121
  <li><strong>Name</strong>: If you intend to simulate a rocket, then why don&#39;t you call it <em>Rocket</em>. Name should be maximum 64 chars long and not contain <pre>.</pre></li>
117
- <li><strong>Allow Message Passthrough</strong>: If you allow then message from node input will be send to node output.</li>
118
- <li><strong>Custom MDNS Configuration</strong>: Check if you would like to use custom mdns configuration.</li>
122
+ <li><strong>Allow Message Passthrough</strong>: If you allow then message from node input will be sent to node output.</li>
123
+ <li><strong>Bind</strong>: Defines the host where the HAP server will be bound to. </li>
124
+ <ul>
125
+ <li>
126
+ Defines the host where the HAP server will be bound to.
127
+ When undefined the HAP server will bind to all available interfaces
128
+ (see https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback).
129
+
130
+ This property accepts a mixture of IPAddresses and network interface names.
131
+ Depending on the mixture of supplied addresses/names hap-nodejs will bind differently.
132
+
133
+ It is advised to not just bind to a specific address, but specifying the interface name
134
+ in oder to bind on all address records (and ip version) available.
135
+
136
+ HAP-NodeJS (or the underlying ciao library) will not report about misspelled interface names,
137
+ as it could be that the interface is currently just down and will come up later.
138
+
139
+ Here are a few examples:
140
+ - bind: "::"
141
+ Pretty much identical to not specifying anything, as most systems (with ipv6 support)
142
+ will default to the unspecified ipv6 address (with dual stack support).
143
+
144
+ - bind: "0.0.0.0"
145
+ Binding TCP socket to the unspecified ipv4 address.
146
+ The mdns advertisement will exclude any ipv6 address records.
147
+
148
+ - bind: ["en0", "lo0"]
149
+ The mdns advertising will advertise all records of the en0 and loopback interface (if available) and
150
+ will also react to address changes on those interfaces.
151
+ In order for the HAP server to accept all those address records (which may contain ipv6 records)
152
+ it will bind on the unspecified ipv6 address "::" (assuming dual stack is supported).
153
+
154
+ - bind: ["en0", "lo0", "0.0.0.0"]
155
+ Same as above, only that the HAP server will bind on the unspecified ipv4 address "0.0.0.0".
156
+ The mdns advertisement will not advertise any ipv6 records.
157
+
158
+ - bind: "169.254.104.90"
159
+ This will bind the HAP server to the address 0.0.0.0.
160
+ The mdns advertisement will only advertise the A record 169.254.104.90.
161
+ If the given network interface of that address encounters an ip address change (to a different address),
162
+ the mdns advertisement will result in not advertising an address at all.
163
+ So it is advised to specify an interface name instead of a specific address.
164
+ This is identical with ipv6 addresses.
165
+
166
+ - bind: ["169.254.104.90", "192.168.1.4"]
167
+ As the HAP TCP socket can only bind to a single address, when specifying multiple ip addresses
168
+ the HAP server will bind to the unspecified ip address (0.0.0.0 if only ipv4 addresses are supplied,
169
+ :: if a mixture or only ipv6 addresses are supplied).
170
+ The mdns advertisement will only advertise the specified ip addresses.
171
+ If the given network interface of that address encounters an ip address change (to different addresses),
172
+ the mdns advertisement will result in not advertising an address at all.
173
+ So it is advised to specify an interface name instead of a specific address.
174
+ </li>
175
+ </ul>
176
+ <li><strong>Custom MDNS Configuration (DEPRECATED, use Bind)</strong>: Check if you would like to use custom mdns configuration.</li>
119
177
  <ul>
120
178
  <li><strong>Multicast</strong>: Use udp multicasting. Optional. Default true.</li>
121
179
  <li><strong>Multicast Interface IP:</strong>: Explicitly specify a network interface. Optional. Defaults to all.</li>
@@ -146,7 +204,7 @@
146
204
  },
147
205
  pinCode: {
148
206
  required: true,
149
- validate: pinCodeRegex,
207
+ validate: validatePinCode,
150
208
  },
151
209
  port: {
152
210
  required: false,
@@ -194,41 +252,46 @@
194
252
  required: false,
195
253
  validate: versionValidator,
196
254
  },
255
+ bind: {
256
+ value: undefined,
257
+ required: false,
258
+ },
259
+ bindType: {
260
+ value: undefined,
261
+ required: false,
262
+ },
197
263
  customMdnsConfig: {
198
264
  value: false,
199
265
  required: false,
266
+ validate: (value) => !value
200
267
  },
201
268
  mdnsMulticast: {
202
269
  value: true,
203
- required: false,
270
+ required: false
204
271
  },
205
272
  mdnsInterface: {
206
- required: false,
273
+ required: false
207
274
  },
208
275
  mdnsPort: {
209
- required: false,
210
- validate: function (value) {
211
- if (value) return RED.validators.port(value)
212
- else return true
213
- },
276
+ required: false
214
277
  },
215
278
  mdnsIp: {
216
- required: false,
279
+ required: false
217
280
  },
218
281
  mdnsTtl: {
219
- required: false,
282
+ required: false
220
283
  },
221
284
  mdnsLoopback: {
222
285
  value: true,
223
- required: false,
286
+ required: false
224
287
  },
225
288
  mdnsReuseAddr: {
226
289
  value: true,
227
- required: false,
290
+ required: false
228
291
  },
229
292
  allowMessagePassthrough: {
230
293
  value: true,
231
- required: true,
294
+ required: true
232
295
  },
233
296
  },
234
297
  label: function () {
@@ -240,9 +303,9 @@
240
303
  oneditprepare: function () {
241
304
  const node = this
242
305
 
243
- if (!pinCodeRegex(node.pinCode)) {
306
+ if (!validatePinCode(node.pinCode)) {
244
307
  node.pinCode = generatePinCode()
245
- $("#node-config-input-pinCode").val(node.pinCode)
308
+ $('#node-config-input-pinCode').val(this.pinCode)
246
309
  }
247
310
 
248
311
  $('#node-config-input-allowMessagePassthrough').prop(
@@ -265,22 +328,28 @@
265
328
  })
266
329
  .change()
267
330
 
268
- const selectCategoryName = $("#node-config-input-accessoryCategory");
331
+ const selectCategoryName = $('#node-config-input-accessoryCategory')
269
332
 
270
333
  Object.entries(accessoryCategories).forEach(([key, value]) => {
271
334
  selectCategoryName.append(
272
- $("<option></option>")
335
+ $('<option></option>')
273
336
  .val(key)
274
337
  .text(value)
275
- );
338
+ )
276
339
  })
277
340
 
278
341
  selectCategoryName
279
- .find("option")
342
+ .find('option')
280
343
  .filter(function () {
281
- return $(this).val() === node.accessoryCategory;
344
+ return $(this).val() === node.accessoryCategory
282
345
  })
283
- .attr("selected", 'true');
346
+ .attr('selected', 'true')
347
+
348
+ $('#node-config-input-bind').typedInput({
349
+ typeField: '#node-config-input-bindType',
350
+ default: 'str',
351
+ types: ['json', 'str']
352
+ })
284
353
  },
285
354
  })
286
355
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-homekit-bridged",
3
- "version": "1.7.0-dev.1",
3
+ "version": "1.7.0-dev.11",
4
4
  "description": "Node-RED nodes to simulate Apple HomeKit devices.",
5
5
  "main": "build/nodes/nrchkb.js",
6
6
  "scripts": {
@@ -42,37 +42,37 @@
42
42
  },
43
43
  "homepage": "https://github.com/NRCHKB/node-red-contrib-homekit-bridged#readme",
44
44
  "dependencies": {
45
- "@nrchkb/logger": "^2.0.2",
46
- "hap-nodejs": "0.12.2",
47
- "node-persist": "^4.0.1",
48
- "semver": "^7.6.2",
49
- "uuid": "^10.0.0"
45
+ "@nrchkb/logger": "~3.1.1",
46
+ "hap-nodejs": "0.12.3-beta.18",
47
+ "node-persist": "^3.1.3",
48
+ "semver": "~7.6.2",
49
+ "uuid": "~10.0.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@homebridge/ciao": "^1.2.0",
53
- "@node-red/registry": "^3.1.10",
54
- "@types/mocha": "^10.0.6",
52
+ "@homebridge/ciao": "~1.3.0",
53
+ "@node-red/registry": "^4.0.2",
54
+ "@types/mocha": "^10.0.7",
55
55
  "@types/node": "^18",
56
56
  "@types/node-persist": "^3.1.8",
57
57
  "@types/node-red": "^1.3.5",
58
58
  "@types/node-red-node-test-helper": "^0.3.4",
59
59
  "@types/semver": "^7.5.8",
60
- "@types/uuid": "^9.0.8",
61
- "@typescript-eslint/eslint-plugin": "^7.13.0",
62
- "@typescript-eslint/parser": "^7.13.0",
60
+ "@types/uuid": "^10.0.0",
61
+ "@typescript-eslint/eslint-plugin": "^7.16.0",
62
+ "@typescript-eslint/parser": "^7.16.0",
63
63
  "babel-eslint": "^10.1.0",
64
64
  "del-cli": "^5.1.0",
65
65
  "eslint": "^8",
66
66
  "eslint-config-prettier": "^9.1.0",
67
67
  "eslint-plugin-prettier": "^5.1.3",
68
- "eslint-plugin-simple-import-sort": "^12.1.0",
68
+ "eslint-plugin-simple-import-sort": "^12.1.1",
69
69
  "husky": "^9.0.11",
70
- "mocha": "^10.4.0",
71
- "node-red": "^3.1.10",
70
+ "mocha": "^10.6.0",
71
+ "node-red": "^4.0.2",
72
72
  "node-red-node-test-helper": "^0.3.4",
73
73
  "prettier": "^3.3.2",
74
74
  "ts-node": "^10.9.2",
75
- "typescript": "^5.4.5"
75
+ "typescript": "^5.5.3"
76
76
  },
77
77
  "engines": {
78
78
  "node": ">=18"