node-red-contrib-homekit-bridged 1.7.0-dev.0 → 1.7.0-dev.10
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/LICENSE +1 -1
- package/build/lib/HAPHostNode.js +21 -10
- package/build/lib/HAPServiceNode.js +4 -2
- package/build/lib/HAPServiceNode2.js +4 -2
- package/build/lib/api.js +12 -11
- package/build/lib/hap/HAPCharacteristic.d.ts +9 -0
- package/build/lib/hap/HAPCharacteristic.js +6 -0
- package/build/lib/hap/HAPService.d.ts +6 -0
- package/build/lib/hap/HAPService.js +6 -0
- package/build/lib/hap/eve-app/EveCharacteristics.d.ts +20 -0
- package/build/lib/hap/eve-app/EveCharacteristics.js +89 -0
- package/build/lib/hap/eve-app/EveServices.d.ts +5 -0
- package/build/lib/hap/eve-app/EveServices.js +20 -0
- package/build/lib/types/HAPHostConfigType.d.ts +3 -1
- package/build/lib/types/HAPHostNodeType.d.ts +2 -3
- package/build/lib/types/HAPService2ConfigType.d.ts +3 -20
- package/build/lib/types/HAPService2NodeType.d.ts +1 -30
- package/build/lib/types/HAPServiceConfigType.d.ts +4 -0
- package/build/lib/types/HAPServiceNodeType.d.ts +2 -1
- package/build/lib/types/PublishTimersType.d.ts +0 -1
- package/build/lib/types/hap-nodejs/BonjourMulticastOptions.d.ts +10 -0
- package/build/lib/types/hap-nodejs/BonjourMulticastOptions.js +2 -0
- package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.d.ts +5 -0
- package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.js +8 -0
- package/build/lib/utils/NodeStatusUtils.d.ts +0 -1
- package/build/lib/utils/ServiceUtils.js +101 -12
- package/build/lib/utils/ServiceUtils2.js +17 -7
- package/build/nodes/bridge.html +87 -18
- package/build/nodes/nrchkb.html +148 -117
- package/build/nodes/service.html +41 -1
- package/build/nodes/service2.html +41 -1
- package/build/nodes/standalone.html +93 -24
- package/package.json +12 -12
- /package/build/lib/types/{HapCategories.d.ts → hap-nodejs/HapCategories.d.ts} +0 -0
- /package/build/lib/types/{HapCategories.js → hap-nodejs/HapCategories.js} +0 -0
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const util = __importStar(require("node:util"));
|
|
6
30
|
const logger_1 = require("@nrchkb/logger");
|
|
7
31
|
const hap_nodejs_1 = require("hap-nodejs");
|
|
8
32
|
const NRCHKBError_1 = __importDefault(require("../NRCHKBError"));
|
|
@@ -32,7 +56,7 @@ module.exports = function (node) {
|
|
|
32
56
|
};
|
|
33
57
|
const onCharacteristicGet = function (callback, context, connection) {
|
|
34
58
|
var _a, _b;
|
|
35
|
-
log.debug(`onCharacteristicGet with status: ${this.statusCode}, value: ${this.value}, reachability is ${((_a = node.parentNode) !== null && _a !== void 0 ? _a : node).reachable} with context ${
|
|
59
|
+
log.debug(`onCharacteristicGet with status: ${this.statusCode}, value: ${this.value}, reachability is ${((_a = node.parentNode) !== null && _a !== void 0 ? _a : node).reachable} with context ${util.inspect(context)} on connection ${connection === null || connection === void 0 ? void 0 : connection.sessionID}`);
|
|
36
60
|
if (callback) {
|
|
37
61
|
try {
|
|
38
62
|
callback(((_b = node.parentNode) !== null && _b !== void 0 ? _b : node).reachable
|
|
@@ -92,7 +116,7 @@ module.exports = function (node) {
|
|
|
92
116
|
const onCharacteristicSet = (allCharacteristics) => function (newValue, callback, context, connection) {
|
|
93
117
|
var _a, _b;
|
|
94
118
|
log.debug(`onCharacteristicSet with status: ${this.statusCode}, value: ${this.value}, reachability is ${((_a = node.parentNode) !== null && _a !== void 0 ? _a : node).reachable}
|
|
95
|
-
with context ${
|
|
119
|
+
with context ${util.inspect(context)} on connection ${connection === null || connection === void 0 ? void 0 : connection.sessionID}`);
|
|
96
120
|
try {
|
|
97
121
|
if (callback) {
|
|
98
122
|
callback(((_b = node.parentNode) !== null && _b !== void 0 ? _b : node).reachable
|
|
@@ -110,7 +134,7 @@ module.exports = function (node) {
|
|
|
110
134
|
var _a;
|
|
111
135
|
const { oldValue, newValue, context, originator, reason } = change;
|
|
112
136
|
log.debug(`onCharacteristicChange with reason: ${reason}, oldValue: ${oldValue}, newValue: ${newValue}, reachability is ${((_a = node.parentNode) !== null && _a !== void 0 ? _a : node).reachable}
|
|
113
|
-
with context ${
|
|
137
|
+
with context ${util.inspect(context)} on connection ${originator === null || originator === void 0 ? void 0 : originator.sessionID}`);
|
|
114
138
|
if (oldValue != newValue) {
|
|
115
139
|
onValueChange.call(this, allCharacteristics, 0, {
|
|
116
140
|
oldValue,
|
|
@@ -120,7 +144,8 @@ module.exports = function (node) {
|
|
|
120
144
|
}
|
|
121
145
|
};
|
|
122
146
|
const onInput = function (msg) {
|
|
123
|
-
|
|
147
|
+
var _a, _b;
|
|
148
|
+
if (msg.payload) {
|
|
124
149
|
const type = typeof msg.payload;
|
|
125
150
|
if (type !== 'object') {
|
|
126
151
|
log.error(`Invalid payload type: ${type}`);
|
|
@@ -131,29 +156,39 @@ module.exports = function (node) {
|
|
|
131
156
|
log.error('Invalid message (payload missing)');
|
|
132
157
|
return;
|
|
133
158
|
}
|
|
134
|
-
const topic = node.config.topic ?
|
|
159
|
+
const topic = (_a = node.config.topic) !== null && _a !== void 0 ? _a : node.name;
|
|
135
160
|
if (node.config.filter && msg.topic !== topic) {
|
|
136
161
|
log.debug("msg.topic doesn't match configured value and filter is enabled. Dropping message.");
|
|
137
162
|
return;
|
|
138
163
|
}
|
|
139
164
|
let context = null;
|
|
140
|
-
if (msg.payload.
|
|
165
|
+
if (msg.payload.Context) {
|
|
141
166
|
context = msg.payload.Context;
|
|
142
167
|
delete msg.payload.Context;
|
|
143
168
|
}
|
|
144
|
-
node.topic_in = msg.topic ?
|
|
169
|
+
node.topic_in = (_b = msg.topic) !== null && _b !== void 0 ? _b : '';
|
|
145
170
|
Object.keys(msg.payload).map((key) => {
|
|
146
|
-
var _a, _b;
|
|
171
|
+
var _a, _b, _c, _d;
|
|
147
172
|
if (node.supported.indexOf(key) < 0) {
|
|
148
|
-
|
|
173
|
+
if (key === 'AdaptiveLightingController' &&
|
|
174
|
+
node.adaptiveLightingController) {
|
|
175
|
+
const value = (_a = msg.payload) === null || _a === void 0 ? void 0 : _a[key];
|
|
176
|
+
const event = value === null || value === void 0 ? void 0 : value.event;
|
|
177
|
+
if (event === 'disable') {
|
|
178
|
+
(_b = node.adaptiveLightingController) === null || _b === void 0 ? void 0 : _b.disableAdaptiveLighting();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
log.error(`Instead of '${key}' try one of these characteristics: '${node.supported.join("', '")}'`);
|
|
183
|
+
}
|
|
149
184
|
}
|
|
150
185
|
else {
|
|
151
|
-
const value = (
|
|
152
|
-
const parentNode = (
|
|
186
|
+
const value = (_c = msg.payload) === null || _c === void 0 ? void 0 : _c[key];
|
|
187
|
+
const parentNode = (_d = node.parentNode) !== null && _d !== void 0 ? _d : node;
|
|
153
188
|
parentNode.reachable = value !== NO_RESPONSE_MSG;
|
|
154
189
|
const characteristic = node.service.getCharacteristic(Characteristic[key]);
|
|
155
190
|
if (context !== null) {
|
|
156
|
-
characteristic.setValue(value, context);
|
|
191
|
+
characteristic.setValue(value, undefined, context);
|
|
157
192
|
}
|
|
158
193
|
else {
|
|
159
194
|
characteristic.setValue(value);
|
|
@@ -274,6 +309,59 @@ module.exports = function (node) {
|
|
|
274
309
|
log.error('Invalid message (required {"payload":{"nrchkb":{"setup":{}}}})');
|
|
275
310
|
}
|
|
276
311
|
};
|
|
312
|
+
const configureAdaptiveLightning = () => {
|
|
313
|
+
if (node.service.UUID === Service.Lightbulb.UUID &&
|
|
314
|
+
node.config.adaptiveLightingOptionsEnable) {
|
|
315
|
+
try {
|
|
316
|
+
node.service.getCharacteristic(Characteristic.Brightness);
|
|
317
|
+
node.service.getCharacteristic(Characteristic.ColorTemperature);
|
|
318
|
+
const options = {
|
|
319
|
+
controllerMode: node.config.adaptiveLightingOptionsMode
|
|
320
|
+
? +node.config.adaptiveLightingOptionsMode
|
|
321
|
+
: 1,
|
|
322
|
+
customTemperatureAdjustment: node.config
|
|
323
|
+
.adaptiveLightingOptionsCustomTemperatureAdjustment
|
|
324
|
+
? +node.config
|
|
325
|
+
.adaptiveLightingOptionsCustomTemperatureAdjustment
|
|
326
|
+
: undefined,
|
|
327
|
+
};
|
|
328
|
+
log.trace(`Configuring Adaptive Lighting with options: ${options}`);
|
|
329
|
+
const adaptiveLightingController = new hap_nodejs_1.AdaptiveLightingController(node.service, options);
|
|
330
|
+
adaptiveLightingController.on('update', () => {
|
|
331
|
+
const activeAdaptiveLightingTransition = {
|
|
332
|
+
transitionStartMillis: adaptiveLightingController.getAdaptiveLightingStartTimeOfTransition(),
|
|
333
|
+
timeMillisOffset: adaptiveLightingController.getAdaptiveLightingTimeOffset(),
|
|
334
|
+
transitionCurve: adaptiveLightingController.getAdaptiveLightingTransitionCurve(),
|
|
335
|
+
brightnessAdjustmentRange: adaptiveLightingController.getAdaptiveLightingBrightnessMultiplierRange(),
|
|
336
|
+
updateInterval: adaptiveLightingController.getAdaptiveLightingUpdateInterval(),
|
|
337
|
+
notifyIntervalThreshold: adaptiveLightingController.getAdaptiveLightingNotifyIntervalThreshold(),
|
|
338
|
+
};
|
|
339
|
+
node.send({
|
|
340
|
+
payload: {
|
|
341
|
+
AdaptiveLightingController: {
|
|
342
|
+
event: 'update',
|
|
343
|
+
data: activeAdaptiveLightingTransition,
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
adaptiveLightingController.on('disable', () => {
|
|
349
|
+
node.send({
|
|
350
|
+
payload: {
|
|
351
|
+
AdaptiveLightingController: {
|
|
352
|
+
event: 'disable',
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
node.accessory.configureController(adaptiveLightingController);
|
|
358
|
+
node.adaptiveLightingController = adaptiveLightingController;
|
|
359
|
+
}
|
|
360
|
+
catch (error) {
|
|
361
|
+
log.error(`Failed to configure Adaptive Lightning due to ${error}`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
};
|
|
277
365
|
return {
|
|
278
366
|
getOrCreate,
|
|
279
367
|
onCharacteristicGet,
|
|
@@ -283,5 +371,6 @@ module.exports = function (node) {
|
|
|
283
371
|
onClose,
|
|
284
372
|
waitForParent,
|
|
285
373
|
handleWaitForSetup,
|
|
374
|
+
configureAdaptiveLightning,
|
|
286
375
|
};
|
|
287
376
|
};
|
|
@@ -9,6 +9,7 @@ const NRCHKBError_1 = __importDefault(require("../NRCHKBError"));
|
|
|
9
9
|
const Storage_1 = require("../Storage");
|
|
10
10
|
module.exports = function (node) {
|
|
11
11
|
const log = (0, logger_1.logger)('NRCHKB', 'ServiceUtils2', node.config.name, node);
|
|
12
|
+
const ServiceUtilsLegacy = require('./ServiceUtils')(node);
|
|
12
13
|
const HapNodeJS = require('hap-nodejs');
|
|
13
14
|
const Service = HapNodeJS.Service;
|
|
14
15
|
const Characteristic = HapNodeJS.Characteristic;
|
|
@@ -127,7 +128,7 @@ module.exports = function (node) {
|
|
|
127
128
|
}
|
|
128
129
|
};
|
|
129
130
|
const onInput = function (msg) {
|
|
130
|
-
var _a;
|
|
131
|
+
var _a, _b;
|
|
131
132
|
if (msg.payload) {
|
|
132
133
|
const type = typeof msg.payload;
|
|
133
134
|
if (type !== 'object') {
|
|
@@ -139,7 +140,7 @@ module.exports = function (node) {
|
|
|
139
140
|
log.error('Invalid message (payload missing)');
|
|
140
141
|
return;
|
|
141
142
|
}
|
|
142
|
-
const topic = node.config.topic ?
|
|
143
|
+
const topic = (_a = node.config.topic) !== null && _a !== void 0 ? _a : node.name;
|
|
143
144
|
if (node.config.filter && msg.topic !== topic) {
|
|
144
145
|
log.debug("msg.topic doesn't match configured value and filter is enabled. Dropping message.");
|
|
145
146
|
return;
|
|
@@ -149,9 +150,9 @@ module.exports = function (node) {
|
|
|
149
150
|
context = msg.payload.Context;
|
|
150
151
|
delete msg.payload.Context;
|
|
151
152
|
}
|
|
152
|
-
node.topic_in = (
|
|
153
|
+
node.topic_in = (_b = msg.topic) !== null && _b !== void 0 ? _b : '';
|
|
153
154
|
Object.keys(msg.payload).map((key) => {
|
|
154
|
-
var _a, _b, _c;
|
|
155
|
+
var _a, _b, _c, _d, _e;
|
|
155
156
|
if (node.supported.indexOf(key) < 0) {
|
|
156
157
|
if (node.config.useEventCallback &&
|
|
157
158
|
Storage_1.Storage.uuid4Validate(key)) {
|
|
@@ -166,17 +167,25 @@ module.exports = function (node) {
|
|
|
166
167
|
log.error(`Callback ${callbackID} timeout`);
|
|
167
168
|
}
|
|
168
169
|
}
|
|
170
|
+
else if (key === 'AdaptiveLightingController' &&
|
|
171
|
+
node.adaptiveLightingController) {
|
|
172
|
+
const value = (_b = msg.payload) === null || _b === void 0 ? void 0 : _b[key];
|
|
173
|
+
const event = value === null || value === void 0 ? void 0 : value.event;
|
|
174
|
+
if (event === 'disable') {
|
|
175
|
+
(_c = node.adaptiveLightingController) === null || _c === void 0 ? void 0 : _c.disableAdaptiveLighting();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
169
178
|
else {
|
|
170
179
|
log.error(`Instead of '${key}' try one of these characteristics: '${node.supported.join("', '")}'`);
|
|
171
180
|
}
|
|
172
181
|
}
|
|
173
182
|
else {
|
|
174
|
-
const value = (
|
|
175
|
-
const parentNode = (
|
|
183
|
+
const value = (_d = msg.payload) === null || _d === void 0 ? void 0 : _d[key];
|
|
184
|
+
const parentNode = (_e = node.parentNode) !== null && _e !== void 0 ? _e : node;
|
|
176
185
|
parentNode.reachable = value !== NO_RESPONSE_MSG;
|
|
177
186
|
const characteristic = node.service.getCharacteristic(Characteristic[key]);
|
|
178
187
|
if (context !== null) {
|
|
179
|
-
characteristic.setValue(value, context);
|
|
188
|
+
characteristic.setValue(value, undefined, context);
|
|
180
189
|
}
|
|
181
190
|
else {
|
|
182
191
|
characteristic.setValue(value);
|
|
@@ -306,5 +315,6 @@ module.exports = function (node) {
|
|
|
306
315
|
onClose,
|
|
307
316
|
waitForParent,
|
|
308
317
|
handleWaitForSetup,
|
|
318
|
+
configureAdaptiveLightning: ServiceUtilsLegacy.configureAdaptiveLightning,
|
|
309
319
|
};
|
|
310
320
|
};
|
package/build/nodes/bridge.html
CHANGED
|
@@ -55,9 +55,14 @@
|
|
|
55
55
|
<label for="node-config-input-allowMessagePassthrough" style="width: 70%;"> <i class="fa fa-step-forward"></i> Allow Message Passthrough</label>
|
|
56
56
|
</div>
|
|
57
57
|
<hr>
|
|
58
|
+
<div class="form-row">
|
|
59
|
+
<label for="node-config-input-bind"><i class="fa fa-filter"></i> Bind</label>
|
|
60
|
+
<input type="text" id="node-config-input-bind" placeholder="::">
|
|
61
|
+
<input type="hidden" id="node-config-input-bindType">
|
|
62
|
+
</div>
|
|
58
63
|
<div class="form-row">
|
|
59
64
|
<input type="checkbox" id="node-config-input-customMdnsConfig" style="display: inline-block; width: auto; vertical-align: top;">
|
|
60
|
-
<label for="node-config-input-customMdnsConfig" style="width: 70%;"> <i class="fa fa-filter"></i> Custom MDNS Configuration</label>
|
|
65
|
+
<label for="node-config-input-customMdnsConfig" style="width: 70%;"> <i class="fa fa-filter"></i> Custom MDNS Configuration (DEPRECATED, use Bind)</label>
|
|
61
66
|
</div>
|
|
62
67
|
<div id="mdns-configuration" style="display: none;">
|
|
63
68
|
<div class="form-row">
|
|
@@ -95,7 +100,7 @@
|
|
|
95
100
|
|
|
96
101
|
<script data-help-name="homekit-bridge" type="text/x-red">
|
|
97
102
|
<h3 id="toc_4">Bridge</h3>
|
|
98
|
-
<p>The Bridge node is a configuration node, specifying the <em>bridge</em> that iOS sees, i.e. the device that is manually being added by the user. All accessories behind a bridge
|
|
103
|
+
<p>The Bridge node is a configuration node, specifying the <em>bridge</em> that iOS sees, i.e. the device that is manually being added by the user. All accessories behind a bridge node are then automatically added by iOS.
|
|
99
104
|
</p>
|
|
100
105
|
<ul>
|
|
101
106
|
<li><strong>Pin Code</strong>: Specify the Pin for the pairing process.</li>
|
|
@@ -107,8 +112,61 @@
|
|
|
107
112
|
<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>
|
|
108
113
|
<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>
|
|
109
114
|
<li><strong>Name</strong>: If you intend to simulate a rocket, then why don't you call it <em>Rocket</em>. Name should be maximum 64 chars long and not contain <pre>.</pre></li>
|
|
110
|
-
<li><strong>Allow Message Passthrough</strong>: If you allow then message from node input will be
|
|
111
|
-
<li><strong>
|
|
115
|
+
<li><strong>Allow Message Passthrough</strong>: If you allow then message from node input will be sent to node output.</li>
|
|
116
|
+
<li><strong>Bind</strong>: Defines the host where the HAP server will be bound to. </li>
|
|
117
|
+
<ul>
|
|
118
|
+
<li>
|
|
119
|
+
Defines the host where the HAP server will be bound to.
|
|
120
|
+
When undefined the HAP server will bind to all available interfaces
|
|
121
|
+
(see https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback).
|
|
122
|
+
|
|
123
|
+
This property accepts a mixture of IPAddresses and network interface names.
|
|
124
|
+
Depending on the mixture of supplied addresses/names hap-nodejs will bind differently.
|
|
125
|
+
|
|
126
|
+
It is advised to not just bind to a specific address, but specifying the interface name
|
|
127
|
+
in oder to bind on all address records (and ip version) available.
|
|
128
|
+
|
|
129
|
+
HAP-NodeJS (or the underlying ciao library) will not report about misspelled interface names,
|
|
130
|
+
as it could be that the interface is currently just down and will come up later.
|
|
131
|
+
|
|
132
|
+
Here are a few examples:
|
|
133
|
+
- bind: "::"
|
|
134
|
+
Pretty much identical to not specifying anything, as most systems (with ipv6 support)
|
|
135
|
+
will default to the unspecified ipv6 address (with dual stack support).
|
|
136
|
+
|
|
137
|
+
- bind: "0.0.0.0"
|
|
138
|
+
Binding TCP socket to the unspecified ipv4 address.
|
|
139
|
+
The mdns advertisement will exclude any ipv6 address records.
|
|
140
|
+
|
|
141
|
+
- bind: ["en0", "lo0"]
|
|
142
|
+
The mdns advertising will advertise all records of the en0 and loopback interface (if available) and
|
|
143
|
+
will also react to address changes on those interfaces.
|
|
144
|
+
In order for the HAP server to accept all those address records (which may contain ipv6 records)
|
|
145
|
+
it will bind on the unspecified ipv6 address "::" (assuming dual stack is supported).
|
|
146
|
+
|
|
147
|
+
- bind: ["en0", "lo0", "0.0.0.0"]
|
|
148
|
+
Same as above, only that the HAP server will bind on the unspecified ipv4 address "0.0.0.0".
|
|
149
|
+
The mdns advertisement will not advertise any ipv6 records.
|
|
150
|
+
|
|
151
|
+
- bind: "169.254.104.90"
|
|
152
|
+
This will bind the HAP server to the address 0.0.0.0.
|
|
153
|
+
The mdns advertisement will only advertise the A record 169.254.104.90.
|
|
154
|
+
If the given network interface of that address encounters an ip address change (to a different address),
|
|
155
|
+
the mdns advertisement will result in not advertising an address at all.
|
|
156
|
+
So it is advised to specify an interface name instead of a specific address.
|
|
157
|
+
This is identical with ipv6 addresses.
|
|
158
|
+
|
|
159
|
+
- bind: ["169.254.104.90", "192.168.1.4"]
|
|
160
|
+
As the HAP TCP socket can only bind to a single address, when specifying multiple ip addresses
|
|
161
|
+
the HAP server will bind to the unspecified ip address (0.0.0.0 if only ipv4 addresses are supplied,
|
|
162
|
+
:: if a mixture or only ipv6 addresses are supplied).
|
|
163
|
+
The mdns advertisement will only advertise the specified ip addresses.
|
|
164
|
+
If the given network interface of that address encounters an ip address change (to different addresses),
|
|
165
|
+
the mdns advertisement will result in not advertising an address at all.
|
|
166
|
+
So it is advised to specify an interface name instead of a specific address.
|
|
167
|
+
</li>
|
|
168
|
+
</ul>
|
|
169
|
+
<li><strong>Custom MDNS Configuration (DEPRECATED, use Bind)</strong>: Check if you would like to use custom mdns configuration.</li>
|
|
112
170
|
<ul>
|
|
113
171
|
<li><strong>Multicast</strong>: Use udp multicasting. Optional. Default true.</li>
|
|
114
172
|
<li><strong>Multicast Interface IP:</strong>: Explicitly specify a network interface. Optional. Defaults to all.</li>
|
|
@@ -137,7 +195,7 @@
|
|
|
137
195
|
},
|
|
138
196
|
pinCode: {
|
|
139
197
|
required: true,
|
|
140
|
-
validate:
|
|
198
|
+
validate: validatePinCode,
|
|
141
199
|
},
|
|
142
200
|
port: {
|
|
143
201
|
required: false,
|
|
@@ -185,37 +243,42 @@
|
|
|
185
243
|
required: false,
|
|
186
244
|
validate: versionValidator,
|
|
187
245
|
},
|
|
246
|
+
bind: {
|
|
247
|
+
value: undefined,
|
|
248
|
+
required: false,
|
|
249
|
+
},
|
|
250
|
+
bindType: {
|
|
251
|
+
value: undefined,
|
|
252
|
+
required: false,
|
|
253
|
+
},
|
|
188
254
|
customMdnsConfig: {
|
|
189
255
|
value: false,
|
|
190
256
|
required: false,
|
|
257
|
+
validate: (value) => !value
|
|
191
258
|
},
|
|
192
259
|
mdnsMulticast: {
|
|
193
260
|
value: true,
|
|
194
|
-
required: false
|
|
261
|
+
required: false
|
|
195
262
|
},
|
|
196
263
|
mdnsInterface: {
|
|
197
|
-
required: false
|
|
264
|
+
required: false
|
|
198
265
|
},
|
|
199
266
|
mdnsPort: {
|
|
200
|
-
required: false
|
|
201
|
-
validate: function (value) {
|
|
202
|
-
if (value) return RED.validators.port(value)
|
|
203
|
-
else return true
|
|
204
|
-
},
|
|
267
|
+
required: false
|
|
205
268
|
},
|
|
206
269
|
mdnsIp: {
|
|
207
|
-
required: false
|
|
270
|
+
required: false
|
|
208
271
|
},
|
|
209
272
|
mdnsTtl: {
|
|
210
|
-
required: false
|
|
273
|
+
required: false
|
|
211
274
|
},
|
|
212
275
|
mdnsLoopback: {
|
|
213
276
|
value: true,
|
|
214
|
-
required: false
|
|
277
|
+
required: false
|
|
215
278
|
},
|
|
216
279
|
mdnsReuseAddr: {
|
|
217
280
|
value: true,
|
|
218
|
-
required: false
|
|
281
|
+
required: false
|
|
219
282
|
},
|
|
220
283
|
allowMessagePassthrough: {
|
|
221
284
|
value: true,
|
|
@@ -229,9 +292,9 @@
|
|
|
229
292
|
return this.bridgeName ? 'node_label_italic' : ''
|
|
230
293
|
},
|
|
231
294
|
oneditprepare: function () {
|
|
232
|
-
if (!
|
|
295
|
+
if (!validatePinCode(this.pinCode)) {
|
|
233
296
|
this.pinCode = generatePinCode()
|
|
234
|
-
$(
|
|
297
|
+
$('#node-config-input-pinCode').val(this.pinCode)
|
|
235
298
|
}
|
|
236
299
|
|
|
237
300
|
if (typeof this.allowMessagePassthrough == 'undefined') {
|
|
@@ -256,6 +319,12 @@
|
|
|
256
319
|
}
|
|
257
320
|
})
|
|
258
321
|
.change()
|
|
322
|
+
|
|
323
|
+
$('#node-config-input-bind').typedInput({
|
|
324
|
+
typeField: '#node-config-input-bindType',
|
|
325
|
+
default: 'str',
|
|
326
|
+
types: ['json', 'str']
|
|
327
|
+
})
|
|
259
328
|
},
|
|
260
329
|
})
|
|
261
330
|
</script>
|