Basler Vision Connector: MQTT JSON Test File#
Info
Before you start the sample script: Make sure that an MQTT broker is running and that the camera ID is correctly set in Device ID node. In case you are working inside the Siemens ecosystem, you can use the Siemens Databus app.
For further possible JSON commands, refer to the Messaging topics in this documentation.
[
{
"id": "1a1c52ed5c516f07",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "88fb8d51299d898e",
"type": "debug",
"z": "1a1c52ed5c516f07",
"name": "Debug",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 530,
"y": 420,
"wires": []
},
{
"id": "eea24ec26eb41243",
"type": "mqtt out",
"z": "1a1c52ed5c516f07",
"name": "",
"topic": "BaslerVisionConnector/app/request",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "af2b5f92f9d2931f",
"x": 660,
"y": 260,
"wires": []
},
{
"id": "b52768d05da44518",
"type": "mqtt in",
"z": "1a1c52ed5c516f07",
"name": "",
"topic": "BaslerVisionConnector/app/response",
"qos": "2",
"datatype": "auto-detect",
"broker": "af2b5f92f9d2931f",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 310,
"y": 420,
"wires": [
[
"88fb8d51299d898e"
]
]
},
{
"id": "94c7413dc00c7ecf",
"type": "inject",
"z": "1a1c52ed5c516f07",
"name": "OpenDevice",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Action\":\"OpenDevice\",\"DeviceID\":\"Device ID\"}",
"payloadType": "json",
"x": 150,
"y": 300,
"wires": [
[
"527d68acd5a796d1"
]
]
},
{
"id": "cb17797a4e7da17b",
"type": "inject",
"z": "1a1c52ed5c516f07",
"name": "CloseCamera",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Action\":\"CloseDevice\",\"DeviceID\":\"Device ID\"}",
"payloadType": "json",
"x": 150,
"y": 340,
"wires": [
[
"527d68acd5a796d1"
]
]
},
{
"id": "021aa5e6144af1d9",
"type": "inject",
"z": "1a1c52ed5c516f07",
"name": "EnumerateDevices",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Action\":\"EnumerateDevices\"}",
"payloadType": "json",
"x": 170,
"y": 260,
"wires": [
[
"eea24ec26eb41243"
]
]
},
{
"id": "ed0789241ca82af6",
"type": "inject",
"z": "1a1c52ed5c516f07",
"name": "GetStatus",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"Action\":\"GetStatus\"}",
"payloadType": "json",
"x": 140,
"y": 220,
"wires": [
[
"eea24ec26eb41243"
]
]
},
{
"id": "527d68acd5a796d1",
"type": "function",
"z": "1a1c52ed5c516f07",
"name": "Device ID",
"func": "let jsonMessage = msg.payload;\njsonMessage.DeviceID = \"40062774\";\n\nmsg.payload = jsonMessage;\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 420,
"y": 320,
"wires": [
[
"eea24ec26eb41243"
]
]
},
{
"id": "341ab7743445be83",
"type": "comment",
"z": "1a1c52ed5c516f07",
"name": "This example demonstrates how to use Basler Vision Conenctor using MQTT Nodes. \\n \\n Note: Before execution, ensure that the camera ID is correctly set in the Device ID node.\\n ",
"info": "",
"x": 360,
"y": 120,
"wires": []
},
{
"id": "af2b5f92f9d2931f",
"type": "mqtt-broker",
"name": "",
"broker": "ie-databus",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]