Skip to content

Commit 9740843

Browse files
V 1.1.0 (#74)
* evaluateNodeProperty no longer needed * Websocket Connection management * Add Line Crossing * Update SharedProtectWebSocket.ts * Update package.json * Remove GZIP Parsing (for now) and further socket fixes * Main fix for the crash of node-red due to unhandled exception. (#79) * fix: watchdog causing crashes in some cases * chore. bumped version to 1.1.0-beta.3 * fix: fixed the error handling of the Websocket * chore: added debug logging * Update package.json --------- Co-authored-by: Massimo Saccani <maxsupergiovane@icloud.com>
1 parent b1999eb commit 9740843

File tree

8 files changed

+7561
-147
lines changed

8 files changed

+7561
-147
lines changed

build/nodes/Protect.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
{ value: 'Package', label: 'Package Detected' },
7171
{ value: 'Person', label: 'Person Detected [Multiple]' },
7272
{ value: 'Vehicle', label: 'Vehicle Detected [Multiple]' },
73+
{ value: 'LineCross', label: 'Line Crossing Trigger' },
7374
]
7475
$('#node-input-eventIds').typedInput({
7576
type: 'events',

package-lock.json

Lines changed: 7294 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-contrib-unifi-os",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"description": "Nodes to access UniFi data using endpoints and websockets",
55
"main": "build/nodes/unifi.js",
66
"scripts": {
@@ -56,8 +56,9 @@
5656
"abortcontroller-polyfill": "^1.7.5",
5757
"axios": "^1.3.5",
5858
"cookie": "^0.5.0",
59-
"ws": "^8.13.0",
60-
"lodash": "^4.17.21"
59+
"ws": "8.18.0",
60+
"lodash": "^4.17.21",
61+
"async-mutex": "0.5.0"
6162
},
6263
"devDependencies": {
6364
"@types/lodash": "^4.14.192",

src/EventModels.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,33 @@ export type Metadata =
3535
export type UnifiEventModel = {
3636
shapeProfile: Record<string, unknown>
3737
startMetadata: Metadata
38-
endMetadata?: Metadata
38+
endMetadata?: Metadata
3939
}
4040

4141
const EventModels: UnifiEventModel[] = [
42+
{
43+
shapeProfile: {
44+
action: {
45+
action: 'add',
46+
modelKey: 'event',
47+
},
48+
payload: {
49+
type: 'smartDetectLine',
50+
},
51+
},
52+
startMetadata: {
53+
label: 'Line Crossing Trigger',
54+
hasMultiple: true,
55+
sendOnEnd: true,
56+
id: 'LineCross',
57+
thumbnailSupport: ThumbnailSupport.NONE,
58+
idLocation: CameraIDLocation.ACTION_RECORDID,
59+
},
60+
endMetadata: {
61+
valueExpression:
62+
'{"detectedTypes":_startData.payload.originalEventData.payload.smartDetectTypes,"linesStatus":payload.metadata.linesStatus,"lineSettings":payload.metadata.linesSettings}',
63+
},
64+
},
4265
{
4366
shapeProfile: {
4467
action: {
@@ -56,7 +79,6 @@ const EventModels: UnifiEventModel[] = [
5679
id: 'AudioDetection',
5780
thumbnailSupport: ThumbnailSupport.SINGLE_DELAYED,
5881
idLocation: CameraIDLocation.ACTION_RECORDID,
59-
6082
},
6183
endMetadata: {
6284
valueExpression: 'payload.smartDetectTypes',
@@ -113,7 +135,7 @@ const EventModels: UnifiEventModel[] = [
113135
id: 'MotionEvent',
114136
thumbnailSupport: ThumbnailSupport.START_WITH_DELAYED_END,
115137
idLocation: CameraIDLocation.PAYLOAD_CAMERA,
116-
}
138+
},
117139
},
118140
{
119141
shapeProfile: {
@@ -140,7 +162,6 @@ const EventModels: UnifiEventModel[] = [
140162
payload: {
141163
type: 'smartDetectZone',
142164
smartDetectTypes: ['package'],
143-
144165
},
145166
},
146167
startMetadata: {
@@ -159,7 +180,6 @@ const EventModels: UnifiEventModel[] = [
159180
payload: {
160181
type: 'smartDetectZone',
161182
smartDetectTypes: ['vehicle'],
162-
163183
},
164184
},
165185
startMetadata: {
@@ -178,7 +198,6 @@ const EventModels: UnifiEventModel[] = [
178198
payload: {
179199
type: 'smartDetectZone',
180200
smartDetectTypes: ['person'],
181-
182201
},
183202
},
184203
startMetadata: {
@@ -197,7 +216,6 @@ const EventModels: UnifiEventModel[] = [
197216
payload: {
198217
type: 'smartDetectZone',
199218
smartDetectTypes: ['animal'],
200-
201219
},
202220
},
203221
startMetadata: {
@@ -216,7 +234,6 @@ const EventModels: UnifiEventModel[] = [
216234
payload: {
217235
type: 'smartDetectZone',
218236
smartDetectTypes: ['licensePlate'],
219-
220237
},
221238
},
222239
startMetadata: {

0 commit comments

Comments
 (0)