Skip to content

Commit

Permalink
V 1.1.0 (#74)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
marcus-j-davies and Supergiovane authored Sep 14, 2024
1 parent b1999eb commit 9740843
Show file tree
Hide file tree
Showing 8 changed files with 7,561 additions and 147 deletions.
1 change: 1 addition & 0 deletions build/nodes/Protect.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
{ value: 'Package', label: 'Package Detected' },
{ value: 'Person', label: 'Person Detected [Multiple]' },
{ value: 'Vehicle', label: 'Vehicle Detected [Multiple]' },
{ value: 'LineCross', label: 'Line Crossing Trigger' },
]
$('#node-input-eventIds').typedInput({
type: 'events',
Expand Down
7,294 changes: 7,294 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-unifi-os",
"version": "1.0.1",
"version": "1.1.0",
"description": "Nodes to access UniFi data using endpoints and websockets",
"main": "build/nodes/unifi.js",
"scripts": {
Expand Down Expand Up @@ -56,8 +56,9 @@
"abortcontroller-polyfill": "^1.7.5",
"axios": "^1.3.5",
"cookie": "^0.5.0",
"ws": "^8.13.0",
"lodash": "^4.17.21"
"ws": "8.18.0",
"lodash": "^4.17.21",
"async-mutex": "0.5.0"
},
"devDependencies": {
"@types/lodash": "^4.14.192",
Expand Down
33 changes: 25 additions & 8 deletions src/EventModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,33 @@ export type Metadata =
export type UnifiEventModel = {
shapeProfile: Record<string, unknown>
startMetadata: Metadata
endMetadata?: Metadata
endMetadata?: Metadata
}

const EventModels: UnifiEventModel[] = [
{
shapeProfile: {
action: {
action: 'add',
modelKey: 'event',
},
payload: {
type: 'smartDetectLine',
},
},
startMetadata: {
label: 'Line Crossing Trigger',
hasMultiple: true,
sendOnEnd: true,
id: 'LineCross',
thumbnailSupport: ThumbnailSupport.NONE,
idLocation: CameraIDLocation.ACTION_RECORDID,
},
endMetadata: {
valueExpression:
'{"detectedTypes":_startData.payload.originalEventData.payload.smartDetectTypes,"linesStatus":payload.metadata.linesStatus,"lineSettings":payload.metadata.linesSettings}',
},
},
{
shapeProfile: {
action: {
Expand All @@ -56,7 +79,6 @@ const EventModels: UnifiEventModel[] = [
id: 'AudioDetection',
thumbnailSupport: ThumbnailSupport.SINGLE_DELAYED,
idLocation: CameraIDLocation.ACTION_RECORDID,

},
endMetadata: {
valueExpression: 'payload.smartDetectTypes',
Expand Down Expand Up @@ -113,7 +135,7 @@ const EventModels: UnifiEventModel[] = [
id: 'MotionEvent',
thumbnailSupport: ThumbnailSupport.START_WITH_DELAYED_END,
idLocation: CameraIDLocation.PAYLOAD_CAMERA,
}
},
},
{
shapeProfile: {
Expand All @@ -140,7 +162,6 @@ const EventModels: UnifiEventModel[] = [
payload: {
type: 'smartDetectZone',
smartDetectTypes: ['package'],

},
},
startMetadata: {
Expand All @@ -159,7 +180,6 @@ const EventModels: UnifiEventModel[] = [
payload: {
type: 'smartDetectZone',
smartDetectTypes: ['vehicle'],

},
},
startMetadata: {
Expand All @@ -178,7 +198,6 @@ const EventModels: UnifiEventModel[] = [
payload: {
type: 'smartDetectZone',
smartDetectTypes: ['person'],

},
},
startMetadata: {
Expand All @@ -197,7 +216,6 @@ const EventModels: UnifiEventModel[] = [
payload: {
type: 'smartDetectZone',
smartDetectTypes: ['animal'],

},
},
startMetadata: {
Expand All @@ -216,7 +234,6 @@ const EventModels: UnifiEventModel[] = [
payload: {
type: 'smartDetectZone',
smartDetectTypes: ['licensePlate'],

},
},
startMetadata: {
Expand Down
Loading

0 comments on commit 9740843

Please sign in to comment.