node-red-contrib-unifi-ultimate 1.1.13 → 1.1.15
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 +37 -0
- package/examples/unifi-guided-monitoring.json +398 -0
- package/examples/unifi-protect-lpr.json +75 -0
- package/nodes/unifi-access-config.html +32 -2
- package/nodes/unifi-access-config.js +71 -21
- package/nodes/unifi-access-device.html +32 -11
- package/nodes/unifi-access-device.js +51 -1
- package/nodes/unifi-network-config.html +32 -2
- package/nodes/unifi-network-config.js +19 -2
- package/nodes/unifi-network-device.html +39 -10
- package/nodes/unifi-network-device.js +37 -0
- package/nodes/unifi-protect-config.html +33 -3
- package/nodes/unifi-protect-config.js +111 -15
- package/nodes/unifi-protect-device.html +56 -11
- package/nodes/unifi-protect-device.js +267 -3
- package/nodes/utils/unifi-access-device-registry.js +8 -0
- package/nodes/utils/unifi-action-guidance.js +19 -0
- package/nodes/utils/unifi-connection-check.js +126 -0
- package/nodes/utils/unifi-network-device-registry.js +18 -0
- package/nodes/utils/unifi-network-monitor.js +84 -0
- package/nodes/utils/unifi-protect-detections.js +111 -0
- package/nodes/utils/unifi-protect-device-registry.js +37 -1
- package/nodes/utils/unifi-protect-field-metadata.js +5 -0
- package/nodes/utils/unifi-protect-lpr.js +49 -0
- package/nodes/utils/unifi-simple-monitor.js +189 -0
- package/package.json +3 -3
- package/resources/editor/unifi-connection-check.js +53 -0
- package/resources/editor/unifi-ultimate-editor-common.css +10 -7
package/README.md
CHANGED
|
@@ -59,6 +59,29 @@ In Node-RED:
|
|
|
59
59
|
|
|
60
60
|
> **Self-signed certificates:** Each config node has an **Allow self-signed certificate** option, enabled by default. UniFi controllers almost always present a self-signed certificate, so keep it checked for UniFi OS / UXG setups. Uncheck it only if your controller uses a certificate signed by a trusted certificate authority and you want strict verification.
|
|
61
61
|
|
|
62
|
+
> **Optional local account:** Protect, Network, and Access config nodes include **Local User** and **Local Password**, stored in Node-RED's credential store. Protect uses this shared account for LPR text, recorded-event searches, and event images. Network Internet/WAN monitors use the local account when the controller rejects the API key on local endpoints. Access stores the fields but its actions, including door monitoring, use the API token. Leave both fields empty when they are not needed. The API key/token remains required. Protect history callers can still supply a complete per-request account to override the configured one.
|
|
63
|
+
|
|
64
|
+
### Guided setup and monitoring
|
|
65
|
+
|
|
66
|
+
Every connection has a **Verify Connection** button. It tests the values in the editor from the Node-RED host and explains reachability, certificate, authentication and permission failures. It also checks complete local credentials where used. The editor keeps inline notes minimal; detailed requirements and output examples are in the HTML help.
|
|
67
|
+
|
|
68
|
+
| Node / selection | New action or option | Result |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| Protect / Camera | **Receive Events with Photo** | Detection in `msg.payload`, the exact event's recorded image in `msg.image`, MIME type in `msg.imageType`. |
|
|
71
|
+
| Protect / Camera | **Read Recent Detections** | Inject-triggered event array, filter by detection type and time window (default 24 hours), up to 100 results. |
|
|
72
|
+
| Protect / LPR, photos, history | **Known plates** | One `PLATE = friendly name` per line; LPR adds `msg.knownPlate` and optional `msg.plateName`, while photo/history rows include named `plates`. |
|
|
73
|
+
| Access / Door | **Door Open Too Long** | `doorOpenTooLong` after the threshold (default 120 seconds), followed by `doorClosed`. Requires a physical DPS and token permission `view:space`. |
|
|
74
|
+
| Network / UniFi Device | **Device Offline / Restored** | `deviceOffline` after a confirmed outage (default 60 seconds), then `deviceRestored`. |
|
|
75
|
+
| Network / Site | **Monitor Internet and WAN** | `internetOffline` / `internetRestored`, plus native `wanFailover`, `wanActive`, `wanInactive` where supported. |
|
|
76
|
+
|
|
77
|
+
All monitoring actions start on deploy, share polling on their connection (using the shortest interval for the same target) and emit one alert/recovery per transition. A controller error or unknown state goes to output 2 and resets the pending delay; it never becomes a fabricated device or Internet outage. Initial healthy state is silent. An initial open/offline state starts timing from observation, and monitoring restarts after redeploy. Polling adds up to one interval plus request time to detection. Plate names are ordinary flow settings and are included in exports; account credentials are kept in Node-RED's credential store.
|
|
78
|
+
|
|
79
|
+
Protect event photos/history require the configured local account and retained recordings. Photos are retrieved by exact event ID, with brief retries for delayed availability. The node does not substitute a current camera snapshot. History metadata in `msg.details.history` includes `from`, `to`, `hasMore`, `nextOffset` and `stoppedReason`; a search scans at most 1,000 source rows and reports incomplete or repeated-page results. The time window is recalculated for each trigger, including when using **History offset**.
|
|
80
|
+
|
|
81
|
+
Network Internet monitoring needs a UniFi gateway and local API support. It uses the controller's **WWW** health; one inactive WAN is not evidence of a total Internet outage. WAN transitions use native `EVT_GW_WANTransition` events for the selected site and identify the actual reported interface, without guessing which WAN is primary. The last 100 source events are checked per poll, so busy sites or long interruptions can leave gaps. Unsupported WAN event endpoints are reported separately while Internet health monitoring continues. These local APIs depend on controller version and permissions.
|
|
82
|
+
|
|
83
|
+
Import [guided monitoring examples](examples/unifi-guided-monitoring.json), select your connections and devices, then deploy. Each action is wired to result/error Debug nodes. See the HTML help for example messages and the details of each option.
|
|
84
|
+
|
|
62
85
|
<br/>
|
|
63
86
|
<br/>
|
|
64
87
|
<p align="left">
|
|
@@ -117,6 +140,7 @@ Use **Protect** nodes to work with:
|
|
|
117
140
|
Things you can do:
|
|
118
141
|
|
|
119
142
|
- Receive motion, ring, contact, tamper, leak, and low-battery alerts.
|
|
143
|
+
- Read recognized license plates (LPR) from compatible cameras as text in `msg.payload`.
|
|
120
144
|
- Read the current state of a camera or sensor.
|
|
121
145
|
- Take a camera snapshot.
|
|
122
146
|
- Control PTZ cameras (move to preset, start/stop patrol).
|
|
@@ -126,6 +150,19 @@ Things you can do:
|
|
|
126
150
|
- Play or stop a siren, control relay outputs, and test speaker or siren sound.
|
|
127
151
|
- Read and select Protect Arm Profiles, then arm or disarm the local Alarm Manager from the NVR control.
|
|
128
152
|
|
|
153
|
+
### Read license plates (LPR)
|
|
154
|
+
|
|
155
|
+
1. Enable license plate recognition on a compatible camera in UniFi Protect.
|
|
156
|
+
2. In the **PROTECT** node, select **Camera**, the camera, **Receive Events**, then **License Plate (LPR)**.
|
|
157
|
+
3. Open the shared **Protect connection** and enter its optional **Local User** and **Local Password** for a local UniFi OS account with permission to view that camera's recordings. Keep the API key configured there. The account is shared by every Protect node using that connection.
|
|
158
|
+
4. Deploy. Each recognized plate arrives as a string such as `"AB123CD"` in `msg.payload`, with `msg.eventName = "licensePlate"`.
|
|
159
|
+
|
|
160
|
+
`msg.details.lpr` contains the plate text, event ID, timestamps, and OCR confidence (0–100) when available. The original event is preserved in `msg.details.raw.event`. The first available text is emitted immediately, even at low confidence. Multiple plates are emitted separately; corrected text or a confidence increase produces another message. Identical readings and lower confidence for previously emitted text are suppressed. Every reading carries the plate string in `msg.payload`, including higher-confidence readings of unchanged text. `msg.details.lpr.isUpdate` is true for subsequent readings of the same event; confidence stays in `msg.details.lpr.confidence`. A later event with the same plate produces a new message. Startup, unrelated detections, and events without plate text produce no result; lookup failures go to the error output.
|
|
161
|
+
|
|
162
|
+
The [official Protect event schema](https://developer.ui.com/protect/v7.3.47/get-v1subscribeevents) exposes the `licensePlate` detection type but does not document the recognized text. The node therefore retrieves OCR metadata from the matching event through Protect's local, unofficial events API. An active LPR node prepares the configured account's session at deploy and reuses it until the controller requires renewal. OCR supplied in a live event bypasses pending lookups. The node starts looking for OCR at vehicle detection, before the live LPR classification arrives; vehicle detection alone never produces a plate. Up to five background follow-up reads, delayed by 150, 350, 750, 1500 and 3000 milliseconds between requests, retrieve missing text or refinements without holding the first reading. The first text still depends on when Protect exposes OCR, and later readings are not guaranteed accurate. This requires the local account above and may depend on the Protect version. Credentials use Node-RED's credential storage and are not included in messages or ordinary flow exports.
|
|
163
|
+
|
|
164
|
+
Importable example: [Protect LPR](examples/unifi-protect-lpr.json).
|
|
165
|
+
|
|
129
166
|
<br/>
|
|
130
167
|
<br/>
|
|
131
168
|
<p align="left">
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "guided-unifi-tab",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "UniFi guided monitoring",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "Select connections and devices before deploying. The examples use Debug outputs only."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "guided-unifi-comment",
|
|
11
|
+
"type": "comment",
|
|
12
|
+
"z": "guided-unifi-tab",
|
|
13
|
+
"name": "1. Select connections and devices in each node. 2. Verify Connection. 3. Deploy.",
|
|
14
|
+
"info": "Local credentials belong in each shared connection. Protect photos/history need camera recording permissions. Door monitoring needs DPS. Network Internet monitoring requires a UniFi gateway and local API support. No credentials are included here.",
|
|
15
|
+
"x": 420,
|
|
16
|
+
"y": 40,
|
|
17
|
+
"wires": []
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "guided-unifi-0",
|
|
21
|
+
"type": "unifi-protect-device",
|
|
22
|
+
"z": "guided-unifi-tab",
|
|
23
|
+
"name": "Known license plates",
|
|
24
|
+
"server": "",
|
|
25
|
+
"deviceType": "camera",
|
|
26
|
+
"deviceId": "",
|
|
27
|
+
"deviceName": "",
|
|
28
|
+
"capability": "observe",
|
|
29
|
+
"capabilityConfig": "{\"observable\": \"licensePlate\", \"knownPlates\": \"AB123CD = Family car\"}",
|
|
30
|
+
"inputs": 0,
|
|
31
|
+
"autoEmit": false,
|
|
32
|
+
"autoEmitInterval": 60,
|
|
33
|
+
"x": 420,
|
|
34
|
+
"y": 120,
|
|
35
|
+
"wires": [
|
|
36
|
+
[
|
|
37
|
+
"guided-unifi-0-result"
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
"guided-unifi-0-error"
|
|
41
|
+
]
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "guided-unifi-0-result",
|
|
46
|
+
"type": "debug",
|
|
47
|
+
"z": "guided-unifi-tab",
|
|
48
|
+
"name": "Known license plates: result",
|
|
49
|
+
"active": true,
|
|
50
|
+
"tosidebar": true,
|
|
51
|
+
"console": false,
|
|
52
|
+
"tostatus": false,
|
|
53
|
+
"complete": "true",
|
|
54
|
+
"targetType": "full",
|
|
55
|
+
"statusVal": "",
|
|
56
|
+
"statusType": "auto",
|
|
57
|
+
"x": 790,
|
|
58
|
+
"y": 100,
|
|
59
|
+
"wires": []
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "guided-unifi-0-error",
|
|
63
|
+
"type": "debug",
|
|
64
|
+
"z": "guided-unifi-tab",
|
|
65
|
+
"name": "Known license plates: error",
|
|
66
|
+
"active": true,
|
|
67
|
+
"tosidebar": true,
|
|
68
|
+
"console": false,
|
|
69
|
+
"tostatus": false,
|
|
70
|
+
"complete": "true",
|
|
71
|
+
"targetType": "full",
|
|
72
|
+
"statusVal": "",
|
|
73
|
+
"statusType": "auto",
|
|
74
|
+
"x": 790,
|
|
75
|
+
"y": 140,
|
|
76
|
+
"wires": []
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"id": "guided-unifi-1",
|
|
80
|
+
"type": "unifi-protect-device",
|
|
81
|
+
"z": "guided-unifi-tab",
|
|
82
|
+
"name": "Person with event photo",
|
|
83
|
+
"server": "",
|
|
84
|
+
"deviceType": "camera",
|
|
85
|
+
"deviceId": "",
|
|
86
|
+
"deviceName": "",
|
|
87
|
+
"capability": "observeWithImage",
|
|
88
|
+
"capabilityConfig": "{\"detectionType\": \"person\"}",
|
|
89
|
+
"inputs": 0,
|
|
90
|
+
"autoEmit": false,
|
|
91
|
+
"autoEmitInterval": 60,
|
|
92
|
+
"x": 420,
|
|
93
|
+
"y": 220,
|
|
94
|
+
"wires": [
|
|
95
|
+
[
|
|
96
|
+
"guided-unifi-1-result"
|
|
97
|
+
],
|
|
98
|
+
[
|
|
99
|
+
"guided-unifi-1-error"
|
|
100
|
+
]
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "guided-unifi-1-result",
|
|
105
|
+
"type": "debug",
|
|
106
|
+
"z": "guided-unifi-tab",
|
|
107
|
+
"name": "Person with event photo: result",
|
|
108
|
+
"active": true,
|
|
109
|
+
"tosidebar": true,
|
|
110
|
+
"console": false,
|
|
111
|
+
"tostatus": false,
|
|
112
|
+
"complete": "true",
|
|
113
|
+
"targetType": "full",
|
|
114
|
+
"statusVal": "",
|
|
115
|
+
"statusType": "auto",
|
|
116
|
+
"x": 790,
|
|
117
|
+
"y": 200,
|
|
118
|
+
"wires": []
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"id": "guided-unifi-1-error",
|
|
122
|
+
"type": "debug",
|
|
123
|
+
"z": "guided-unifi-tab",
|
|
124
|
+
"name": "Person with event photo: error",
|
|
125
|
+
"active": true,
|
|
126
|
+
"tosidebar": true,
|
|
127
|
+
"console": false,
|
|
128
|
+
"tostatus": false,
|
|
129
|
+
"complete": "true",
|
|
130
|
+
"targetType": "full",
|
|
131
|
+
"statusVal": "",
|
|
132
|
+
"statusType": "auto",
|
|
133
|
+
"x": 790,
|
|
134
|
+
"y": 240,
|
|
135
|
+
"wires": []
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"id": "guided-unifi-2",
|
|
139
|
+
"type": "unifi-protect-device",
|
|
140
|
+
"z": "guided-unifi-tab",
|
|
141
|
+
"name": "Plates in the last 24 hours",
|
|
142
|
+
"server": "",
|
|
143
|
+
"deviceType": "camera",
|
|
144
|
+
"deviceId": "",
|
|
145
|
+
"deviceName": "",
|
|
146
|
+
"capability": "getRecentDetections",
|
|
147
|
+
"capabilityConfig": "{\"detectionType\": \"licensePlate\", \"hours\": 24, \"limit\": 20, \"offset\": 0, \"knownPlates\": \"AB123CD = Family car\"}",
|
|
148
|
+
"inputs": 1,
|
|
149
|
+
"autoEmit": false,
|
|
150
|
+
"autoEmitInterval": 60,
|
|
151
|
+
"x": 420,
|
|
152
|
+
"y": 320,
|
|
153
|
+
"wires": [
|
|
154
|
+
[
|
|
155
|
+
"guided-unifi-2-result"
|
|
156
|
+
],
|
|
157
|
+
[
|
|
158
|
+
"guided-unifi-2-error"
|
|
159
|
+
]
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"id": "guided-unifi-2-result",
|
|
164
|
+
"type": "debug",
|
|
165
|
+
"z": "guided-unifi-tab",
|
|
166
|
+
"name": "Plates in the last 24 hours: result",
|
|
167
|
+
"active": true,
|
|
168
|
+
"tosidebar": true,
|
|
169
|
+
"console": false,
|
|
170
|
+
"tostatus": false,
|
|
171
|
+
"complete": "true",
|
|
172
|
+
"targetType": "full",
|
|
173
|
+
"statusVal": "",
|
|
174
|
+
"statusType": "auto",
|
|
175
|
+
"x": 790,
|
|
176
|
+
"y": 300,
|
|
177
|
+
"wires": []
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"id": "guided-unifi-2-error",
|
|
181
|
+
"type": "debug",
|
|
182
|
+
"z": "guided-unifi-tab",
|
|
183
|
+
"name": "Plates in the last 24 hours: error",
|
|
184
|
+
"active": true,
|
|
185
|
+
"tosidebar": true,
|
|
186
|
+
"console": false,
|
|
187
|
+
"tostatus": false,
|
|
188
|
+
"complete": "true",
|
|
189
|
+
"targetType": "full",
|
|
190
|
+
"statusVal": "",
|
|
191
|
+
"statusType": "auto",
|
|
192
|
+
"x": 790,
|
|
193
|
+
"y": 340,
|
|
194
|
+
"wires": []
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"id": "guided-history-trigger",
|
|
198
|
+
"type": "inject",
|
|
199
|
+
"z": "guided-unifi-tab",
|
|
200
|
+
"name": "Read history",
|
|
201
|
+
"props": [
|
|
202
|
+
{
|
|
203
|
+
"p": "payload"
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"repeat": "",
|
|
207
|
+
"crontab": "",
|
|
208
|
+
"once": false,
|
|
209
|
+
"onceDelay": 0.1,
|
|
210
|
+
"topic": "",
|
|
211
|
+
"payload": "",
|
|
212
|
+
"payloadType": "date",
|
|
213
|
+
"x": 150,
|
|
214
|
+
"y": 320,
|
|
215
|
+
"wires": [
|
|
216
|
+
[
|
|
217
|
+
"guided-unifi-2"
|
|
218
|
+
]
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"id": "guided-unifi-3",
|
|
223
|
+
"type": "unifi-access-device",
|
|
224
|
+
"z": "guided-unifi-tab",
|
|
225
|
+
"name": "Door open for 2 minutes",
|
|
226
|
+
"server": "",
|
|
227
|
+
"deviceType": "door",
|
|
228
|
+
"deviceId": "",
|
|
229
|
+
"deviceName": "",
|
|
230
|
+
"capability": "observeDoorOpenTooLong",
|
|
231
|
+
"capabilityConfig": "{\"delaySeconds\": 120}",
|
|
232
|
+
"inputs": 0,
|
|
233
|
+
"autoEmit": false,
|
|
234
|
+
"autoEmitInterval": 60,
|
|
235
|
+
"x": 420,
|
|
236
|
+
"y": 420,
|
|
237
|
+
"wires": [
|
|
238
|
+
[
|
|
239
|
+
"guided-unifi-3-result"
|
|
240
|
+
],
|
|
241
|
+
[
|
|
242
|
+
"guided-unifi-3-error"
|
|
243
|
+
]
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"id": "guided-unifi-3-result",
|
|
248
|
+
"type": "debug",
|
|
249
|
+
"z": "guided-unifi-tab",
|
|
250
|
+
"name": "Door open for 2 minutes: result",
|
|
251
|
+
"active": true,
|
|
252
|
+
"tosidebar": true,
|
|
253
|
+
"console": false,
|
|
254
|
+
"tostatus": false,
|
|
255
|
+
"complete": "true",
|
|
256
|
+
"targetType": "full",
|
|
257
|
+
"statusVal": "",
|
|
258
|
+
"statusType": "auto",
|
|
259
|
+
"x": 790,
|
|
260
|
+
"y": 400,
|
|
261
|
+
"wires": []
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"id": "guided-unifi-3-error",
|
|
265
|
+
"type": "debug",
|
|
266
|
+
"z": "guided-unifi-tab",
|
|
267
|
+
"name": "Door open for 2 minutes: error",
|
|
268
|
+
"active": true,
|
|
269
|
+
"tosidebar": true,
|
|
270
|
+
"console": false,
|
|
271
|
+
"tostatus": false,
|
|
272
|
+
"complete": "true",
|
|
273
|
+
"targetType": "full",
|
|
274
|
+
"statusVal": "",
|
|
275
|
+
"statusType": "auto",
|
|
276
|
+
"x": 790,
|
|
277
|
+
"y": 440,
|
|
278
|
+
"wires": []
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"id": "guided-unifi-4",
|
|
282
|
+
"type": "unifi-network-device",
|
|
283
|
+
"z": "guided-unifi-tab",
|
|
284
|
+
"name": "Device outage and recovery",
|
|
285
|
+
"server": "",
|
|
286
|
+
"deviceType": "device",
|
|
287
|
+
"deviceId": "",
|
|
288
|
+
"deviceName": "",
|
|
289
|
+
"capability": "observeAvailability",
|
|
290
|
+
"capabilityConfig": "{\"delaySeconds\": 60, \"pollSeconds\": 10}",
|
|
291
|
+
"inputs": 0,
|
|
292
|
+
"autoEmit": false,
|
|
293
|
+
"autoEmitInterval": 60,
|
|
294
|
+
"x": 420,
|
|
295
|
+
"y": 520,
|
|
296
|
+
"wires": [
|
|
297
|
+
[
|
|
298
|
+
"guided-unifi-4-result"
|
|
299
|
+
],
|
|
300
|
+
[
|
|
301
|
+
"guided-unifi-4-error"
|
|
302
|
+
]
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"id": "guided-unifi-4-result",
|
|
307
|
+
"type": "debug",
|
|
308
|
+
"z": "guided-unifi-tab",
|
|
309
|
+
"name": "Device outage and recovery: result",
|
|
310
|
+
"active": true,
|
|
311
|
+
"tosidebar": true,
|
|
312
|
+
"console": false,
|
|
313
|
+
"tostatus": false,
|
|
314
|
+
"complete": "true",
|
|
315
|
+
"targetType": "full",
|
|
316
|
+
"statusVal": "",
|
|
317
|
+
"statusType": "auto",
|
|
318
|
+
"x": 790,
|
|
319
|
+
"y": 500,
|
|
320
|
+
"wires": []
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"id": "guided-unifi-4-error",
|
|
324
|
+
"type": "debug",
|
|
325
|
+
"z": "guided-unifi-tab",
|
|
326
|
+
"name": "Device outage and recovery: error",
|
|
327
|
+
"active": true,
|
|
328
|
+
"tosidebar": true,
|
|
329
|
+
"console": false,
|
|
330
|
+
"tostatus": false,
|
|
331
|
+
"complete": "true",
|
|
332
|
+
"targetType": "full",
|
|
333
|
+
"statusVal": "",
|
|
334
|
+
"statusType": "auto",
|
|
335
|
+
"x": 790,
|
|
336
|
+
"y": 540,
|
|
337
|
+
"wires": []
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"id": "guided-unifi-5",
|
|
341
|
+
"type": "unifi-network-device",
|
|
342
|
+
"z": "guided-unifi-tab",
|
|
343
|
+
"name": "Internet and WAN changes",
|
|
344
|
+
"server": "",
|
|
345
|
+
"deviceType": "site",
|
|
346
|
+
"deviceId": "",
|
|
347
|
+
"deviceName": "",
|
|
348
|
+
"capability": "observeInternet",
|
|
349
|
+
"capabilityConfig": "{\"delaySeconds\": 30, \"pollSeconds\": 15}",
|
|
350
|
+
"inputs": 0,
|
|
351
|
+
"autoEmit": false,
|
|
352
|
+
"autoEmitInterval": 60,
|
|
353
|
+
"x": 420,
|
|
354
|
+
"y": 620,
|
|
355
|
+
"wires": [
|
|
356
|
+
[
|
|
357
|
+
"guided-unifi-5-result"
|
|
358
|
+
],
|
|
359
|
+
[
|
|
360
|
+
"guided-unifi-5-error"
|
|
361
|
+
]
|
|
362
|
+
]
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"id": "guided-unifi-5-result",
|
|
366
|
+
"type": "debug",
|
|
367
|
+
"z": "guided-unifi-tab",
|
|
368
|
+
"name": "Internet and WAN changes: result",
|
|
369
|
+
"active": true,
|
|
370
|
+
"tosidebar": true,
|
|
371
|
+
"console": false,
|
|
372
|
+
"tostatus": false,
|
|
373
|
+
"complete": "true",
|
|
374
|
+
"targetType": "full",
|
|
375
|
+
"statusVal": "",
|
|
376
|
+
"statusType": "auto",
|
|
377
|
+
"x": 790,
|
|
378
|
+
"y": 600,
|
|
379
|
+
"wires": []
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"id": "guided-unifi-5-error",
|
|
383
|
+
"type": "debug",
|
|
384
|
+
"z": "guided-unifi-tab",
|
|
385
|
+
"name": "Internet and WAN changes: error",
|
|
386
|
+
"active": true,
|
|
387
|
+
"tosidebar": true,
|
|
388
|
+
"console": false,
|
|
389
|
+
"tostatus": false,
|
|
390
|
+
"complete": "true",
|
|
391
|
+
"targetType": "full",
|
|
392
|
+
"statusVal": "",
|
|
393
|
+
"statusType": "auto",
|
|
394
|
+
"x": 790,
|
|
395
|
+
"y": 640,
|
|
396
|
+
"wires": []
|
|
397
|
+
}
|
|
398
|
+
]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "tab-protect-lpr",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "UniFi Protect License Plates",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "Enable LPR on a compatible Protect camera. Set the controller, API key and optional Local User/Local Password in the shared Protect connection. Use a local UniFi OS account with access to the camera's recordings. Select the camera. Listening starts at deploy; no Inject node is needed."
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "comment-protect-lpr",
|
|
11
|
+
"type": "comment",
|
|
12
|
+
"z": "tab-protect-lpr",
|
|
13
|
+
"name": "Configure connection, camera and local LPR account before deploying",
|
|
14
|
+
"info": "Output 1 emits each recognized plate as msg.payload (string). msg.details.lpr contains the event ID and available OCR confidence. Output 2 reports lookup/configuration errors. Enter the local account in the shared Protect connection. Credentials are not included in this example.",
|
|
15
|
+
"x": 380,
|
|
16
|
+
"y": 60,
|
|
17
|
+
"wires": []
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "node-protect-lpr",
|
|
21
|
+
"type": "unifi-protect-device",
|
|
22
|
+
"z": "tab-protect-lpr",
|
|
23
|
+
"name": "Driveway LPR",
|
|
24
|
+
"server": "config-protect-lpr",
|
|
25
|
+
"deviceType": "camera",
|
|
26
|
+
"deviceId": "replace-with-camera-id",
|
|
27
|
+
"deviceName": "Driveway",
|
|
28
|
+
"inputs": 0,
|
|
29
|
+
"capability": "observe",
|
|
30
|
+
"capabilityConfig": "{\"observable\":\"licensePlate\"}",
|
|
31
|
+
"autoEmit": false,
|
|
32
|
+
"autoEmitInterval": 60,
|
|
33
|
+
"x": 220,
|
|
34
|
+
"y": 160,
|
|
35
|
+
"wires": [["debug-protect-lpr"], ["debug-protect-lpr-error"]]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "debug-protect-lpr",
|
|
39
|
+
"type": "debug",
|
|
40
|
+
"z": "tab-protect-lpr",
|
|
41
|
+
"name": "Recognized plate and details",
|
|
42
|
+
"active": true,
|
|
43
|
+
"tosidebar": true,
|
|
44
|
+
"console": false,
|
|
45
|
+
"tostatus": false,
|
|
46
|
+
"complete": "true",
|
|
47
|
+
"targetType": "full",
|
|
48
|
+
"x": 560,
|
|
49
|
+
"y": 140,
|
|
50
|
+
"wires": []
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"id": "debug-protect-lpr-error",
|
|
54
|
+
"type": "debug",
|
|
55
|
+
"z": "tab-protect-lpr",
|
|
56
|
+
"name": "LPR errors",
|
|
57
|
+
"active": true,
|
|
58
|
+
"tosidebar": true,
|
|
59
|
+
"console": false,
|
|
60
|
+
"tostatus": false,
|
|
61
|
+
"complete": "true",
|
|
62
|
+
"targetType": "full",
|
|
63
|
+
"x": 510,
|
|
64
|
+
"y": 200,
|
|
65
|
+
"wires": []
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "config-protect-lpr",
|
|
69
|
+
"type": "unifi-protect-config",
|
|
70
|
+
"name": "My Protect",
|
|
71
|
+
"host": "192.168.1.10",
|
|
72
|
+
"port": "",
|
|
73
|
+
"rejectUnauthorized": false
|
|
74
|
+
}
|
|
75
|
+
]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<link rel="stylesheet" type="text/css"
|
|
2
2
|
href="resources/node-red-contrib-unifi-ultimate/editor/unifi-ultimate-editor-common.css">
|
|
3
3
|
|
|
4
|
+
<script type="text/javascript" src="resources/node-red-contrib-unifi-ultimate/editor/unifi-connection-check.js"></script>
|
|
4
5
|
<script type="text/javascript">
|
|
5
6
|
RED.nodes.registerType("unifi-access-config", {
|
|
6
7
|
category: "config",
|
|
@@ -20,13 +21,16 @@
|
|
|
20
21
|
rejectUnauthorized: { value: false }
|
|
21
22
|
},
|
|
22
23
|
credentials: {
|
|
23
|
-
apiToken: { type: "password", required: true }
|
|
24
|
+
apiToken: { type: "password", required: true },
|
|
25
|
+
localUsername: { type: "text" },
|
|
26
|
+
localPassword: { type: "password" }
|
|
24
27
|
},
|
|
25
28
|
label: function () {
|
|
26
29
|
return this.name || this.host || "Unifi Access Config";
|
|
27
30
|
},
|
|
28
31
|
oneditprepare: function () {
|
|
29
32
|
const node = this;
|
|
33
|
+
UnifiUltimateConnectionCheck.bind(node, "access");
|
|
30
34
|
const $hostInput = $("#node-config-input-host");
|
|
31
35
|
const $port = $("#node-config-input-port");
|
|
32
36
|
const $apiToken = $("#node-config-input-apiToken");
|
|
@@ -35,6 +39,7 @@
|
|
|
35
39
|
const $apiTokenRow = $apiToken.closest(".form-row");
|
|
36
40
|
const $securityRow = $allowSelfSigned.closest(".form-row");
|
|
37
41
|
const $advancedRow = $("#node-config-row-advanced");
|
|
42
|
+
const $localAccountRow = $("#node-config-row-localAccount");
|
|
38
43
|
|
|
39
44
|
// The stored field is rejectUnauthorized, but the checkbox is shown as
|
|
40
45
|
// its inverse ("Allow self-signed certificate") because UniFi
|
|
@@ -48,6 +53,7 @@
|
|
|
48
53
|
$apiTokenRow.toggle(hasHost);
|
|
49
54
|
$securityRow.toggle(hasHost);
|
|
50
55
|
$advancedRow.toggle(hasHost);
|
|
56
|
+
$localAccountRow.toggle(hasHost);
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
try {
|
|
@@ -63,7 +69,9 @@
|
|
|
63
69
|
syncProgressiveRows();
|
|
64
70
|
});
|
|
65
71
|
},
|
|
72
|
+
oneditcancel: function () { UnifiUltimateConnectionCheck.cleanup(this); },
|
|
66
73
|
oneditsave: function () {
|
|
74
|
+
UnifiUltimateConnectionCheck.cleanup(this);
|
|
67
75
|
// Persist the inverse of the "Allow self-signed certificate" checkbox.
|
|
68
76
|
this.rejectUnauthorized = !$("#node-config-input-allowSelfSigned").prop("checked");
|
|
69
77
|
}
|
|
@@ -92,11 +100,26 @@
|
|
|
92
100
|
<label for="node-config-input-apiToken"><i class="fa fa-key"></i> API Token</label>
|
|
93
101
|
<input type="password" id="node-config-input-apiToken" placeholder="Paste your UniFi Access token">
|
|
94
102
|
</div>
|
|
103
|
+
<div id="node-config-row-localAccount">
|
|
104
|
+
<div class="form-row">
|
|
105
|
+
<label for="node-config-input-localUsername"><i class="fa fa-user"></i> Local User</label>
|
|
106
|
+
<input type="text" id="node-config-input-localUsername" autocomplete="off" placeholder="Local UniFi OS username (optional)">
|
|
107
|
+
</div>
|
|
108
|
+
<div class="form-row">
|
|
109
|
+
<label for="node-config-input-localPassword"><i class="fa fa-lock"></i> Local Password</label>
|
|
110
|
+
<input type="password" id="node-config-input-localPassword" autocomplete="new-password" placeholder="Local UniFi OS password (optional)">
|
|
111
|
+
</div>
|
|
112
|
+
<p class="unifi-ultimate-tip">Optional. Current actions use the API token.</p>
|
|
113
|
+
</div>
|
|
95
114
|
<div class="form-row">
|
|
96
115
|
<label for="node-config-input-allowSelfSigned"><i class="fa fa-lock"></i> Security</label>
|
|
97
116
|
<input type="checkbox" id="node-config-input-allowSelfSigned" style="display:inline-block; width:auto; vertical-align:top;">
|
|
98
117
|
<span style="margin-left:8px;">Allow self-signed certificate</span>
|
|
99
118
|
</div>
|
|
119
|
+
<div class="form-row">
|
|
120
|
+
<button type="button" class="red-ui-button" id="node-config-test-connection"><i class="fa fa-check-circle"></i> Verify Connection</button>
|
|
121
|
+
<div id="node-config-test-results" role="status" aria-live="polite" style="margin-top:10px; white-space:normal;"></div>
|
|
122
|
+
</div>
|
|
100
123
|
<div id="node-config-row-advanced" class="unifi-ultimate-advanced">
|
|
101
124
|
<div class="form-row">
|
|
102
125
|
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
@@ -117,7 +140,14 @@
|
|
|
117
140
|
<p><b>Security</b> — <b>Allow self-signed certificate</b> is enabled by default because UniFi controllers almost always present a self-signed certificate. Leave it checked for UniFi Access setups. Uncheck it only if your controller serves a certificate signed by a trusted certificate authority and you want strict verification.</p>
|
|
118
141
|
<p><b>Name</b> is the config node name shown in the editor.</p>
|
|
119
142
|
|
|
143
|
+
<h3>Optional local account</h3>
|
|
144
|
+
<p><b>Local User</b> and <b>Local Password</b> accept an account created locally on the UniFi OS console configured above. Enter both fields when using a feature that requires a user login, or leave both empty. These credentials are stored by Node-RED in its credential store, separately from ordinary flow properties, and are not included in output messages.</p>
|
|
145
|
+
<p>The current Access implementation authenticates API calls and notification streams with the <b>API Token</b>. The optional local account is stored for integrations that need a user session; it is not used by the current Access actions and does not enable additional features or replace the required token.</p>
|
|
146
|
+
|
|
147
|
+
<h3>Verify Connection</h3>
|
|
148
|
+
<p>Use <b>Verify Connection</b> to check the values currently entered, before saving. The test runs from the Node-RED host and reports reachability, API authentication and available read permissions. For Protect and Network, a complete optional local account is also checked. It does not modify devices or save credentials. A successful check does not guarantee every camera, door or site permission.</p>
|
|
149
|
+
<p>If you change the controller address while using a saved password, re-enter the credentials to test it. An undeployed configuration with a masked password also needs the password entered again. Errors explain whether to check the address, certificate, credentials or permissions.</p>
|
|
120
150
|
<h3>Usage</h3>
|
|
121
151
|
<p>This config node is used by UniFi Access Device nodes for API requests and live notification events.</p>
|
|
122
152
|
<p>All Access API calls and notification channels are managed by this config node. Runtime nodes subscribe through <code>addClient/removeClient</code> and receive fan-out updates.</p>
|
|
123
|
-
</script>
|
|
153
|
+
</script>
|