[ { "id": "0ddaa4b089a41228", "type": "tab", "label": "ИВЭ Modbus-Read", "disabled": false, "info": "", "env": [] }, { "id": "f1a1b1c1d1e1f1a1", "type": "tab", "label": "TRASSIR RTSP capture", "disabled": false, "info": "" }, { "id": "9e06d9ab05f02898", "type": "tab", "label": "Эксперименты", "disabled": false, "info": "", "env": [] }, { "id": "5da01c52b4b66842", "type": "modbus-client", "name": "modbus client", "clienttype": "simpleser", "bufferCommands": true, "stateLogEnabled": false, "queueLogEnabled": false, "failureLogEnabled": true, "tcpHost": "201.204.210.10", "tcpPort": 502, "tcpType": "DEFAULT", "serialPort": "COM3", "serialType": "RTU-BUFFERD", "serialBaudrate": "115200", "serialDatabits": 8, "serialStopbits": 1, "serialParity": "none", "serialConnectionDelay": 100, "serialAsciiResponseStartDelimiter": "0x3A", "unit_id": 1, "commandDelay": 1, "clientTimeout": 1000, "reconnectOnTimeout": true, "reconnectTimeout": 2000, "parallelUnitIdsAllowed": true, "showErrors": false, "showWarnings": true, "showLogs": true }, { "id": "f8c6b094974bfa97", "type": "serial-port", "d": true, "name": "", "serialport": "COM3", "serialbaud": "115200", "databits": 8, "parity": "none", "stopbits": 1, "waitfor": "", "dtr": "none", "rts": "none", "cts": "none", "dsr": "none", "newline": "1", "bin": "bin", "out": "count", "addchar": "", "responsetimeout": 10000 }, { "id": "a6152c5476ec5893", "type": "debug", "z": "0ddaa4b089a41228", "name": "debug 2", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 460, "y": 60, "wires": [] }, { "id": "98304439b5ebd360", "type": "http request", "z": "0ddaa4b089a41228", "d": true, "name": "", "method": "GET", "ret": "txt", "paytoqs": "ignore", "url": "https://drill.greact.online/ingest?id=data-edge5-modbus-v2", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 470, "y": 120, "wires": [ [] ] }, { "id": "926f26f899a87b35", "type": "inject", "z": "0ddaa4b089a41228", "d": true, "name": "", "props": [ { "p": "payload" } ], "repeat": "1", "crontab": "", "once": false, "onceDelay": "1", "topic": "", "payload": "[1,2,3,4]", "payloadType": "json", "x": 180, "y": 240, "wires": [ [ "d2d346d60a52fac5" ] ] }, { "id": "d2d346d60a52fac5", "type": "debug", "z": "0ddaa4b089a41228", "name": "debug 3", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 440, "y": 280, "wires": [] }, { "id": "2ea045ed18342d31", "type": "modbus-read", "z": "0ddaa4b089a41228", "name": "Modbus-Read", "topic": "", "showStatusActivities": false, "logIOActivities": false, "showErrors": false, "showWarnings": true, "unitid": "1", "dataType": "HoldingRegister", "adr": "0", "quantity": "125", "rate": "1000", "rateUnit": "ms", "delayOnStart": false, "enableDeformedMessages": false, "startDelayTime": "", "server": "5da01c52b4b66842", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "x": 210, "y": 100, "wires": [ [ "a6152c5476ec5893", "98304439b5ebd360" ], [] ] }, { "id": "a1", "type": "inject", "z": "f1a1b1c1d1e1f1a1", "name": "start stream", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 130, "y": 100, "wires": [ [ "a2" ] ] }, { "id": "a2", "type": "function", "z": "f1a1b1c1d1e1f1a1", "name": "prepare ffmpeg args", "func": "msg.payload = '-hide_banner -loglevel error -rtsp_transport tcp ' +\n '-i \"rtsp://127.0.0.1:8554/webcam\" ' +\n '-an -c copy -f mpegts pipe:1';\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 360, "y": 100, "wires": [ [ "a3" ] ] }, { "id": "a3", "type": "exec", "z": "f1a1b1c1d1e1f1a1", "command": "ffmpeg", "addpay": "payload", "append": "", "useSpawn": "true", "timer": "", "winHide": false, "oldrc": false, "name": "ffmpeg spawn", "x": 600, "y": 100, "wires": [ [ "a4", "a7" ], [], [] ] }, { "id": "a4", "type": "function", "z": "f1a1b1c1d1e1f1a1", "name": "chunk info", "func": "if (Buffer.isBuffer(msg.payload)) {\n msg.chunkLength = msg.payload.length;\n msg.payload = {\n chunkLength: msg.chunkLength,\n headHex: msg.payload.subarray(0, Math.min(32, msg.payload.length)).toString('hex')\n };\n}\nreturn msg;", "outputs": 1, "noerr": 0, "x": 890, "y": 80, "wires": [ [ "a8" ] ] }, { "id": "a7", "type": "delay", "z": "f1a1b1c1d1e1f1a1", "name": "sample 1/5 sec", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "5", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": true, "allowrate": false, "outputs": 1, "x": 860, "y": 160, "wires": [ [ "a9" ] ] }, { "id": "a8", "type": "debug", "z": "f1a1b1c1d1e1f1a1", "name": "stream chunk meta", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 1130, "y": 80, "wires": [] }, { "id": "a9", "type": "http request", "z": "f1a1b1c1d1e1f1a1", "d": true, "name": "send chunk to cloud", "method": "POST", "ret": "txt", "paytoqs": "ignore", "url": "https://YOUR-CLOUD-ENDPOINT.example/ingest?id=data-edge5-video-v1", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 1090, "y": 160, "wires": [ [ "b1" ] ] }, { "id": "b1", "type": "debug", "z": "f1a1b1c1d1e1f1a1", "name": "cloud response", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "x": 1300, "y": 160, "wires": [] }, { "id": "dfbb81298270d1d0", "type": "exec", "z": "f1a1b1c1d1e1f1a1", "command": "taskkill", "addpay": "payload", "append": "/T /F", "useSpawn": "false", "timer": "", "winHide": false, "oldrc": false, "name": "ffmpeg task kill", "x": 600, "y": 380, "wires": [ [], [], [] ] }, { "id": "7cd54e61e1944119", "type": "inject", "z": "f1a1b1c1d1e1f1a1", "name": "stop stream", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 130, "y": 380, "wires": [ [ "5e118756b72c6f1a" ] ] }, { "id": "718c866ef4aacbe3", "type": "function", "z": "f1a1b1c1d1e1f1a1", "name": "get process identifier", "func": "if (msg.status && msg.status.text) {\n const m = msg.status.text.match(/^pid:(\\d+)/);\n if (m) {\n flow.set(\"ffmpeg-pid\", Number(m[1]));\n }\n}\nreturn null;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 360, "y": 240, "wires": [ [] ] }, { "id": "5e118756b72c6f1a", "type": "function", "z": "f1a1b1c1d1e1f1a1", "name": "prepare task killer args", "func": "const pid = flow.get(\"ffmpeg-pid\");\nif (!pid) {\n node.warn(\"ffmpeg-pid not set, skip taskkill\");\n return null;\n}\nmsg.pid = pid;\nmsg.payload = `/PID ${pid}`;\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 360, "y": 380, "wires": [ [ "dfbb81298270d1d0" ] ] }, { "id": "048a38e744556fc1", "type": "status", "z": "f1a1b1c1d1e1f1a1", "name": "get stream status", "scope": [ "a3" ], "x": 120, "y": 240, "wires": [ [ "718c866ef4aacbe3" ] ] } ]