Node-RED Flow
Beachten Sie, dass das folgende Beispiel einen Kamera-MQTT-Broker mit der IP-Adresse 192.168.2.115
verwendet, dessen MQTT Client mit dem MQTT-Präfix und der Client-ID cameras/115/
konfiguriert ist. Bitte ersetzen Sie diese entsprechend Ihrer Konfiguration:
[
{
"id": "e38003f441ebe758",
"type": "tab",
"label": "Recording",
"disabled": false,
"info": "",
"env": []
},
{
"id": "8739c3f13d21f8c8",
"type": "mqtt out",
"z": "e38003f441ebe758",
"name": "task/video/rec/start",
"topic": "",
"qos": "1",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "8c9bd856c466f9b0",
"x": 350,
"y": 40,
"wires": []
},
{
"id": "6f2456fbbab22c65",
"type": "function",
"z": "e38003f441ebe758",
"name": "topic",
"func": "const command = 'task/video/rec/start';\nconst prefix = 'cameras/115/';\n\nmsg.topic = prefix + command;\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 190,
"y": 40,
"wires": [
[
"8739c3f13d21f8c8"
]
]
},
{
"id": "030ecf3a64bd5f6c",
"type": "mqtt out",
"z": "e38003f441ebe758",
"name": "task/video/rec/stop",
"topic": "",
"qos": "1",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "8c9bd856c466f9b0",
"x": 370,
"y": 100,
"wires": []
},
{
"id": "0f73a30e35c79b4f",
"type": "function",
"z": "e38003f441ebe758",
"name": "topic",
"func": "const command = 'task/video/rec/stop';\nconst prefix = 'cameras/115/';\n\nmsg.topic = prefix + command;\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 210,
"y": 100,
"wires": [
[
"030ecf3a64bd5f6c"
]
]
},
{
"id": "c4edc7fd9949a938",
"type": "ui_button",
"z": "e38003f441ebe758",
"name": "",
"group": "a0240f14e128be2a",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"label": "Stop Rec ",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "{\"val\":\"1\"}",
"payloadType": "json",
"topic": "payload",
"topicType": "msg",
"x": 80,
"y": 100,
"wires": [
[
"0f73a30e35c79b4f"
]
]
},
{
"id": "29faba26eada713d",
"type": "ui_button",
"z": "e38003f441ebe758",
"name": "",
"group": "09317789e191eb54",
"order": 0,
"width": 0,
"height": 0,
"passthru": false,
"label": "Rec ",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "{\"val\":\"15\"}",
"payloadType": "json",
"topic": "payload",
"topicType": "msg",
"x": 70,
"y": 40,
"wires": [
[
"6f2456fbbab22c65"
]
]
},
{
"id": "8c9bd856c466f9b0",
"type": "mqtt-broker",
"name": "",
"broker": "192.168.2.115",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "5",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "a0240f14e128be2a",
"type": "ui_group",
"name": "Stop Recording",
"tab": "8bc4b79cc7336533",
"order": 4,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "09317789e191eb54",
"type": "ui_group",
"name": "Trigger Recording",
"tab": "8bc4b79cc7336533",
"order": 2,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "8bc4b79cc7336533",
"type": "ui_tab",
"name": "Video Recording",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]