Skip to content

Instantly share code, notes, and snippets.

@mdauphin
Created November 13, 2023 10:24
Show Gist options
  • Save mdauphin/60e21447106eb6a61854f77238373508 to your computer and use it in GitHub Desktop.
Save mdauphin/60e21447106eb6a61854f77238373508 to your computer and use it in GitHub Desktop.
Node-RED deeptracking AI detection
[
{
"id": "2fbe43a0.aa5a5c",
"type": "tab",
"label": "NVR Alarm",
"disabled": false,
"info": ""
},
{
"id": "418f6f82.2d31a",
"type": "tcp in",
"z": "2fbe43a0.aa5a5c",
"name": "TCP Alarm Srv",
"server": "server",
"host": "",
"port": "10000",
"datamode": "stream",
"datatype": "buffer",
"newline": "",
"topic": "t",
"base64": false,
"x": 80,
"y": 80,
"wires": [
[
"a3fa3f49.857318",
"5a85d44b.35a36c"
]
]
},
{
"id": "a3fa3f49.857318",
"type": "function",
"z": "2fbe43a0.aa5a5c",
"name": "fmt msg",
"func": "//console.log(Object.keys(msg))\n// 20 first bytes are in binary unknown format\nreturn { 'payload' : msg.payload.slice(20).toString('ascii') }\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 260,
"y": 80,
"wires": [
[
"75a5d656.2de9f"
]
]
},
{
"id": "f544a3c0.1e20e8",
"type": "inject",
"z": "2fbe43a0.aa5a5c",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Address\":\"0x0F01A8C0\",\"Channel\":0,\"Descrip\":\"\",\"Event\":\"MotionDetect\",\"SerialID\":\"a685b3625b3c3537\",\"StartTime\":\"2023-01-13 16:06:58\",\"Status\":\"Start\",\"Type\":\"Alarm\",\"Url\":\"http://192.168.1.130:5000/ffmpeg/17\"}",
"payloadType": "str",
"x": 250,
"y": 120,
"wires": [
[
"75a5d656.2de9f"
]
]
},
{
"id": "75a5d656.2de9f",
"type": "json",
"z": "2fbe43a0.aa5a5c",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 430,
"y": 80,
"wires": [
[
"f0ba8f05.9cfda"
]
]
},
{
"id": "3fb62803.b79f18",
"type": "http request",
"z": "2fbe43a0.aa5a5c",
"name": "AI Check",
"method": "POST",
"ret": "obj",
"paytoqs": "ignore",
"url": "http://192.168.1.130:8090/analyze",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 1200,
"y": 80,
"wires": [
[
"f9cbc18e.3ed588",
"8194c378.6a9e98"
]
]
},
{
"id": "b1147a49.1ea92",
"type": "function",
"z": "2fbe43a0.aa5a5c",
"name": "Mgt Cmd",
"func": "if (msg.payload.content.startsWith(\"/camera\"))\n return { 'payload': \"manual\" }",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 300,
"y": 380,
"wires": [
[
"f8de5181.902098"
]
]
},
{
"id": "a6a0b134.011688",
"type": "function",
"z": "2fbe43a0.aa5a5c",
"name": "Send Image",
"func": "return {\n 'payload': {\n 'chatId': $TELEGRAM_CHAT_ID,\n 'type': 'photo',\n 'content': flow.get('picture'),\n 'caption': msg.payload.label + \" \" + msg.payload.Facteur,\n }\n};\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1530,
"y": 80,
"wires": [
[
"518e0611.398fe8"
]
]
},
{
"id": "518e0611.398fe8",
"type": "telegram sender",
"z": "2fbe43a0.aa5a5c",
"name": "TestBot",
"bot": "ba5f78f0.e12718",
"haserroroutput": true,
"outputs": 2,
"x": 900,
"y": 380,
"wires": [
[
"cbc30b40.6ffae"
],
[
"cbc30b40.6ffae"
]
]
},
{
"id": "f0715d43.45ed58",
"type": "telegram receiver",
"z": "2fbe43a0.aa5a5c",
"name": "",
"bot": "ba5f78f0.e12718",
"saveDataDir": "",
"filterCommands": false,
"x": 90,
"y": 380,
"wires": [
[
"b1147a49.1ea92",
"9b1cfefa.0f1c78"
],
[
"9b1cfefa.0f1c78"
]
]
},
{
"id": "9b1cfefa.0f1c78",
"type": "debug",
"z": "2fbe43a0.aa5a5c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 330,
"y": 420,
"wires": []
},
{
"id": "8194c378.6a9e98",
"type": "switch",
"z": "2fbe43a0.aa5a5c",
"name": "",
"property": "payload.label",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "num"
},
{
"t": "eq",
"v": "0",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1350,
"y": 80,
"wires": [
[
"a6a0b134.011688"
],
[
"f9cbc18e.3ed588"
]
]
},
{
"id": "f8de5181.902098",
"type": "http request",
"z": "2fbe43a0.aa5a5c",
"name": "Snap",
"method": "GET",
"ret": "bin",
"paytoqs": "ignore",
"url": "http://192.168.1.130:5000/ffmpeg/17",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 430,
"y": 380,
"wires": [
[
"70bab314.962d44"
]
]
},
{
"id": "70bab314.962d44",
"type": "function",
"z": "2fbe43a0.aa5a5c",
"name": "Send Image",
"func": "return {\n 'payload': {\n 'chatId': $TELEGRAM_CHAT_ID,\n 'type': 'photo',\n 'content': msg.payload,\n 'caption': \"Camera #1\"\n }\n};\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 590,
"y": 380,
"wires": [
[
"518e0611.398fe8"
]
]
},
{
"id": "bb5d26cb.54ff6",
"type": "http in",
"z": "2fbe43a0.aa5a5c",
"name": "",
"url": "/telegram",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 440,
"y": 560,
"wires": [
[
"576e6d46.f7139c",
"2b0baed4.3be4c2"
]
]
},
{
"id": "2b0baed4.3be4c2",
"type": "function",
"z": "2fbe43a0.aa5a5c",
"name": "Send Message",
"func": "return {\n 'payload': {\n 'chatId': $TELEGRAM_CHAT_ID,\n 'type': 'message',\n 'content': \"Hello from NodeRED\",\n }\n};\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 707.2000122070312,
"y": 471.20001220703125,
"wires": [
[
"cbc30b40.6ffae",
"518e0611.398fe8"
]
]
},
{
"id": "576e6d46.f7139c",
"type": "http response",
"z": "2fbe43a0.aa5a5c",
"name": "",
"statusCode": "200",
"headers": {},
"x": 740,
"y": 580,
"wires": []
},
{
"id": "cbc30b40.6ffae",
"type": "debug",
"z": "2fbe43a0.aa5a5c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1190,
"y": 460,
"wires": []
},
{
"id": "c9b9b245.92785",
"type": "inject",
"z": "2fbe43a0.aa5a5c",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "msg",
"v": "Hello from NodeRED",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 440,
"y": 500,
"wires": [
[
"2b0baed4.3be4c2"
]
]
},
{
"id": "5a85d44b.35a36c",
"type": "debug",
"z": "2fbe43a0.aa5a5c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 270,
"y": 40,
"wires": []
},
{
"id": "f9cbc18e.3ed588",
"type": "debug",
"z": "2fbe43a0.aa5a5c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1570,
"y": 180,
"wires": []
},
{
"id": "452bf378.c3a544",
"type": "function",
"z": "2fbe43a0.aa5a5c",
"name": "store picture",
"func": "flow.set('picture', msg.payload)\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 1210,
"y": 40,
"wires": [
[
"f9cbc18e.3ed588"
]
]
},
{
"id": "f0ba8f05.9cfda",
"type": "switch",
"z": "2fbe43a0.aa5a5c",
"name": "MotionDetect",
"property": "payload.Event",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "MotionDetect",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 600,
"y": 80,
"wires": [
[
"d85f5965.f070d8"
]
]
},
{
"id": "d85f5965.f070d8",
"type": "switch",
"z": "2fbe43a0.aa5a5c",
"name": "Channel",
"property": "payload.Channel",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "0",
"vt": "num"
},
{
"t": "eq",
"v": "1",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 760,
"y": 80,
"wires": [
[
"38d43e88.f5ee42"
],
[
"3c80e239.f78d0e"
]
]
},
{
"id": "38d43e88.f5ee42",
"type": "change",
"z": "2fbe43a0.aa5a5c",
"name": "Url #0",
"rules": [
{
"t": "set",
"p": "payload.Url",
"pt": "msg",
"to": "http://192.168.1.130:5000/ffmpeg/17",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 910,
"y": 60,
"wires": [
[
"d392dbba.42737"
]
]
},
{
"id": "3c80e239.f78d0e",
"type": "change",
"z": "2fbe43a0.aa5a5c",
"name": "Url #1",
"rules": [
{
"t": "set",
"p": "payload.Url",
"pt": "msg",
"to": "http://192.168.1.130:5000/ffmpeg/16",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 910,
"y": 100,
"wires": [
[]
]
},
{
"id": "d392dbba.42737",
"type": "http request",
"z": "2fbe43a0.aa5a5c",
"name": "Snap",
"method": "GET",
"ret": "bin",
"paytoqs": "ignore",
"url": "{{{payload.Url}}}",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 1030,
"y": 80,
"wires": [
[
"3fb62803.b79f18",
"452bf378.c3a544"
]
]
},
{
"id": "cb1d4816.314948",
"type": "comment",
"z": "2fbe43a0.aa5a5c",
"name": "",
"info": "Camera #2 is disable",
"x": 1050,
"y": 140,
"wires": []
},
{
"id": "ba5f78f0.e12718",
"type": "telegram bot",
"botname": "$TELEGRAM_BOT_NAME",
"usernames": "",
"chatids": "",
"baseapiurl": "",
"updatemode": "polling",
"pollinterval": "300",
"usesocks": false,
"sockshost": "",
"socksport": "6667",
"socksusername": "anonymous",
"sockspassword": "",
"bothost": "",
"botpath": "",
"localbotport": "8443",
"publicbotport": "8443",
"privatekey": "",
"certificate": "",
"useselfsignedcertificate": false,
"sslterminated": false,
"verboselogging": true
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment