node-red-contrib-unifi-ultimate 0.1.0-beta.1 → 0.1.0-beta.3
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 +94 -67
- package/nodes/icons/unifi-ultimate-logo.svg +46 -0
- package/nodes/unifi-access-config.html +50 -0
- package/nodes/unifi-access-config.js +451 -0
- package/nodes/unifi-access-device.html +710 -0
- package/nodes/unifi-access-device.js +290 -0
- package/nodes/unifi-protect-config.html +4 -3
- package/nodes/unifi-protect-config.js +27 -1
- package/nodes/unifi-protect-device.html +81 -63
- package/nodes/unifi-protect-device.js +21 -3
- package/nodes/utils/unifi-access-device-registry.js +425 -0
- package/nodes/utils/unifi-access-utils.js +195 -0
- package/nodes/utils/unifi-protect-device-registry.js +171 -45
- package/nodes/utils/unifi-protect-field-metadata.js +412 -0
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -1,13 +1,52 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="nodes/icons/unifi-ultimate-logo.svg" alt="Unifi Ultimate" width="720">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# node-red-contrib-unifi-ultimate
|
|
2
6
|
|
|
3
|
-
Node-RED nodes for Ubiquiti UniFi integrations,
|
|
7
|
+
Node-RED nodes for Ubiquiti UniFi integrations, currently covering UniFi Protect and a first UniFi Access beta.
|
|
4
8
|
|
|
5
|
-
Current release status: `0.1.0-beta.
|
|
9
|
+
Current release status: `0.1.0-beta.2`
|
|
6
10
|
|
|
7
11
|
## Included in this first version
|
|
8
12
|
|
|
9
|
-
- `Unifi Protect Device`: generic Protect object node with discovery of device types, instances, and
|
|
13
|
+
- `Unifi Protect Device`: generic Protect object node with discovery of device types, instances, and device-specific capabilities
|
|
10
14
|
- `Unifi Protect Config`: shared configuration node for controller IP, API key header, API key, and TLS behavior
|
|
15
|
+
- `Unifi Access Device`: first generic Access node focused on doors, Access devices, notification events, and safe doorbell control
|
|
16
|
+
- `Unifi Access Config`: shared configuration node for host, bearer token, and TLS behavior
|
|
17
|
+
|
|
18
|
+
## Supported Access device types
|
|
19
|
+
|
|
20
|
+
- `Door`
|
|
21
|
+
- `Access Device`
|
|
22
|
+
|
|
23
|
+
## Supported Access capabilities
|
|
24
|
+
|
|
25
|
+
Common capabilities:
|
|
26
|
+
|
|
27
|
+
- `Receive Events`
|
|
28
|
+
- `Read State`
|
|
29
|
+
|
|
30
|
+
Door-specific capabilities:
|
|
31
|
+
|
|
32
|
+
- `Unlock Door`
|
|
33
|
+
- `Read Lock Rule`
|
|
34
|
+
- `Set Temporary Lock Rule`
|
|
35
|
+
- `Read Emergency Mode`
|
|
36
|
+
- `Set Emergency Mode`
|
|
37
|
+
|
|
38
|
+
Access device-specific capabilities:
|
|
39
|
+
|
|
40
|
+
- `Read Access Methods`
|
|
41
|
+
- `Update Access Methods`
|
|
42
|
+
- `Trigger Doorbell`
|
|
43
|
+
- `Cancel Doorbell`
|
|
44
|
+
|
|
45
|
+
Notes:
|
|
46
|
+
|
|
47
|
+
- the capability list is filtered using the selected Access device
|
|
48
|
+
- `Trigger Doorbell` and `Cancel Doorbell` use a manual `Room Name` when needed
|
|
49
|
+
- `Cancel Doorbell` uses controller-level safe tracking in the shared Access config node, with a `60s` ring timeout
|
|
11
50
|
|
|
12
51
|
## Supported Protect device types
|
|
13
52
|
|
|
@@ -23,32 +62,39 @@ Current release status: `0.1.0-beta.1`
|
|
|
23
62
|
|
|
24
63
|
Common capabilities:
|
|
25
64
|
|
|
26
|
-
- `
|
|
27
|
-
- `
|
|
28
|
-
- `
|
|
65
|
+
- `Receive Events`
|
|
66
|
+
- `Read Device State`
|
|
67
|
+
- `Send Raw Update`
|
|
29
68
|
|
|
30
69
|
Camera-specific capabilities:
|
|
31
70
|
|
|
32
|
-
- `
|
|
33
|
-
- `
|
|
34
|
-
- `
|
|
35
|
-
- `Create RTSPS
|
|
36
|
-
- `Delete RTSPS
|
|
37
|
-
- `
|
|
38
|
-
- `Disable
|
|
39
|
-
- `Start PTZ
|
|
40
|
-
- `Stop PTZ
|
|
41
|
-
- `
|
|
42
|
-
- `
|
|
43
|
-
- `
|
|
71
|
+
- `Take Snapshot`
|
|
72
|
+
- `Take Snapshot` with `High quality` option
|
|
73
|
+
- `List RTSPS Streams`
|
|
74
|
+
- `Create RTSPS Stream`
|
|
75
|
+
- `Delete RTSPS Stream`
|
|
76
|
+
- `Start Talkback Session`
|
|
77
|
+
- `Disable Microphone Permanently`
|
|
78
|
+
- `Start PTZ Patrol`
|
|
79
|
+
- `Stop PTZ Patrol`
|
|
80
|
+
- `Recall PTZ Preset`
|
|
81
|
+
- `Show Doorbell Message`
|
|
82
|
+
- `Update One Property`
|
|
44
83
|
|
|
45
84
|
Patchable object capabilities:
|
|
46
85
|
|
|
47
|
-
- `
|
|
86
|
+
- `Update One Property` for `Camera`, `Sensor`, `Light`, `Chime`, `Viewer`, and `Live View`
|
|
48
87
|
|
|
49
88
|
Viewer-specific capabilities:
|
|
50
89
|
|
|
51
|
-
- `
|
|
90
|
+
- `Switch Live View`
|
|
91
|
+
|
|
92
|
+
Notes:
|
|
93
|
+
|
|
94
|
+
- the capability list is filtered using the selected Protect device
|
|
95
|
+
- PTZ actions appear only for cameras that look PTZ-capable
|
|
96
|
+
- doorbell actions appear only for doorbell-capable cameras
|
|
97
|
+
- microphone actions appear only for cameras that expose mic-related fields
|
|
52
98
|
|
|
53
99
|
## Configuration model
|
|
54
100
|
|
|
@@ -62,6 +108,16 @@ The nodes append the operation path automatically, for example `/v1/meta/info`,
|
|
|
62
108
|
|
|
63
109
|
The API key header is configurable. The default is `X-API-Key`.
|
|
64
110
|
|
|
111
|
+
For UniFi Access, the config node asks for the Access host or `host[:port]`.
|
|
112
|
+
|
|
113
|
+
The package builds the Access base URL automatically as:
|
|
114
|
+
|
|
115
|
+
- `https://<HOST>:12445` when no port is specified
|
|
116
|
+
|
|
117
|
+
Authentication follows the official Access documentation and sends:
|
|
118
|
+
|
|
119
|
+
- `Authorization: Bearer <token>`
|
|
120
|
+
|
|
65
121
|
## Runtime behavior
|
|
66
122
|
|
|
67
123
|
The `Device` node supports runtime overrides via `msg`:
|
|
@@ -77,64 +133,35 @@ The `Device` node supports runtime overrides via `msg`:
|
|
|
77
133
|
|
|
78
134
|
Some capabilities expose options discovered from Protect and configured directly in the editor. For example:
|
|
79
135
|
|
|
80
|
-
- `
|
|
81
|
-
- `
|
|
82
|
-
- `
|
|
83
|
-
- `
|
|
84
|
-
- `Start PTZ
|
|
85
|
-
- `
|
|
86
|
-
- `
|
|
87
|
-
- `
|
|
136
|
+
- `Receive Events` on `Sensor` lets you choose which boolean observable to monitor
|
|
137
|
+
- `Receive Events` on `Camera` lets you choose boolean event-driven observables like ring, motion, and smart detections
|
|
138
|
+
- `Receive Events` on `Light` lets you choose boolean observables like motion or light on/off
|
|
139
|
+
- `Recall PTZ Preset` can offer PTZ preset choices for the selected camera
|
|
140
|
+
- `Start PTZ Patrol` offers patrol slot selection
|
|
141
|
+
- `Show Doorbell Message` guides predefined/custom/image doorbell messages and can load image assets from Protect
|
|
142
|
+
- `Switch Live View` can offer available live views for the selected viewer
|
|
143
|
+
- `Update One Property` discovers patchable properties from the selected device payload and adapts the value field to booleans, numbers, strings, or related object selections
|
|
88
144
|
|
|
89
145
|
In these cases, the node can be triggered by any input message and will build the correct request from the selected capability options.
|
|
90
146
|
|
|
91
|
-
For `Sensor +
|
|
147
|
+
For `Sensor + Receive Events`:
|
|
92
148
|
|
|
93
149
|
- `msg.payload` is normalized to `true` or `false`
|
|
94
150
|
- the full original device/event context is exposed in `msg.RAW`
|
|
95
151
|
|
|
96
|
-
The same boolean-output pattern
|
|
152
|
+
The same boolean-output pattern also applies to supported `Camera + Receive Events` and `Light + Receive Events` observables.
|
|
97
153
|
|
|
98
154
|
Output fields:
|
|
99
155
|
|
|
100
156
|
- Output 1: state or main capability response
|
|
101
|
-
- Output 2: Protect events for the selected device when capability is `
|
|
157
|
+
- Output 2: Protect events for the selected device when capability is `Receive Events`
|
|
102
158
|
- `msg.unifiProtect`: standardized device metadata
|
|
103
159
|
- `msg.device`: last known object payload, when available
|
|
104
160
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Then restart Node-RED.
|
|
114
|
-
|
|
115
|
-
## Official references used
|
|
116
|
-
|
|
117
|
-
- Node-RED Creating Nodes: https://nodered.org/docs/creating-nodes/
|
|
118
|
-
- Node-RED Config nodes: https://nodered.org/docs/creating-nodes/config-nodes
|
|
119
|
-
- Node-RED Credentials: https://nodered.org/docs/creating-nodes/credentials
|
|
120
|
-
- Node-RED Packaging: https://nodered.org/docs/creating-nodes/packaging.html
|
|
121
|
-
- UniFi Protect Getting Started: https://developer.ui.com/protect/v6.2.88/gettingstarted
|
|
122
|
-
- UniFi Protect Get Application Info: https://developer.ui.com/protect/v6.2.88/get-v1metainfo
|
|
123
|
-
- UniFi Protect Get Cameras: https://developer.ui.com/protect/v6.2.88/get-v1cameras
|
|
124
|
-
- UniFi Protect Get Camera Details: https://developer.ui.com/protect/v6.2.88/get-v1camerasid
|
|
125
|
-
- UniFi Protect Get Sensors: https://developer.ui.com/protect/v6.2.88/get-v1sensors
|
|
126
|
-
- UniFi Protect Get Lights: https://developer.ui.com/protect/v6.2.88/get-v1lights
|
|
127
|
-
- UniFi Protect Get Chimes: https://developer.ui.com/protect/v6.2.88/get-v1chimes
|
|
128
|
-
- UniFi Protect Get Viewers: https://developer.ui.com/protect/v6.2.88/get-v1viewers
|
|
129
|
-
- UniFi Protect Patch Viewer: https://developer.ui.com/protect/v6.2.88/patch-v1viewersid
|
|
130
|
-
- UniFi Protect Get Live Views: https://developer.ui.com/protect/v6.2.88/get-v1liveviews
|
|
131
|
-
- UniFi Protect Patch Live View: https://developer.ui.com/protect/v6.2.88/patch-v1liveviewsid
|
|
132
|
-
- UniFi Protect Get NVR Details: https://developer.ui.com/protect/v6.2.88/get-v1nvrs
|
|
133
|
-
- UniFi Protect Get Device Asset Files: https://developer.ui.com/protect/v6.2.88/get-v1filesfiletype
|
|
134
|
-
- UniFi Protect Upload Device Asset File: https://developer.ui.com/protect/v6.2.88/post-v1filesfiletype
|
|
135
|
-
- UniFi Protect Patch Sensor: https://developer.ui.com/protect/v6.2.88/patch-v1sensorsid
|
|
136
|
-
- UniFi Protect Patch Light: https://developer.ui.com/protect/v6.2.88/patch-v1lightsid
|
|
137
|
-
- UniFi Protect Patch Chime: https://developer.ui.com/protect/v6.2.88/patch-v1chimesid
|
|
138
|
-
- UniFi Protect Patch Camera: https://developer.ui.com/protect/v6.2.88/patch-v1camerasid
|
|
139
|
-
- UniFi Protect WebSocket Device Updates: https://developer.ui.com/protect/v6.2.88/get-v1subscribedevices
|
|
140
|
-
- UniFi Protect WebSocket Events: https://developer.ui.com/protect/v6.2.88/get-v1subscribeevents
|
|
161
|
+
For the first UniFi Access beta:
|
|
162
|
+
|
|
163
|
+
- `Receive Events` performs an initial state fetch and then listens to the official Access notifications WebSocket
|
|
164
|
+
- Output 1 carries the current door/device state or the main response
|
|
165
|
+
- Output 2 carries matching Access notification events
|
|
166
|
+
- `msg.unifiAccess` contains standardized metadata for Access nodes
|
|
167
|
+
- `Cancel Doorbell` returns `msg.payload.skipped = true` when the shared Access config node is not currently tracking any active ring
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 280" role="img" aria-labelledby="title desc">
|
|
2
|
+
<title id="title">Unifi Ultimate</title>
|
|
3
|
+
<desc id="desc">Logo for the node-red-contrib-unifi-ultimate package for UBIQUITI UniFi.</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
6
|
+
<stop offset="0%" stop-color="#f3f8fc"/>
|
|
7
|
+
<stop offset="100%" stop-color="#eef3fb"/>
|
|
8
|
+
</linearGradient>
|
|
9
|
+
<linearGradient id="brand" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
10
|
+
<stop offset="0%" stop-color="#1173ff"/>
|
|
11
|
+
<stop offset="100%" stop-color="#0047b8"/>
|
|
12
|
+
</linearGradient>
|
|
13
|
+
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
|
|
14
|
+
<feDropShadow dx="0" dy="10" stdDeviation="14" flood-color="#18324f" flood-opacity="0.12"/>
|
|
15
|
+
</filter>
|
|
16
|
+
</defs>
|
|
17
|
+
|
|
18
|
+
<rect x="16" y="16" width="928" height="248" rx="32" fill="url(#bg)"/>
|
|
19
|
+
|
|
20
|
+
<g transform="translate(48 44)" filter="url(#shadow)">
|
|
21
|
+
<rect x="0" y="0" width="192" height="192" rx="40" fill="#ffffff"/>
|
|
22
|
+
<rect x="18" y="18" width="156" height="156" rx="34" fill="url(#brand)"/>
|
|
23
|
+
<g transform="translate(33 31)">
|
|
24
|
+
<path d="M96 0h18v18H96z" fill="#ffffff"/>
|
|
25
|
+
<path d="M76 54h20v20H76z" fill="#ffffff"/>
|
|
26
|
+
<path d="M56 71v25c0 22.091 17.909 40 40 40s40-17.909 40-40V54h-20v42c0 11.046-8.954 20-20 20s-20-8.954-20-20V71z" fill="#ffffff"/>
|
|
27
|
+
<path d="M16 54h20v42c0 33.137 26.863 60 60 60s60-26.863 60-60V54h20v42c0 20.628-4.676 35.684-12.42 48.133-3.572 5.742-7.84 11.006-12.664 15.766-14.896 14.688-34.824 24.101-54.916 26.114-3.021.303-9.044.606-12 .606-2.956 0-8.979-.303-12-.606-20.092-2.013-40.02-11.426-54.916-26.114-4.824-4.76-9.092-10.024-12.664-15.766C20.676 131.684 16 116.628 16 96z" fill="#ffffff" opacity=".22"/>
|
|
28
|
+
</g>
|
|
29
|
+
</g>
|
|
30
|
+
|
|
31
|
+
<g transform="translate(284 72)">
|
|
32
|
+
<text x="0" y="56" fill="#0f2238" font-family="Helvetica, Arial, sans-serif" font-size="58" font-weight="700" letter-spacing="0.5">
|
|
33
|
+
Unifi Ultimate
|
|
34
|
+
</text>
|
|
35
|
+
<text x="0" y="100" fill="#47627d" font-family="Helvetica, Arial, sans-serif" font-size="24" font-weight="500">
|
|
36
|
+
for UBIQUITI UniFi
|
|
37
|
+
</text>
|
|
38
|
+
|
|
39
|
+
<g transform="translate(0 132)">
|
|
40
|
+
<rect x="0" y="0" width="156" height="40" rx="20" fill="#ffffff"/>
|
|
41
|
+
<text x="25" y="26" fill="#42556b" font-family="Helvetica, Arial, sans-serif" font-size="20" font-weight="600">
|
|
42
|
+
Beta Package
|
|
43
|
+
</text>
|
|
44
|
+
</g>
|
|
45
|
+
</g>
|
|
46
|
+
</svg>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType("unifi-access-config", {
|
|
3
|
+
category: "config",
|
|
4
|
+
defaults: {
|
|
5
|
+
name: { value: "Unifi Access Config" },
|
|
6
|
+
host: { value: "", required: true },
|
|
7
|
+
rejectUnauthorized: { value: false }
|
|
8
|
+
},
|
|
9
|
+
credentials: {
|
|
10
|
+
apiToken: { type: "password", required: true }
|
|
11
|
+
},
|
|
12
|
+
label: function () {
|
|
13
|
+
return this.name || this.host || "Unifi Access Config";
|
|
14
|
+
},
|
|
15
|
+
oneditprepare: function () {
|
|
16
|
+
try {
|
|
17
|
+
RED.sidebar.show("help");
|
|
18
|
+
} catch (error) {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<script type="text/html" data-template-name="unifi-access-config">
|
|
25
|
+
<div class="form-row">
|
|
26
|
+
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
27
|
+
<input type="text" id="node-config-input-name" placeholder="Unifi Access Config">
|
|
28
|
+
</div>
|
|
29
|
+
<div class="form-row">
|
|
30
|
+
<label for="node-config-input-host"><i class="fa fa-globe"></i> Host</label>
|
|
31
|
+
<input type="text" id="node-config-input-host" placeholder="192.168.1.10 or access.local:12445">
|
|
32
|
+
</div>
|
|
33
|
+
<div class="form-row">
|
|
34
|
+
<label for="node-config-input-apiToken"><i class="fa fa-key"></i> API Token</label>
|
|
35
|
+
<input type="password" id="node-config-input-apiToken">
|
|
36
|
+
</div>
|
|
37
|
+
<div class="form-row">
|
|
38
|
+
<label for="node-config-input-rejectUnauthorized"><i class="fa fa-lock"></i> Verify TLS</label>
|
|
39
|
+
<input type="checkbox" id="node-config-input-rejectUnauthorized" style="display:inline-block; width:auto; vertical-align:top;">
|
|
40
|
+
<span style="margin-left:8px;">Reject invalid/self-signed certificates</span>
|
|
41
|
+
</div>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<script type="text/html" data-help-name="unifi-access-config">
|
|
45
|
+
<p>Shared configuration for UniFi Access nodes.</p>
|
|
46
|
+
<p>Enter the UniFi Access host or <code>host:port</code>. If the port is omitted, the node uses the documented default <code>12445</code> and builds requests as <code>https://host:12445</code>.</p>
|
|
47
|
+
<p>Authentication uses the official bearer token model: the node sends <code>Authorization: Bearer <token></code>.</p>
|
|
48
|
+
<p>This config node also keeps the shared WebSocket connection and the controller-level doorbell ring tracking used by <code>Cancel Doorbell</code>.</p>
|
|
49
|
+
<p><small>Note: the official UniFi Access API documentation states that the API is not available after upgrading to Identity Enterprise.</small></p>
|
|
50
|
+
</script>
|