node-red-contrib-unifi-ultimate 0.1.4 → 0.1.6
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 +241 -150
- package/nodes/readme-assets/unifi-access-door-access.jpg +0 -0
- package/nodes/readme-assets/unifi-network-switching.jpg +0 -0
- package/nodes/readme-assets/unifi-protect-camera.png +0 -0
- package/nodes/unifi-access-config.html +68 -9
- package/nodes/unifi-access-config.js +22 -11
- package/nodes/unifi-access-device.html +290 -46
- package/nodes/unifi-access-device.js +175 -56
- package/nodes/unifi-network-config.html +71 -11
- package/nodes/unifi-network-config.js +1484 -7
- package/nodes/unifi-network-control-poe.html +750 -51
- package/nodes/unifi-network-control-poe.js +643 -78
- package/nodes/unifi-network-device.html +357 -55
- package/nodes/unifi-network-device.js +669 -76
- package/nodes/unifi-network-presence.html +337 -43
- package/nodes/unifi-network-presence.js +90 -34
- package/nodes/unifi-protect-config.html +68 -9
- package/nodes/unifi-protect-config.js +17 -10
- package/nodes/unifi-protect-device.html +300 -49
- package/nodes/unifi-protect-device.js +242 -63
- package/nodes/utils/unifi-access-device-registry.js +29 -18
- package/nodes/utils/unifi-network-device-registry.js +147 -29
- package/nodes/utils/unifi-protect-device-registry.js +319 -43
- package/package.json +7 -3
- package/scripts/discover-unifi-access-registry.js +24 -0
- package/scripts/discover-unifi-network-registry.js +26 -0
- package/scripts/discover-unifi-protect-registry.js +26 -0
- package/scripts/unifi-registry-discovery-common.js +1043 -0
|
@@ -1,11 +1,57 @@
|
|
|
1
1
|
<style>
|
|
2
|
+
.unifi-ultimate-hero {
|
|
3
|
+
margin: 0 0 14px 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.unifi-ultimate-hero-panel {
|
|
7
|
+
padding: 14px 16px;
|
|
8
|
+
border: 1px solid #d9e7f5;
|
|
9
|
+
border-radius: 14px;
|
|
10
|
+
background: linear-gradient(135deg, #eef7ff 0%, #f8fbff 58%, #f7fafc 100%);
|
|
11
|
+
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
|
|
12
|
+
color: #334155;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.unifi-ultimate-eyebrow {
|
|
16
|
+
margin-bottom: 4px;
|
|
17
|
+
color: #2563eb;
|
|
18
|
+
font-size: 11px;
|
|
19
|
+
font-weight: 700;
|
|
20
|
+
letter-spacing: 0.08em;
|
|
21
|
+
text-transform: uppercase;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.unifi-ultimate-hero-panel strong {
|
|
25
|
+
display: block;
|
|
26
|
+
color: #0f172a;
|
|
27
|
+
font-size: 15px;
|
|
28
|
+
line-height: 1.35;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.unifi-ultimate-hero-panel span {
|
|
32
|
+
display: block;
|
|
33
|
+
margin-top: 4px;
|
|
34
|
+
line-height: 1.45;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.unifi-ultimate-section-title {
|
|
38
|
+
margin: 14px 0 8px 150px;
|
|
39
|
+
color: #64748b;
|
|
40
|
+
font-size: 11px;
|
|
41
|
+
font-weight: 700;
|
|
42
|
+
letter-spacing: 0.08em;
|
|
43
|
+
text-transform: uppercase;
|
|
44
|
+
}
|
|
45
|
+
|
|
2
46
|
.unifi-ultimate-card {
|
|
3
47
|
margin-left: 150px;
|
|
4
|
-
padding:
|
|
5
|
-
border
|
|
6
|
-
|
|
48
|
+
padding: 13px 15px;
|
|
49
|
+
border: 1px solid #e2e8f0;
|
|
50
|
+
border-radius: 14px;
|
|
51
|
+
background: #f8fafc;
|
|
7
52
|
color: #334155;
|
|
8
53
|
line-height: 1.45;
|
|
54
|
+
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
|
9
55
|
}
|
|
10
56
|
|
|
11
57
|
.unifi-ultimate-card strong {
|
|
@@ -16,8 +62,8 @@
|
|
|
16
62
|
}
|
|
17
63
|
|
|
18
64
|
.unifi-ultimate-advanced {
|
|
19
|
-
margin-top:
|
|
20
|
-
padding-top:
|
|
65
|
+
margin-top: 14px;
|
|
66
|
+
padding-top: 10px;
|
|
21
67
|
border-top: 1px solid #e5e7eb;
|
|
22
68
|
}
|
|
23
69
|
|
|
@@ -32,19 +78,27 @@
|
|
|
32
78
|
server: { value: "", type: "unifi-access-config", required: true },
|
|
33
79
|
deviceType: { value: "", required: true },
|
|
34
80
|
deviceId: { value: "", required: true },
|
|
81
|
+
deviceName: { value: "" },
|
|
82
|
+
inputs: { value: 1 },
|
|
35
83
|
capability: { value: "observe", required: true },
|
|
36
84
|
capabilityConfig: { value: "{}" },
|
|
37
85
|
timeout: { value: 15000, required: true, validate: RED.validators.number() }
|
|
38
86
|
},
|
|
39
87
|
inputs: 1,
|
|
40
|
-
outputs:
|
|
88
|
+
outputs: 1,
|
|
41
89
|
icon: "unifi-access-icon.svg",
|
|
42
90
|
paletteLabel: "ACCESS",
|
|
43
|
-
outputLabels: ["
|
|
91
|
+
outputLabels: ["result"],
|
|
44
92
|
label: function () {
|
|
45
93
|
return this.name || this.deviceId || "Unifi Access";
|
|
46
94
|
},
|
|
47
95
|
oneditsave: function () {
|
|
96
|
+
const selectedCapabilityId = String($("#node-input-capability").val() || this.capability || "observe").trim();
|
|
97
|
+
const selectedCapabilityOpensStream = $("#node-input-capability option:selected").data("opens-stream") === true
|
|
98
|
+
|| $("#node-input-capability option:selected").attr("data-opens-stream") === "true";
|
|
99
|
+
// Hide the input pin only when the selected action starts an event stream.
|
|
100
|
+
this.inputs = (selectedCapabilityOpensStream || selectedCapabilityId === "observe") ? 0 : 1;
|
|
101
|
+
|
|
48
102
|
const $capabilityConfig = $("#node-input-capabilityConfig");
|
|
49
103
|
const capabilityConfig = {};
|
|
50
104
|
if ($capabilityConfig.length === 0) {
|
|
@@ -94,6 +148,7 @@
|
|
|
94
148
|
const $server = $("#node-input-server");
|
|
95
149
|
const $deviceType = $("#node-input-deviceType");
|
|
96
150
|
const $deviceId = $("#node-input-deviceId");
|
|
151
|
+
const $deviceName = $("#node-input-deviceName");
|
|
97
152
|
const $capability = $("#node-input-capability");
|
|
98
153
|
const $capabilityConfig = $("#node-input-capabilityConfig");
|
|
99
154
|
const $capabilityConfigRow = $("#node-row-capabilityConfig");
|
|
@@ -101,7 +156,6 @@
|
|
|
101
156
|
const $refresh = $("#node-input-refreshDevices");
|
|
102
157
|
const $selectionSummary = $("#node-input-selectionSummary");
|
|
103
158
|
const $selectionDetail = $("#node-input-selectionDetail");
|
|
104
|
-
let lastAutoName = "";
|
|
105
159
|
let capabilityConfig = parseCapabilityConfig(node.capabilityConfig);
|
|
106
160
|
let capabilityListRequestId = 0;
|
|
107
161
|
let capabilityOptionsRequestId = 0;
|
|
@@ -224,26 +278,180 @@
|
|
|
224
278
|
if (!$select || $select.length === 0) {
|
|
225
279
|
return;
|
|
226
280
|
}
|
|
227
|
-
// Searchable selects are disabled now, but this still removes any
|
|
228
|
-
// cached helper input left by older editor versions.
|
|
229
281
|
const selectId = String($select.attr("id") || "").trim();
|
|
230
|
-
if (selectId) {
|
|
231
|
-
|
|
232
|
-
if ($searchInput.length > 0) {
|
|
233
|
-
try {
|
|
234
|
-
if ($searchInput.data("ui-autocomplete")) {
|
|
235
|
-
$searchInput.autocomplete("destroy");
|
|
236
|
-
}
|
|
237
|
-
} catch (error) {
|
|
238
|
-
}
|
|
239
|
-
$searchInput.remove();
|
|
240
|
-
}
|
|
282
|
+
if (!selectId) {
|
|
283
|
+
return;
|
|
241
284
|
}
|
|
242
285
|
|
|
286
|
+
const searchId = selectId + "-search";
|
|
243
287
|
$select.off(".unifiSearchable");
|
|
244
288
|
$select.removeData("unifi-searchable");
|
|
245
289
|
$select.removeData("unifi-options-count");
|
|
246
290
|
$select.show();
|
|
291
|
+
|
|
292
|
+
if ($select.is("select[multiple]")) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const $existingSearchInput = $("#" + searchId);
|
|
297
|
+
if ($existingSearchInput.length > 0) {
|
|
298
|
+
try {
|
|
299
|
+
if ($existingSearchInput.data("ui-autocomplete")) {
|
|
300
|
+
$existingSearchInput.autocomplete("destroy");
|
|
301
|
+
}
|
|
302
|
+
} catch (error) {
|
|
303
|
+
}
|
|
304
|
+
$existingSearchInput.off(".unifiSearchable");
|
|
305
|
+
$existingSearchInput.remove();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const $searchInput = $("<input>")
|
|
309
|
+
.attr("id", searchId)
|
|
310
|
+
.attr("type", "search")
|
|
311
|
+
.attr("autocomplete", "off")
|
|
312
|
+
.attr("placeholder", String(placeholder || "Search"))
|
|
313
|
+
.addClass("red-ui-input")
|
|
314
|
+
.css({
|
|
315
|
+
width: $select.css("width") || "100%",
|
|
316
|
+
marginBottom: "6px"
|
|
317
|
+
});
|
|
318
|
+
$select.before($searchInput);
|
|
319
|
+
$select.hide();
|
|
320
|
+
|
|
321
|
+
const options = $select.find("option").map(function () {
|
|
322
|
+
const $option = $(this);
|
|
323
|
+
const optionValue = String($option.val() || "").trim();
|
|
324
|
+
const optionText = String($option.text() || "").trim();
|
|
325
|
+
return {
|
|
326
|
+
value: optionValue,
|
|
327
|
+
text: optionText,
|
|
328
|
+
isPlaceholder: optionValue === "",
|
|
329
|
+
searchable: [
|
|
330
|
+
optionText,
|
|
331
|
+
String($option.attr("data-device-name") || "").trim(),
|
|
332
|
+
String($option.attr("data-client-name") || "").trim(),
|
|
333
|
+
optionValue
|
|
334
|
+
].filter(Boolean).join(" ").toLowerCase()
|
|
335
|
+
};
|
|
336
|
+
}).get();
|
|
337
|
+
|
|
338
|
+
function findOptionByValue(value) {
|
|
339
|
+
return options.find(function (option) {
|
|
340
|
+
return String(option.value) === String(value || "").trim();
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function syncInputFromSelect() {
|
|
345
|
+
const selectedValue = String($select.val() || "").trim();
|
|
346
|
+
const selected = findOptionByValue(selectedValue);
|
|
347
|
+
if (selected && !selected.isPlaceholder) {
|
|
348
|
+
$searchInput.val(selected.text);
|
|
349
|
+
} else {
|
|
350
|
+
$searchInput.val("");
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function setSelectedValue(value, triggerChange) {
|
|
355
|
+
const selected = findOptionByValue(value);
|
|
356
|
+
if (selected) {
|
|
357
|
+
$select.val(selected.value);
|
|
358
|
+
} else {
|
|
359
|
+
$select.val("");
|
|
360
|
+
}
|
|
361
|
+
syncInputFromSelect();
|
|
362
|
+
if (triggerChange) {
|
|
363
|
+
$select.trigger("change");
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
let filterOnKeyUpOnly = false;
|
|
368
|
+
$searchInput.autocomplete({
|
|
369
|
+
minLength: 0,
|
|
370
|
+
source: function (request, response) {
|
|
371
|
+
const term = filterOnKeyUpOnly
|
|
372
|
+
? String(request && request.term || "").trim().toLowerCase()
|
|
373
|
+
: "";
|
|
374
|
+
const items = options
|
|
375
|
+
.filter(function (option) {
|
|
376
|
+
if (option.isPlaceholder) {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
if (!term) {
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
return option.searchable.indexOf(term) !== -1;
|
|
383
|
+
})
|
|
384
|
+
.map(function (option) {
|
|
385
|
+
return {
|
|
386
|
+
label: option.text,
|
|
387
|
+
value: option.text,
|
|
388
|
+
optionValue: option.value
|
|
389
|
+
};
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
if (items.length === 0) {
|
|
393
|
+
response([{
|
|
394
|
+
label: "No results",
|
|
395
|
+
value: "",
|
|
396
|
+
optionValue: "",
|
|
397
|
+
noSelection: true
|
|
398
|
+
}]);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
response(items);
|
|
403
|
+
},
|
|
404
|
+
select: function (event, ui) {
|
|
405
|
+
if (ui.item && ui.item.noSelection) {
|
|
406
|
+
event.preventDefault();
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
if (ui.item) {
|
|
410
|
+
$select.data("unifi-user-selection", true);
|
|
411
|
+
setSelectedValue(ui.item.optionValue, true);
|
|
412
|
+
}
|
|
413
|
+
return true;
|
|
414
|
+
},
|
|
415
|
+
change: function (event, ui) {
|
|
416
|
+
if (ui.item) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const typed = String($searchInput.val() || "").trim().toLowerCase();
|
|
420
|
+
if (!typed) {
|
|
421
|
+
setSelectedValue("", true);
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const exactMatch = options.find(function (option) {
|
|
426
|
+
if (option.isPlaceholder) {
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
return option.text.toLowerCase() === typed || option.value.toLowerCase() === typed;
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
if (exactMatch) {
|
|
433
|
+
setSelectedValue(exactMatch.value, true);
|
|
434
|
+
} else {
|
|
435
|
+
syncInputFromSelect();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
$searchInput.on("keyup.unifiSearchable", function () {
|
|
441
|
+
filterOnKeyUpOnly = true;
|
|
442
|
+
$(this).autocomplete("search", $(this).val());
|
|
443
|
+
});
|
|
444
|
+
$searchInput.on("mouseup.unifiSearchable", function () {
|
|
445
|
+
const $input = $(this);
|
|
446
|
+
filterOnKeyUpOnly = false;
|
|
447
|
+
setTimeout(function () {
|
|
448
|
+
$input.autocomplete("search", "");
|
|
449
|
+
}, 0);
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
syncInputFromSelect();
|
|
453
|
+
$select.data("unifi-searchable", true);
|
|
454
|
+
$select.data("unifi-options-count", options.length);
|
|
247
455
|
}
|
|
248
456
|
|
|
249
457
|
function syncCapabilityConfigFromInputs() {
|
|
@@ -365,15 +573,20 @@
|
|
|
365
573
|
|
|
366
574
|
function syncNameFromSelection() {
|
|
367
575
|
const selectedDeviceName = getSelectedDeviceName();
|
|
368
|
-
const currentName = String($name.val() || "").trim();
|
|
369
|
-
const shouldUpdate = currentName === "" || currentName === lastAutoName;
|
|
370
576
|
|
|
371
|
-
if (!selectedDeviceName
|
|
577
|
+
if (!selectedDeviceName) {
|
|
372
578
|
return;
|
|
373
579
|
}
|
|
374
580
|
|
|
375
581
|
$name.val(selectedDeviceName);
|
|
376
|
-
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function rememberSelectedDeviceName() {
|
|
585
|
+
const selectedDeviceName = getSelectedDeviceName();
|
|
586
|
+
if (!selectedDeviceName) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
$deviceName.val(selectedDeviceName);
|
|
377
590
|
}
|
|
378
591
|
|
|
379
592
|
function renderDeviceTypes(items) {
|
|
@@ -397,7 +610,6 @@
|
|
|
397
610
|
$deviceType.val("");
|
|
398
611
|
}
|
|
399
612
|
});
|
|
400
|
-
makeSelectSearchable($deviceType, "Search controls");
|
|
401
613
|
refreshSelectionSummary();
|
|
402
614
|
}
|
|
403
615
|
|
|
@@ -411,6 +623,7 @@
|
|
|
411
623
|
$capability.append(
|
|
412
624
|
$("<option></option>")
|
|
413
625
|
.val(item.id)
|
|
626
|
+
.attr("data-opens-stream", item.opensEventStream === true ? "true" : "false")
|
|
414
627
|
.text(item.label)
|
|
415
628
|
);
|
|
416
629
|
});
|
|
@@ -421,7 +634,6 @@
|
|
|
421
634
|
$capability.val("observe");
|
|
422
635
|
}
|
|
423
636
|
});
|
|
424
|
-
makeSelectSearchable($capability, "Search actions");
|
|
425
637
|
refreshSelectionSummary();
|
|
426
638
|
}
|
|
427
639
|
|
|
@@ -627,9 +839,6 @@
|
|
|
627
839
|
}
|
|
628
840
|
|
|
629
841
|
$capabilityConfigContainer.append($wrapper);
|
|
630
|
-
if (field.type === "select") {
|
|
631
|
-
makeSelectSearchable($input, "Search options");
|
|
632
|
-
}
|
|
633
842
|
});
|
|
634
843
|
|
|
635
844
|
writeCapabilityConfig();
|
|
@@ -667,7 +876,7 @@
|
|
|
667
876
|
});
|
|
668
877
|
|
|
669
878
|
makeSelectSearchable($deviceId, "Search devices");
|
|
670
|
-
|
|
879
|
+
rememberSelectedDeviceName();
|
|
671
880
|
refreshSelectionSummary();
|
|
672
881
|
}
|
|
673
882
|
|
|
@@ -831,9 +1040,7 @@
|
|
|
831
1040
|
}
|
|
832
1041
|
|
|
833
1042
|
writeCapabilityConfig();
|
|
834
|
-
makeSelectSearchable($deviceType, "Search controls");
|
|
835
1043
|
makeSelectSearchable($deviceId, "Search devices");
|
|
836
|
-
makeSelectSearchable($capability, "Search actions");
|
|
837
1044
|
|
|
838
1045
|
$server.on("change", function () {
|
|
839
1046
|
if (suspendChangeHandling || isInitializingEditor) {
|
|
@@ -853,7 +1060,12 @@
|
|
|
853
1060
|
if (suspendChangeHandling || isInitializingEditor) {
|
|
854
1061
|
return;
|
|
855
1062
|
}
|
|
856
|
-
|
|
1063
|
+
rememberSelectedDeviceName();
|
|
1064
|
+
const isUserSelection = $deviceId.data("unifi-user-selection") === true;
|
|
1065
|
+
$deviceId.removeData("unifi-user-selection");
|
|
1066
|
+
if (isUserSelection) {
|
|
1067
|
+
syncNameFromSelection();
|
|
1068
|
+
}
|
|
857
1069
|
capabilityConfig = {};
|
|
858
1070
|
writeCapabilityConfig();
|
|
859
1071
|
refreshAfterDeviceChange();
|
|
@@ -879,10 +1091,19 @@
|
|
|
879
1091
|
</script>
|
|
880
1092
|
|
|
881
1093
|
<script type="text/html" data-template-name="unifi-access-device">
|
|
1094
|
+
<div class="form-row unifi-ultimate-hero">
|
|
1095
|
+
<div class="unifi-ultimate-hero-panel">
|
|
1096
|
+
<div class="unifi-ultimate-eyebrow">UniFi Access</div>
|
|
1097
|
+
<strong>Control doors and Access devices from a flow.</strong>
|
|
1098
|
+
<span>Choose a door or device, then select the action to run when a message arrives.</span>
|
|
1099
|
+
</div>
|
|
1100
|
+
</div>
|
|
1101
|
+
<div class="unifi-ultimate-section-title">Connection</div>
|
|
882
1102
|
<div class="form-row">
|
|
883
1103
|
<label for="node-input-server"><i class="fa fa-cog"></i> Connection</label>
|
|
884
1104
|
<input type="text" id="node-input-server">
|
|
885
1105
|
</div>
|
|
1106
|
+
<div class="unifi-ultimate-section-title">Target</div>
|
|
886
1107
|
<div class="form-row">
|
|
887
1108
|
<label for="node-input-deviceType"><i class="fa fa-cubes"></i> Control</label>
|
|
888
1109
|
<select id="node-input-deviceType"></select>
|
|
@@ -894,6 +1115,7 @@
|
|
|
894
1115
|
<i class="fa fa-refresh"></i>
|
|
895
1116
|
</a>
|
|
896
1117
|
</div>
|
|
1118
|
+
<div class="unifi-ultimate-section-title">Action</div>
|
|
897
1119
|
<div class="form-row">
|
|
898
1120
|
<label for="node-input-capability"><i class="fa fa-tasks"></i> Action</label>
|
|
899
1121
|
<select id="node-input-capability"></select>
|
|
@@ -908,11 +1130,12 @@
|
|
|
908
1130
|
<label><i class="fa fa-sliders"></i> Action options</label>
|
|
909
1131
|
<div id="node-input-capabilityConfigContainer" style="width:70%; display:inline-block;"></div>
|
|
910
1132
|
<input type="hidden" id="node-input-capabilityConfig">
|
|
1133
|
+
<input type="hidden" id="node-input-deviceName">
|
|
911
1134
|
</div>
|
|
912
1135
|
<div id="node-row-advanced" class="unifi-ultimate-advanced">
|
|
913
1136
|
<div class="form-row">
|
|
914
|
-
<label for="node-input-name"><i class="fa fa-tag"></i>
|
|
915
|
-
<input type="text" id="node-input-name" placeholder="
|
|
1137
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
1138
|
+
<input type="text" id="node-input-name" placeholder="Node name">
|
|
916
1139
|
</div>
|
|
917
1140
|
<div class="form-row">
|
|
918
1141
|
<label for="node-input-timeout"><i class="fa fa-clock-o"></i> Timeout</label>
|
|
@@ -922,30 +1145,51 @@
|
|
|
922
1145
|
</script>
|
|
923
1146
|
|
|
924
1147
|
<script type="text/html" data-help-name="unifi-access-device">
|
|
925
|
-
<p>Use this node to
|
|
1148
|
+
<p>Use this node to execute a configured UniFi Access action or listen for live Access events.</p>
|
|
926
1149
|
|
|
927
1150
|
<h3>Configuration</h3>
|
|
928
1151
|
<p><b>Connection</b> selects the shared UniFi Access config node.</p>
|
|
929
|
-
<p><b>Control</b> chooses the Access category. <b>Device</b> chooses the specific door or Access device.
|
|
1152
|
+
<p><b>Control</b> chooses the Access category. <b>Device</b> chooses the specific door or Access device. Device selectors are searchable and open with the complete list before filtering.</p>
|
|
1153
|
+
<p><b>Action</b> only shows actions supported by the selected item.</p>
|
|
930
1154
|
<p><b>Action options</b> appears only when the selected action needs extra input, such as a temporary lock rule or a room name for doorbell actions.</p>
|
|
931
1155
|
<p>For <code>Set Temporary Lock Rule</code>, choose <code>Custom Duration</code> to reveal the minutes field. Legacy <code>ended_time</code> is still available only as fallback compatibility.</p>
|
|
932
|
-
<p><code>Receive Events</code> fetches the current state once and then listens to the official UniFi Access notifications WebSocket.</p>
|
|
1156
|
+
<p><code>Receive Events</code> fetches the current state once and then listens to the official UniFi Access notifications WebSocket. In <b>Action options</b>, <code>All</code> emits every event for the selected device/door. In this mode, the input pin is hidden and listening starts automatically after deploy/restart.</p>
|
|
933
1157
|
<p><code>Trigger Doorbell</code> and <code>Cancel Doorbell</code> use a manual <code>Room Name</code> field when needed. The node does not currently discover Intercom directory names automatically.</p>
|
|
934
1158
|
<p><code>Cancel Doorbell</code> uses a shared safe-cancel guard in the UniFi Access config node with a 3 minute tracking window. Tracking is updated by websocket events and a fallback system-log poller.</p>
|
|
935
|
-
<p><b>
|
|
1159
|
+
<p><b>Name</b> is the node name shown in the editor and is updated only when you manually select a different item from the list. <b>Timeout</b> controls the request timeout in milliseconds for direct API calls.</p>
|
|
936
1160
|
|
|
937
1161
|
<h3>Input</h3>
|
|
938
1162
|
<ul>
|
|
939
|
-
<li
|
|
940
|
-
<li
|
|
941
|
-
<li
|
|
1163
|
+
<li>When <code>Receive Events</code> is selected, the input pin is hidden.</li>
|
|
1164
|
+
<li>Any incoming message triggers the configured action.</li>
|
|
1165
|
+
<li>Input message properties are ignored by this node.</li>
|
|
942
1166
|
</ul>
|
|
943
1167
|
|
|
944
1168
|
<h3>Output</h3>
|
|
945
1169
|
<ul>
|
|
946
|
-
<li>
|
|
947
|
-
<li>
|
|
948
|
-
<li><code>msg.
|
|
1170
|
+
<li>A single output pin emits state and event messages for the selected item.</li>
|
|
1171
|
+
<li><code>msg.topic</code>: node name from the editor.</li>
|
|
1172
|
+
<li><code>msg.deviceName</code>: remembered/observed selected device name.</li>
|
|
1173
|
+
<li><code>msg.eventName</code>: trigger/event that produced the message.</li>
|
|
1174
|
+
<li><code>msg.details.unifiAccess</code>: standardized metadata for the device and selected capability.</li>
|
|
949
1175
|
<li>Safe-cancel skip: <code>msg.payload.skipped = true</code> when <code>Cancel Doorbell</code> is blocked because no active ring is currently tracked</li>
|
|
950
1176
|
</ul>
|
|
1177
|
+
<p>Example output:</p>
|
|
1178
|
+
<pre><code>{
|
|
1179
|
+
"topic": "Main Door",
|
|
1180
|
+
"deviceName": "Main Door",
|
|
1181
|
+
"eventName": "door.unlock",
|
|
1182
|
+
"payload": {
|
|
1183
|
+
"event": "door.unlock",
|
|
1184
|
+
"deviceName": "Main Door"
|
|
1185
|
+
},
|
|
1186
|
+
"details": {
|
|
1187
|
+
"unifiAccess": {
|
|
1188
|
+
"nodeType": "device",
|
|
1189
|
+
"deviceType": "door",
|
|
1190
|
+
"capability": "observe",
|
|
1191
|
+
"source": "events"
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}</code></pre>
|
|
951
1195
|
</script>
|