node-red-contrib-unifi-ultimate 1.1.6 → 1.1.9
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 +12 -0
- package/nodes/unifi-protect-config.html +5 -0
- package/nodes/unifi-protect-config.js +249 -1
- package/nodes/unifi-protect-device.html +2 -1
- package/nodes/utils/knx-ai-camera-registry.js +253 -0
- package/nodes/utils/unifi-protect-device-registry.js +105 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -124,6 +124,18 @@ Things you can do:
|
|
|
124
124
|
- Switch a viewer to a different live feed.
|
|
125
125
|
- Monitor bridges, Link Stations, alarm hubs, key fobs, sirens, relays, and speakers.
|
|
126
126
|
- Play or stop a siren, control relay outputs, and test speaker or siren sound.
|
|
127
|
+
- Read and select Protect Arm Profiles, then arm or disarm the local Alarm Manager from the NVR control.
|
|
128
|
+
|
|
129
|
+
### Automatic KNX AI camera adapter
|
|
130
|
+
|
|
131
|
+
When `node-red-contrib-knx-ultimate` is installed, every configured **Unifi Protect Config** instance automatically publishes its cameras to the KNX AI chat runtime. No Protect Device node, selector, or intermediate wire is required. KNX AI can then:
|
|
132
|
+
|
|
133
|
+
- send a current camera snapshot to Telegram or RedBot;
|
|
134
|
+
- describe a fresh snapshot with the configured vision-capable LLM;
|
|
135
|
+
- create persistent chat notifications for unclassified motion or generic smart detections, as well as line crossings, intrusion zones, and loiter zones;
|
|
136
|
+
- filter smart events by the camera's supported classifications, including people, animals, vehicles, faces, license plates, and packages, and optionally by an exact line or zone exposed by Protect.
|
|
137
|
+
|
|
138
|
+
The integration uses the generic `node-red.knx-ai.camera-adapters.v1` runtime contract, so other camera packages can register the same catalog/snapshot/event capabilities without vendor-specific code in KNX AI. Protect API keys remain inside this config node and are never copied into KNX AI.
|
|
127
139
|
|
|
128
140
|
<br/>
|
|
129
141
|
<br/>
|
|
@@ -122,4 +122,9 @@
|
|
|
122
122
|
<h3>Usage</h3>
|
|
123
123
|
<p>This config node is used by UniFi Protect Device nodes for API requests and live device/event updates.</p>
|
|
124
124
|
<p>All Protect API calls and websocket streams are managed by this config node. Runtime nodes subscribe through <code>addClient/removeClient</code> and receive broadcast updates.</p>
|
|
125
|
+
|
|
126
|
+
<h3>Automatic KNX AI camera adapter</h3>
|
|
127
|
+
<p>If <code>node-red-contrib-knx-ultimate</code> is installed, this config node automatically publishes its available cameras to the KNX AI chat runtime. No Protect Device node, camera selector, or wire to KNX AI is required.</p>
|
|
128
|
+
<p>KNX AI can request snapshots directly and subscribe to motion, smart line, intrusion-zone, and loiter-zone events. Persistent notification rules remain owned by the KNX AI chat context. The API key stays private inside this config node.</p>
|
|
129
|
+
<p>The provider uses the generic <code>node-red.knx-ai.camera-adapters.v1</code> runtime contract, allowing other camera suites to expose the same capabilities independently.</p>
|
|
125
130
|
</script>
|
|
@@ -17,8 +17,73 @@ const {
|
|
|
17
17
|
normalizeDeviceCollection,
|
|
18
18
|
summarizeDevice
|
|
19
19
|
} = require("./utils/unifi-protect-device-registry");
|
|
20
|
+
const {
|
|
21
|
+
collectNamedScopes,
|
|
22
|
+
getKnxAiCameraRegistry,
|
|
23
|
+
normalizeProtectCameraEvent,
|
|
24
|
+
normalizeSearchText
|
|
25
|
+
} = require("./utils/knx-ai-camera-registry");
|
|
26
|
+
|
|
27
|
+
function extractProtectErrorDetail(response) {
|
|
28
|
+
let payload = response && response.payload;
|
|
29
|
+
if (Buffer.isBuffer(payload)) {
|
|
30
|
+
const text = payload.length <= 8192 ? payload.toString("utf8").trim() : "";
|
|
31
|
+
if (!text) return "";
|
|
32
|
+
try { payload = JSON.parse(text); } catch (error) { payload = text; }
|
|
33
|
+
}
|
|
34
|
+
if (typeof payload === "string") {
|
|
35
|
+
const text = payload.trim();
|
|
36
|
+
if (!text) return "";
|
|
37
|
+
try { payload = JSON.parse(text); } catch (error) { return text.slice(0, 300); }
|
|
38
|
+
}
|
|
39
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) return "";
|
|
40
|
+
const nestedError = payload.error && typeof payload.error === "object" ? payload.error : {};
|
|
41
|
+
const detail = payload.detail
|
|
42
|
+
|| payload.message
|
|
43
|
+
|| payload.error_description
|
|
44
|
+
|| nestedError.detail
|
|
45
|
+
|| nestedError.message
|
|
46
|
+
|| (typeof payload.error === "string" ? payload.error : "");
|
|
47
|
+
return String(detail || "").replace(/[\r\n\t]+/g, " ").trim().slice(0, 300);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function createSnapshotError({ camera, response, retriedWithStandardQuality }) {
|
|
51
|
+
const statusCode = Number(response && response.statusCode) || 0;
|
|
52
|
+
const detail = extractProtectErrorDetail(response);
|
|
53
|
+
const cameraState = String(camera && camera.raw && camera.raw.state || camera && camera.state || "")
|
|
54
|
+
.trim()
|
|
55
|
+
.toUpperCase();
|
|
56
|
+
const isOffline = /\boffline\b/i.test(detail)
|
|
57
|
+
|| (statusCode === 503 && cameraState === "DISCONNECTED");
|
|
58
|
+
let message;
|
|
59
|
+
if (isOffline) {
|
|
60
|
+
const stateDetail = cameraState ? `; state: ${cameraState}` : "";
|
|
61
|
+
message = `UniFi Protect snapshot for '${camera.cameraName}' is unavailable because Protect reports that the camera is offline (HTTP ${statusCode || 503}${stateDetail}).`;
|
|
62
|
+
} else if (statusCode === 429) {
|
|
63
|
+
const retryAfter = response && response.headers && response.headers["retry-after"];
|
|
64
|
+
const retryDetail = retryAfter ? `; retry after ${retryAfter} second(s)` : "";
|
|
65
|
+
message = `UniFi Protect temporarily rate-limited the snapshot for '${camera.cameraName}' (HTTP 429${retryDetail}).`;
|
|
66
|
+
} else {
|
|
67
|
+
const apiDetail = detail ? `: ${detail}` : "";
|
|
68
|
+
const retryDetail = retriedWithStandardQuality ? " after one standard-quality retry" : "";
|
|
69
|
+
message = `UniFi Protect snapshot for '${camera.cameraName}' failed (HTTP ${statusCode || "unknown"}${apiDetail})${retryDetail}.`;
|
|
70
|
+
}
|
|
71
|
+
const error = new Error(message);
|
|
72
|
+
error.code = isOffline ? "UNIFI_PROTECT_CAMERA_OFFLINE" : statusCode === 429 ? "UNIFI_PROTECT_RATE_LIMITED" : "UNIFI_PROTECT_SNAPSHOT_FAILED";
|
|
73
|
+
error.statusCode = statusCode;
|
|
74
|
+
error.cameraState = cameraState;
|
|
75
|
+
return error;
|
|
76
|
+
}
|
|
20
77
|
|
|
21
78
|
module.exports = function(RED) {
|
|
79
|
+
const knxAiCameraRegistry = getKnxAiCameraRegistry();
|
|
80
|
+
knxAiCameraRegistry.registerAdapter({
|
|
81
|
+
id: "unifi-ultimate",
|
|
82
|
+
title: "UniFi Ultimate / Protect",
|
|
83
|
+
packageName: "node-red-contrib-unifi-ultimate",
|
|
84
|
+
capabilities: ["camera_catalog", "snapshot", "motion", "smart_events", "zones", "lines"]
|
|
85
|
+
});
|
|
86
|
+
|
|
22
87
|
function UnifiProtectConfigNode(config) {
|
|
23
88
|
RED.nodes.createNode(this, config);
|
|
24
89
|
|
|
@@ -35,6 +100,8 @@ module.exports = function(RED) {
|
|
|
35
100
|
node.wsEvents = null;
|
|
36
101
|
node.reconnectTimer = null;
|
|
37
102
|
node.isClosing = false;
|
|
103
|
+
node.knxAiCameraCache = { at: 0, cameras: [] };
|
|
104
|
+
node.knxAiCameraListeners = new Set();
|
|
38
105
|
|
|
39
106
|
node.getApiKey = () => node.credentials && node.credentials.apiKey;
|
|
40
107
|
|
|
@@ -127,6 +194,20 @@ module.exports = function(RED) {
|
|
|
127
194
|
: [];
|
|
128
195
|
};
|
|
129
196
|
|
|
197
|
+
node.fetchArmProfiles = async () => {
|
|
198
|
+
const response = await node.apiRequest({
|
|
199
|
+
path: "/v1/arm-profiles",
|
|
200
|
+
method: "GET"
|
|
201
|
+
});
|
|
202
|
+
if (response.statusCode < 200 || response.statusCode >= 300) {
|
|
203
|
+
throw new Error(`Failed to load Protect arm profiles (${response.statusCode})`);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return Array.isArray(response.payload)
|
|
207
|
+
? response.payload
|
|
208
|
+
: [];
|
|
209
|
+
};
|
|
210
|
+
|
|
130
211
|
node.fetchCapabilityOptions = async (deviceType, deviceId, capabilityId, capabilityConfig) => {
|
|
131
212
|
const selectedDevice = deviceId
|
|
132
213
|
? await node.fetchDeviceByTypeAndId(deviceType, deviceId)
|
|
@@ -138,7 +219,8 @@ module.exports = function(RED) {
|
|
|
138
219
|
capabilityConfig,
|
|
139
220
|
fetchDevice: node.fetchDeviceByTypeAndId,
|
|
140
221
|
fetchDevices: node.fetchDevices,
|
|
141
|
-
fetchAssetFiles: node.fetchAssetFiles
|
|
222
|
+
fetchAssetFiles: node.fetchAssetFiles,
|
|
223
|
+
fetchArmProfiles: node.fetchArmProfiles
|
|
142
224
|
});
|
|
143
225
|
};
|
|
144
226
|
|
|
@@ -150,6 +232,118 @@ module.exports = function(RED) {
|
|
|
150
232
|
return getCapabilitiesForType(deviceType, selectedDevice);
|
|
151
233
|
};
|
|
152
234
|
|
|
235
|
+
node.listKnxAiCameras = async ({ force = false } = {}) => {
|
|
236
|
+
const now = Date.now();
|
|
237
|
+
if (!force && node.knxAiCameraCache.cameras.length > 0 && (now - node.knxAiCameraCache.at) < 30000) {
|
|
238
|
+
return node.knxAiCameraCache.cameras.slice();
|
|
239
|
+
}
|
|
240
|
+
const cameras = (await node.fetchDevices("camera")).map((camera) => {
|
|
241
|
+
const nativeCameraId = String(camera && camera.id || "").trim();
|
|
242
|
+
const cameraName = String(camera && (camera.name || camera.displayName) || nativeCameraId).trim();
|
|
243
|
+
const cameraState = String(camera && camera.state || "").trim().toUpperCase();
|
|
244
|
+
const objectTypes = Array.from(new Set([].concat(
|
|
245
|
+
camera && camera.smartDetectSettings && Array.isArray(camera.smartDetectSettings.objectTypes)
|
|
246
|
+
? camera.smartDetectSettings.objectTypes
|
|
247
|
+
: [],
|
|
248
|
+
camera && camera.featureFlags && Array.isArray(camera.featureFlags.smartDetectTypes)
|
|
249
|
+
? camera.featureFlags.smartDetectTypes
|
|
250
|
+
: []
|
|
251
|
+
).map((value) => String(value || "").trim()).filter(Boolean)));
|
|
252
|
+
return {
|
|
253
|
+
id: `${node.id}:${nativeCameraId}`,
|
|
254
|
+
cameraId: `${node.id}:${nativeCameraId}`,
|
|
255
|
+
nativeCameraId,
|
|
256
|
+
cameraName,
|
|
257
|
+
name: cameraName,
|
|
258
|
+
aliases: [cameraName, nativeCameraId].filter(Boolean),
|
|
259
|
+
controllerId: node.id,
|
|
260
|
+
controllerName: node.name || node.host || node.id,
|
|
261
|
+
adapterId: "unifi-ultimate",
|
|
262
|
+
adapterTitle: "UniFi Ultimate / Protect",
|
|
263
|
+
source: "unifi-ultimate",
|
|
264
|
+
state: cameraState,
|
|
265
|
+
online: cameraState ? cameraState === "CONNECTED" : null,
|
|
266
|
+
objectTypes,
|
|
267
|
+
lines: collectNamedScopes(camera, "line"),
|
|
268
|
+
zones: collectNamedScopes(camera, "zone"),
|
|
269
|
+
raw: camera
|
|
270
|
+
};
|
|
271
|
+
}).filter((camera) => camera.nativeCameraId);
|
|
272
|
+
node.knxAiCameraCache = { at: now, cameras };
|
|
273
|
+
return cameras.slice();
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
node.resolveKnxAiCamera = async ({ cameraId, cameraName } = {}) => {
|
|
277
|
+
const cameras = await node.listKnxAiCameras();
|
|
278
|
+
const requestedId = String(cameraId || "").trim();
|
|
279
|
+
const requestedName = normalizeSearchText(cameraName);
|
|
280
|
+
const exact = cameras.filter((camera) => {
|
|
281
|
+
return requestedId && [camera.id, camera.cameraId, camera.nativeCameraId].includes(requestedId)
|
|
282
|
+
|| requestedName && [camera.cameraName, camera.name].concat(camera.aliases || []).some((value) => normalizeSearchText(value) === requestedName);
|
|
283
|
+
});
|
|
284
|
+
if (exact.length === 1) return exact[0];
|
|
285
|
+
if (exact.length > 1) throw new Error("The camera name is ambiguous.");
|
|
286
|
+
const partial = requestedName ? cameras.filter((camera) => {
|
|
287
|
+
return [camera.cameraName, camera.name].concat(camera.aliases || []).some((value) => {
|
|
288
|
+
const candidate = normalizeSearchText(value);
|
|
289
|
+
return candidate && (candidate.includes(requestedName) || requestedName.includes(candidate));
|
|
290
|
+
});
|
|
291
|
+
}) : [];
|
|
292
|
+
if (partial.length === 1) return partial[0];
|
|
293
|
+
if (partial.length > 1) throw new Error("The camera name is ambiguous.");
|
|
294
|
+
throw new Error("Camera not found in this UniFi Protect controller.");
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
node.takeKnxAiCameraSnapshot = async ({ cameraId, cameraName, highQuality = false } = {}) => {
|
|
298
|
+
const camera = await node.resolveKnxAiCamera({ cameraId, cameraName });
|
|
299
|
+
const supportsHighQuality = camera.raw
|
|
300
|
+
&& camera.raw.featureFlags
|
|
301
|
+
&& camera.raw.featureFlags.supportFullHdSnapshot === true;
|
|
302
|
+
const requestHighQuality = highQuality === true && supportsHighQuality;
|
|
303
|
+
const requestSnapshot = (useHighQuality) => node.apiRequest({
|
|
304
|
+
path: `/v1/cameras/${encodeURIComponent(camera.nativeCameraId)}/snapshot`,
|
|
305
|
+
method: "GET",
|
|
306
|
+
// The Protect API defaults to standard quality. Do not send the
|
|
307
|
+
// highQuality flag unless this camera explicitly advertises it.
|
|
308
|
+
query: useHighQuality ? { highQuality: "true" } : {},
|
|
309
|
+
headers: { Accept: "image/jpeg" },
|
|
310
|
+
timeout: 20000
|
|
311
|
+
});
|
|
312
|
+
let response = await requestSnapshot(requestHighQuality);
|
|
313
|
+
const statusCode = Number(response && response.statusCode) || 0;
|
|
314
|
+
const firstErrorDetail = extractProtectErrorDetail(response);
|
|
315
|
+
const cameraState = String(camera && camera.raw && camera.raw.state || "").trim().toUpperCase();
|
|
316
|
+
const cameraIsOffline = /\boffline\b/i.test(firstErrorDetail)
|
|
317
|
+
|| (statusCode === 503 && cameraState === "DISCONNECTED");
|
|
318
|
+
const shouldRetryStandard = !cameraIsOffline && (requestHighQuality
|
|
319
|
+
? [400, 409, 422, 500, 502, 503, 504].includes(statusCode)
|
|
320
|
+
: [502, 503, 504].includes(statusCode));
|
|
321
|
+
let retriedWithStandardQuality = false;
|
|
322
|
+
if (shouldRetryStandard) {
|
|
323
|
+
// Some Protect/camera combinations reject forced full-HD
|
|
324
|
+
// snapshots with 503 even though a normal snapshot is ready.
|
|
325
|
+
retriedWithStandardQuality = true;
|
|
326
|
+
response = await requestSnapshot(false);
|
|
327
|
+
}
|
|
328
|
+
if (response.statusCode < 200 || response.statusCode >= 300) {
|
|
329
|
+
throw createSnapshotError({ camera, response, retriedWithStandardQuality });
|
|
330
|
+
}
|
|
331
|
+
if (!Buffer.isBuffer(response.payload) || response.payload.length === 0) {
|
|
332
|
+
throw new Error("UniFi Protect returned an empty or invalid snapshot.");
|
|
333
|
+
}
|
|
334
|
+
const contentTypeHeader = response.headers && response.headers["content-type"];
|
|
335
|
+
const mediaType = String(Array.isArray(contentTypeHeader) ? contentTypeHeader[0] : contentTypeHeader || "image/jpeg")
|
|
336
|
+
.split(";")[0]
|
|
337
|
+
.trim()
|
|
338
|
+
.toLowerCase();
|
|
339
|
+
return {
|
|
340
|
+
data: response.payload,
|
|
341
|
+
mediaType,
|
|
342
|
+
camera,
|
|
343
|
+
statusCode: response.statusCode
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
|
|
153
347
|
node.buildWebSocketUrl = (path) => {
|
|
154
348
|
// Reuse the configured HTTPS base URL and only swap protocol for the
|
|
155
349
|
// matching websocket scheme.
|
|
@@ -328,9 +522,63 @@ module.exports = function(RED) {
|
|
|
328
522
|
}
|
|
329
523
|
};
|
|
330
524
|
|
|
525
|
+
const knxAiBridgeClient = {
|
|
526
|
+
id: `knx-ai-camera-adapter:${node.id}`,
|
|
527
|
+
handleProtectDeviceUpdate(update) {
|
|
528
|
+
const item = update && update.item;
|
|
529
|
+
if (item && item.modelKey === "camera") node.knxAiCameraCache = { at: 0, cameras: [] };
|
|
530
|
+
},
|
|
531
|
+
handleProtectEventUpdate(update) {
|
|
532
|
+
const item = update && update.item;
|
|
533
|
+
if (!item || item.modelKey !== "event" || node.knxAiCameraListeners.size === 0) return;
|
|
534
|
+
Promise.resolve(node.listKnxAiCameras()).then((cameras) => {
|
|
535
|
+
const camera = cameras.find((entry) => entry.nativeCameraId === String(item.device || ""));
|
|
536
|
+
const event = normalizeProtectCameraEvent({
|
|
537
|
+
event: item,
|
|
538
|
+
camera: camera && camera.raw,
|
|
539
|
+
controllerId: node.id,
|
|
540
|
+
controllerName: node.name || node.host || node.id
|
|
541
|
+
});
|
|
542
|
+
if (!event) return;
|
|
543
|
+
node.knxAiCameraListeners.forEach((listener) => {
|
|
544
|
+
try { listener(event); } catch (error) { }
|
|
545
|
+
});
|
|
546
|
+
}).catch((error) => {
|
|
547
|
+
node.warn(`KNX AI camera event adapter failed: ${error && error.message ? error.message : error}`);
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
const knxAiProvider = {
|
|
553
|
+
id: `unifi-ultimate:${node.id}`,
|
|
554
|
+
adapterId: "unifi-ultimate",
|
|
555
|
+
title: "UniFi Ultimate / Protect",
|
|
556
|
+
packageName: "node-red-contrib-unifi-ultimate",
|
|
557
|
+
controllerId: node.id,
|
|
558
|
+
controllerName: node.name || node.host || node.id,
|
|
559
|
+
capabilities: ["camera_catalog", "snapshot", "motion", "smart_events", "zones", "lines"],
|
|
560
|
+
listCameras: (options) => node.listKnxAiCameras(options),
|
|
561
|
+
takeSnapshot: (request) => node.takeKnxAiCameraSnapshot(request),
|
|
562
|
+
subscribe(listener) {
|
|
563
|
+
if (typeof listener !== "function") return () => { };
|
|
564
|
+
const wasEmpty = node.knxAiCameraListeners.size === 0;
|
|
565
|
+
node.knxAiCameraListeners.add(listener);
|
|
566
|
+
if (wasEmpty) node.addClient(knxAiBridgeClient);
|
|
567
|
+
return () => {
|
|
568
|
+
node.knxAiCameraListeners.delete(listener);
|
|
569
|
+
if (node.knxAiCameraListeners.size === 0) node.removeClient(knxAiBridgeClient);
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
node.knxAiCameraProvider = knxAiProvider;
|
|
574
|
+
knxAiCameraRegistry.registerProvider(knxAiProvider);
|
|
575
|
+
|
|
331
576
|
node.on("close", function(done) {
|
|
332
577
|
try {
|
|
333
578
|
node.isClosing = true;
|
|
579
|
+
knxAiCameraRegistry.unregisterProvider(knxAiProvider.id);
|
|
580
|
+
node.knxAiCameraListeners.clear();
|
|
581
|
+
node.removeClient(knxAiBridgeClient);
|
|
334
582
|
node.closeWebSockets();
|
|
335
583
|
} catch (error) {
|
|
336
584
|
} finally {
|
|
@@ -1163,9 +1163,10 @@
|
|
|
1163
1163
|
<p><b>Control</b> chooses the Protect device category. <b>Device</b> chooses the specific item. Device selectors are searchable and open with the complete list before filtering. A saved selection that is temporarily unavailable is preserved instead of being cleared.</p>
|
|
1164
1164
|
<p><b>Action</b> only shows actions supported by the selected device.</p>
|
|
1165
1165
|
<p>Additional fields appear only when the selected action needs extra input. For example, events, PTZ presets, live views, or discovered properties.</p>
|
|
1166
|
-
<p>Action highlights: <code>Receive Events</code>, <code>Read Device State</code>, <code>Take Snapshot</code>, <code>Show Doorbell Message</code>, siren play/stop/test, relay output control, speaker sound test, and
|
|
1166
|
+
<p>Action highlights: <code>Receive Events</code>, <code>Read Device State</code>, <code>Take Snapshot</code>, <code>Show Doorbell Message</code>, siren play/stop/test, relay output control, speaker sound test, and application/alarm actions on <code>NVR</code>.</p>
|
|
1167
1167
|
<p>Protect resources include cameras, sensors, lights, chimes, viewers, live views, NVRs, bridges, Link Stations, alarm hubs, key fobs, relays, sirens, and speakers. The newer device families expose read state and events without the generic raw-update action.</p>
|
|
1168
1168
|
<p><code>Play Siren</code> uses a duration in seconds. <code>Control Relay Output</code> requires an explicit output and on/off state; auto-off applies only when turning an output on. Sound-test actions use a configured volume and never read control values from the incoming message.</p>
|
|
1169
|
+
<p>Protect alarm arming is application-wide, so its actions are available under <code>NVR</code>, not on an individual Alarm Hub. Use <code>Read Arm Profiles</code>, <code>Select Arm Profile</code>, <code>Arm Alarm</code>, and <code>Disarm Alarm</code>. These endpoints require Protect's local Alarm Manager.</p>
|
|
1169
1170
|
<p><code>Receive Events</code> performs an initial fetch and then subscribes to streams managed by the shared Protect config node. The config node keeps websocket channels and forwards matching updates to runtime nodes. In this mode, the input pin is hidden and listening starts automatically after deploy/restart.</p>
|
|
1170
1171
|
<p>For <code>Sensor</code>, <code>Camera</code>, and <code>Light</code> observables, <code>All</code> emits every event for the selected device. Choosing a specific observable normalizes the main output to a derived value and keeps the original context in <code>msg.details.raw</code>. Event observables emit <code>true/false</code>; sensor metrics such as <code>Temperature</code>, <code>Humidity</code>, <code>Light Level</code>, and <code>Battery Level</code> emit numeric values.</p>
|
|
1171
1172
|
<p><b>Emit periodically</b> repeats read-only actions at the selected interval and sends each result to the flow. It is hidden for <code>Receive Events</code> and write actions.</p>
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const KNX_AI_CAMERA_REGISTRY_KEY = Symbol.for("node-red.knx-ai.camera-adapters.v1");
|
|
4
|
+
const SMART_CAMERA_EVENTS = new Set([
|
|
5
|
+
"motion",
|
|
6
|
+
"ring",
|
|
7
|
+
"smartAudioDetect",
|
|
8
|
+
"smartDetectZone",
|
|
9
|
+
"smartDetectLine",
|
|
10
|
+
"smartDetectLoiterZone"
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
function normalizeText(value, maxLength = 240) {
|
|
14
|
+
return String(value === undefined || value === null ? "" : value).trim().slice(0, maxLength);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function normalizeSearchText(value) {
|
|
18
|
+
return normalizeText(value, 300)
|
|
19
|
+
.normalize("NFKD")
|
|
20
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.replace(/[^a-z0-9]+/g, " ")
|
|
23
|
+
.trim();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// This is the vendor-neutral KNX AI camera adapter contract. Keep this registry
|
|
27
|
+
// shape aligned with KNX Ultimate: an adapter describes package capabilities,
|
|
28
|
+
// while each configured controller registers a provider implementing
|
|
29
|
+
// listCameras(), takeSnapshot(), and subscribe(). The shared Symbol avoids any
|
|
30
|
+
// direct package dependency or flow wiring.
|
|
31
|
+
function getKnxAiCameraRegistry() {
|
|
32
|
+
const existing = globalThis[KNX_AI_CAMERA_REGISTRY_KEY];
|
|
33
|
+
if (existing && existing.version === 1 && existing.adapters instanceof Map && existing.providers instanceof Map) {
|
|
34
|
+
return existing;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const registry = {
|
|
38
|
+
version: 1,
|
|
39
|
+
adapters: new Map(),
|
|
40
|
+
providers: new Map(),
|
|
41
|
+
listeners: new Set(),
|
|
42
|
+
registerAdapter(adapter) {
|
|
43
|
+
if (!adapter || !adapter.id) return;
|
|
44
|
+
this.adapters.set(String(adapter.id), Object.freeze({ ...adapter }));
|
|
45
|
+
this.listeners.forEach((listener) => {
|
|
46
|
+
try { listener({ type: "adapter_registered", adapter: this.adapters.get(String(adapter.id)) }); } catch (error) { }
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
registerProvider(provider) {
|
|
50
|
+
if (!provider || !provider.id) return;
|
|
51
|
+
this.providers.set(String(provider.id), provider);
|
|
52
|
+
this.listeners.forEach((listener) => {
|
|
53
|
+
try { listener({ type: "provider_registered", provider }); } catch (error) { }
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
unregisterProvider(providerId) {
|
|
57
|
+
const id = String(providerId || "");
|
|
58
|
+
const provider = this.providers.get(id);
|
|
59
|
+
if (!provider) return;
|
|
60
|
+
this.providers.delete(id);
|
|
61
|
+
this.listeners.forEach((listener) => {
|
|
62
|
+
try { listener({ type: "provider_unregistered", provider }); } catch (error) { }
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
subscribe(listener) {
|
|
66
|
+
if (typeof listener !== "function") return () => { };
|
|
67
|
+
this.listeners.add(listener);
|
|
68
|
+
return () => this.listeners.delete(listener);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
globalThis[KNX_AI_CAMERA_REGISTRY_KEY] = registry;
|
|
72
|
+
return registry;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function collectNamedScopes(camera, scopeKind) {
|
|
76
|
+
if (!camera || typeof camera !== "object" || Array.isArray(camera)) return [];
|
|
77
|
+
const branchPattern = scopeKind === "line"
|
|
78
|
+
? /(line|lines|smart.?detect.?line)/i
|
|
79
|
+
: /(zone|zones|smart.?detect.?zone|loiter)/i;
|
|
80
|
+
const idKeys = scopeKind === "line"
|
|
81
|
+
? ["lineId", "lineID", "line_id", "id", "index"]
|
|
82
|
+
: ["zoneId", "zoneID", "zone_id", "id", "index"];
|
|
83
|
+
const byId = new Map();
|
|
84
|
+
const visited = new Set();
|
|
85
|
+
|
|
86
|
+
function firstValue(value, keys) {
|
|
87
|
+
for (const key of keys) {
|
|
88
|
+
if (value && value[key] !== undefined && value[key] !== null && String(value[key]).trim()) return value[key];
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function add(idValue, labelValue) {
|
|
94
|
+
const id = normalizeText(idValue, 160);
|
|
95
|
+
if (!id || byId.has(id)) return;
|
|
96
|
+
byId.set(id, {
|
|
97
|
+
id,
|
|
98
|
+
name: normalizeText(labelValue, 240) || `${scopeKind === "line" ? "Line" : "Zone"} ${id}`
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function collect(candidate) {
|
|
103
|
+
if (candidate === undefined || candidate === null) return;
|
|
104
|
+
if (typeof candidate === "string" || typeof candidate === "number") {
|
|
105
|
+
add(candidate, "");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(candidate)) {
|
|
109
|
+
candidate.forEach((entry) => {
|
|
110
|
+
if (entry && typeof entry === "object") {
|
|
111
|
+
add(firstValue(entry, idKeys), firstValue(entry, ["name", "displayName", "label", "title"]));
|
|
112
|
+
} else {
|
|
113
|
+
add(entry, "");
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (typeof candidate === "object") {
|
|
119
|
+
add(firstValue(candidate, idKeys), firstValue(candidate, ["name", "displayName", "label", "title"]));
|
|
120
|
+
Object.entries(candidate).forEach(([key, value]) => {
|
|
121
|
+
if (/^-?\d+$/.test(key)) {
|
|
122
|
+
add(key, value && typeof value === "object" ? firstValue(value, ["name", "displayName", "label", "title"]) : "");
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function walk(value, depth) {
|
|
129
|
+
if (!value || typeof value !== "object" || visited.has(value) || depth > 8) return;
|
|
130
|
+
visited.add(value);
|
|
131
|
+
Object.entries(value).forEach(([key, nested]) => {
|
|
132
|
+
if (branchPattern.test(key)) collect(nested);
|
|
133
|
+
walk(nested, depth + 1);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
walk(camera, 0);
|
|
138
|
+
return Array.from(byId.values()).sort((left, right) => left.name.localeCompare(right.name));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function collectEventScopeIds(event, scopeKind) {
|
|
142
|
+
if (!event || typeof event !== "object") return [];
|
|
143
|
+
const keyPattern = scopeKind === "line"
|
|
144
|
+
? /(lineIds?|smart.?detect.?lineIds?)/i
|
|
145
|
+
: /(zoneIds?|smart.?detect.?zoneIds?|loiterZoneIds?)/i;
|
|
146
|
+
const idKeys = scopeKind === "line"
|
|
147
|
+
? ["lineId", "lineID", "line_id", "id"]
|
|
148
|
+
: ["zoneId", "zoneID", "zone_id", "id"];
|
|
149
|
+
const ids = new Set();
|
|
150
|
+
const visited = new Set();
|
|
151
|
+
|
|
152
|
+
function add(value) {
|
|
153
|
+
const id = normalizeText(value, 160);
|
|
154
|
+
if (id) ids.add(id);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function collect(value) {
|
|
158
|
+
if (value === undefined || value === null) return;
|
|
159
|
+
if (typeof value === "string" || typeof value === "number") return add(value);
|
|
160
|
+
if (Array.isArray(value)) return value.forEach(collect);
|
|
161
|
+
if (typeof value === "object") {
|
|
162
|
+
for (const key of idKeys) {
|
|
163
|
+
if (value[key] !== undefined) add(value[key]);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function walk(value, depth) {
|
|
169
|
+
if (!value || typeof value !== "object" || visited.has(value) || depth > 8) return;
|
|
170
|
+
visited.add(value);
|
|
171
|
+
Object.entries(value).forEach(([key, nested]) => {
|
|
172
|
+
if (keyPattern.test(key)) collect(nested);
|
|
173
|
+
walk(nested, depth + 1);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
walk(event, 0);
|
|
178
|
+
return Array.from(ids);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function collectDetectedObjectTypes(event) {
|
|
182
|
+
const types = new Set();
|
|
183
|
+
const visited = new Set();
|
|
184
|
+
const keyPattern = /(smart.?detect.?types?|detection.?types?|object.?types?|detected.?objects?)/i;
|
|
185
|
+
|
|
186
|
+
function add(value) {
|
|
187
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
188
|
+
const normalized = normalizeSearchText(value);
|
|
189
|
+
if (normalized) types.add(normalized);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (Array.isArray(value)) value.forEach(add);
|
|
193
|
+
if (value && typeof value === "object") {
|
|
194
|
+
["type", "label", "name", "objectType"].forEach((key) => {
|
|
195
|
+
if (value[key] !== undefined) add(value[key]);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function walk(value, depth) {
|
|
201
|
+
if (!value || typeof value !== "object" || visited.has(value) || depth > 8) return;
|
|
202
|
+
visited.add(value);
|
|
203
|
+
Object.entries(value).forEach(([key, nested]) => {
|
|
204
|
+
if (keyPattern.test(key)) add(nested);
|
|
205
|
+
walk(nested, depth + 1);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
walk(event, 0);
|
|
210
|
+
return Array.from(types).slice(0, 12);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function normalizeProtectCameraEvent({ event, camera, controllerId, controllerName } = {}) {
|
|
214
|
+
if (!event || typeof event !== "object" || event.modelKey !== "event") return null;
|
|
215
|
+
const eventType = normalizeText(event.type, 80);
|
|
216
|
+
const nativeCameraId = normalizeText(event.device, 160);
|
|
217
|
+
if (!nativeCameraId || !SMART_CAMERA_EVENTS.has(eventType)) return null;
|
|
218
|
+
const scopeKind = eventType === "smartDetectLine" ? "line"
|
|
219
|
+
: ["smartDetectZone", "smartDetectLoiterZone"].includes(eventType) ? "zone" : "";
|
|
220
|
+
const scopeIds = scopeKind ? collectEventScopeIds(event, scopeKind) : [];
|
|
221
|
+
const knownScopes = scopeKind ? collectNamedScopes(camera, scopeKind) : [];
|
|
222
|
+
const scopeId = scopeIds[0] || "";
|
|
223
|
+
const scope = knownScopes.find((item) => item.id === scopeId);
|
|
224
|
+
const cameraName = normalizeText(camera && (camera.name || camera.displayName), 240) || nativeCameraId;
|
|
225
|
+
return {
|
|
226
|
+
source: "unifi-ultimate",
|
|
227
|
+
controllerId: normalizeText(controllerId, 160),
|
|
228
|
+
controllerName: normalizeText(controllerName, 240),
|
|
229
|
+
cameraId: `${normalizeText(controllerId, 160)}:${nativeCameraId}`,
|
|
230
|
+
nativeCameraId,
|
|
231
|
+
cameraName,
|
|
232
|
+
eventId: normalizeText(event.id, 160),
|
|
233
|
+
eventType,
|
|
234
|
+
active: event.end === null || event.end === undefined,
|
|
235
|
+
scopeId,
|
|
236
|
+
scopeName: scope ? scope.name : "",
|
|
237
|
+
scopeIds,
|
|
238
|
+
objectTypes: collectDetectedObjectTypes(event),
|
|
239
|
+
at: new Date(Number(event.start || event.timestamp || Date.now())).toISOString(),
|
|
240
|
+
raw: event
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
module.exports = {
|
|
245
|
+
KNX_AI_CAMERA_REGISTRY_KEY,
|
|
246
|
+
SMART_CAMERA_EVENTS,
|
|
247
|
+
collectDetectedObjectTypes,
|
|
248
|
+
collectEventScopeIds,
|
|
249
|
+
collectNamedScopes,
|
|
250
|
+
getKnxAiCameraRegistry,
|
|
251
|
+
normalizeProtectCameraEvent,
|
|
252
|
+
normalizeSearchText
|
|
253
|
+
};
|
|
@@ -358,7 +358,7 @@ const TYPE_CAPABILITIES = {
|
|
|
358
358
|
},
|
|
359
359
|
requestComposer: ({ capabilityConfig }) => ({
|
|
360
360
|
query: capabilityConfig.forceHighQuality
|
|
361
|
-
? {
|
|
361
|
+
? { highQuality: capabilityConfig.forceHighQuality }
|
|
362
362
|
: {}
|
|
363
363
|
})
|
|
364
364
|
},
|
|
@@ -567,6 +567,62 @@ const TYPE_CAPABILITIES = {
|
|
|
567
567
|
method: "GET",
|
|
568
568
|
path: "/v1/meta/info",
|
|
569
569
|
mode: "request"
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
id: "getArmProfiles",
|
|
573
|
+
label: "Read Arm Profiles",
|
|
574
|
+
description: "Fetch the arm profiles configured in Protect's local Alarm Manager.",
|
|
575
|
+
method: "GET",
|
|
576
|
+
path: "/v1/arm-profiles",
|
|
577
|
+
mode: "request"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
id: "setCurrentArmProfile",
|
|
581
|
+
label: "Select Arm Profile",
|
|
582
|
+
description: "Select the arm profile Protect will use the next time the alarm is armed.",
|
|
583
|
+
method: "PATCH",
|
|
584
|
+
path: "/v1/arm-profiles/settings",
|
|
585
|
+
mode: "request",
|
|
586
|
+
ignoreInputPayload: true,
|
|
587
|
+
useConfiguredPayload: true,
|
|
588
|
+
editor: {
|
|
589
|
+
fields: [
|
|
590
|
+
{
|
|
591
|
+
id: "armProfileId",
|
|
592
|
+
label: "Arm profile",
|
|
593
|
+
type: "select",
|
|
594
|
+
placeholder: "Select an arm profile"
|
|
595
|
+
}
|
|
596
|
+
]
|
|
597
|
+
},
|
|
598
|
+
requestComposer: ({ capabilityConfig }) => {
|
|
599
|
+
const armProfileId = String(capabilityConfig.armProfileId || "").trim();
|
|
600
|
+
if (!armProfileId) {
|
|
601
|
+
throw new Error("Select an arm profile before using this action.");
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return {
|
|
605
|
+
payload: { armProfileId }
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
id: "enableArmAlarm",
|
|
611
|
+
label: "Arm Alarm",
|
|
612
|
+
description: "Arm Protect using the currently selected arm profile.",
|
|
613
|
+
method: "POST",
|
|
614
|
+
path: "/v1/arm-profiles/enable",
|
|
615
|
+
mode: "request",
|
|
616
|
+
ignoreInputPayload: true
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
id: "disableArmAlarm",
|
|
620
|
+
label: "Disarm Alarm",
|
|
621
|
+
description: "Disarm Protect's local Alarm Manager.",
|
|
622
|
+
method: "POST",
|
|
623
|
+
path: "/v1/arm-profiles/disable",
|
|
624
|
+
mode: "request",
|
|
625
|
+
ignoreInputPayload: true
|
|
570
626
|
}
|
|
571
627
|
],
|
|
572
628
|
bridge: [],
|
|
@@ -907,6 +963,24 @@ async function getCapabilityOptions(deviceType, capabilityId, context) {
|
|
|
907
963
|
};
|
|
908
964
|
}
|
|
909
965
|
|
|
966
|
+
if (deviceType === "nvr" && capabilityId === "setCurrentArmProfile") {
|
|
967
|
+
const armProfiles = context && typeof context.fetchArmProfiles === "function"
|
|
968
|
+
? await context.fetchArmProfiles()
|
|
969
|
+
: [];
|
|
970
|
+
const currentArmProfileId = firstDefinedValue(context && context.device, [
|
|
971
|
+
"armMode.armProfileId"
|
|
972
|
+
]);
|
|
973
|
+
return {
|
|
974
|
+
capabilityId,
|
|
975
|
+
fields: [buildArmProfileField(
|
|
976
|
+
armProfiles,
|
|
977
|
+
capability.editor.fields[0],
|
|
978
|
+
context && context.capabilityConfig,
|
|
979
|
+
currentArmProfileId
|
|
980
|
+
)]
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
|
|
910
984
|
if (deviceType === "camera" && capabilityId === "setDoorbellMessage") {
|
|
911
985
|
return buildDoorbellMessageFields(context, capability);
|
|
912
986
|
}
|
|
@@ -1025,6 +1099,36 @@ function buildLiveviewOptions(liveviews, allowEmpty, emptyLabel) {
|
|
|
1025
1099
|
return options;
|
|
1026
1100
|
}
|
|
1027
1101
|
|
|
1102
|
+
function buildArmProfileField(armProfiles, baseField, capabilityConfig, currentArmProfileId) {
|
|
1103
|
+
const profiles = Array.isArray(armProfiles) ? armProfiles : [];
|
|
1104
|
+
const options = profiles.map((profile) => ({
|
|
1105
|
+
value: String(profile && profile.id ? profile.id : ""),
|
|
1106
|
+
label: String((profile && profile.name) || (profile && profile.id) || "Arm profile")
|
|
1107
|
+
})).filter((option) => option.value);
|
|
1108
|
+
const discoveredProfileCount = options.length;
|
|
1109
|
+
const configuredId = String(
|
|
1110
|
+
normalizeObject(capabilityConfig).armProfileId
|
|
1111
|
+
|| currentArmProfileId
|
|
1112
|
+
|| ""
|
|
1113
|
+
).trim();
|
|
1114
|
+
|
|
1115
|
+
if (configuredId && !options.some((option) => option.value === configuredId)) {
|
|
1116
|
+
options.push({
|
|
1117
|
+
value: configuredId,
|
|
1118
|
+
label: `${configuredId} (saved; currently unavailable)`
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
return {
|
|
1123
|
+
...baseField,
|
|
1124
|
+
options,
|
|
1125
|
+
defaultValue: configuredId,
|
|
1126
|
+
helpText: discoveredProfileCount > 0
|
|
1127
|
+
? "The selected profile is stored in Protect and will be used by Arm Alarm."
|
|
1128
|
+
: "No arm profiles were returned. Arm profiles require Protect's local Alarm Manager."
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1028
1132
|
function isCapabilitySupportedForDevice(deviceType, capability, device) {
|
|
1029
1133
|
// Protect exposes one broad family of camera APIs, but not every camera
|
|
1030
1134
|
// model supports every feature. Filter those actions in the editor.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-unifi-ultimate",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "Node-RED nodes for Ubiquiti UniFi integrations, including UniFi Protect, UniFi Access, and UniFi Network.",
|
|
5
5
|
"files": [
|
|
6
6
|
"nodes/",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
|
-
"test": "node --check nodes/unifi-access-config.js && node --check nodes/unifi-access-device.js && node --check nodes/unifi-network-config.js && node --check nodes/unifi-network-control-poe.js && node --check nodes/unifi-network-device.js && node --check nodes/unifi-network-presence.js && node --check nodes/unifi-network-restart.js && node --check nodes/unifi-protect-config.js && node --check nodes/unifi-protect-device.js && node --check nodes/utils/common-utils.js && node --check nodes/utils/http-response-utils.js && node --check nodes/utils/unifi-access-utils.js && node --check nodes/utils/unifi-access-device-registry.js && node --check nodes/utils/unifi-network-utils.js && node --check nodes/utils/unifi-network-device-registry.js && node --check nodes/utils/unifi-network-presence-utils.js && node --check nodes/utils/unifi-protect-utils.js && node --check nodes/utils/unifi-protect-field-metadata.js && node --check nodes/utils/unifi-protect-device-registry.js && node --check scripts/unifi-registry-discovery-common.js && node --check scripts/discover-unifi-network-registry.js && node --check scripts/discover-unifi-protect-registry.js && node --check scripts/discover-unifi-access-registry.js && jest",
|
|
69
|
+
"test": "node --check nodes/unifi-access-config.js && node --check nodes/unifi-access-device.js && node --check nodes/unifi-network-config.js && node --check nodes/unifi-network-control-poe.js && node --check nodes/unifi-network-device.js && node --check nodes/unifi-network-presence.js && node --check nodes/unifi-network-restart.js && node --check nodes/unifi-protect-config.js && node --check nodes/unifi-protect-device.js && node --check nodes/utils/common-utils.js && node --check nodes/utils/http-response-utils.js && node --check nodes/utils/unifi-access-utils.js && node --check nodes/utils/unifi-access-device-registry.js && node --check nodes/utils/unifi-network-utils.js && node --check nodes/utils/unifi-network-device-registry.js && node --check nodes/utils/unifi-network-presence-utils.js && node --check nodes/utils/unifi-protect-utils.js && node --check nodes/utils/unifi-protect-field-metadata.js && node --check nodes/utils/unifi-protect-device-registry.js && node --check nodes/utils/knx-ai-camera-registry.js && node --check scripts/unifi-registry-discovery-common.js && node --check scripts/discover-unifi-network-registry.js && node --check scripts/discover-unifi-protect-registry.js && node --check scripts/discover-unifi-access-registry.js && jest",
|
|
70
70
|
"registry:discover:network": "node scripts/discover-unifi-network-registry.js",
|
|
71
71
|
"registry:discover:protect": "node scripts/discover-unifi-protect-registry.js",
|
|
72
72
|
"registry:discover:access": "node scripts/discover-unifi-access-registry.js"
|
|
@@ -82,4 +82,4 @@
|
|
|
82
82
|
"bugs": {
|
|
83
83
|
"url": "https://github.com/Supergiovane/node-red-contrib-unifi-ultimate/issues"
|
|
84
84
|
}
|
|
85
|
-
}
|
|
85
|
+
}
|