Skip to content

Basler Vision Connector: MQTT JSON Test File#

This MQTT sample demonstrates how to use the Basler Vision Connector to open or close a camera by injecting JSON commands via the MQTT protocol.

Info

Before you start the sample script: Make sure that an MQTT broker is running. 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": "aca2f627a3aa075b",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "7a5e17791c231ebd",
        "type": "debug",
        "z": "aca2f627a3aa075b",
        "name": "debug",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1300,
        "y": 300,
        "wires": []
    },
    {
        "id": "42d5469df169d2ac",
        "type": "mqtt out",
        "z": "aca2f627a3aa075b",
        "name": "",
        "topic": "BaslerVisionConnector/request",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "af2b5f92f9d2931f",
        "x": 1350,
        "y": 180,
        "wires": []
    },
    {
        "id": "48e7658a19a56c4a",
        "type": "mqtt in",
        "z": "aca2f627a3aa075b",
        "name": "",
        "topic": "BaslerVisionConnector/response",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "af2b5f92f9d2931f",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 1050,
        "y": 300,
        "wires": [
            ["7a5e17791c231ebd"]
        ]
    },
    {
        "id": "873b918e3b4dc00b",
        "type": "inject",
        "z": "aca2f627a3aa075b",
        "name": "OpenDevice",
        "props": [
            {"p": "payload"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"TransactionID\":\"12\",\"Action\":\"OpenDevice\",\"DeviceID\":\"40215614\"}",
        "payloadType": "json",
        "x": 910,
        "y": 180,
        "wires": [
            ["42d5469df169d2ac"]
        ]
    },
    {
        "id": "55a5a887c0fd7118",
        "type": "inject",
        "z": "aca2f627a3aa075b",
        "name": "CloseCamera",
        "props": [
            {"p": "payload"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"TransactionID\":\"12\",\"Action\":\"CloseDevice\",\"DeviceID\":\"40215614\"}",
        "payloadType": "json",
        "x": 910,
        "y": 220,
        "wires": [
            ["42d5469df169d2ac"]
        ]
    },
    {
        "id": "3e85408ac285985d",
        "type": "inject",
        "z": "aca2f627a3aa075b",
        "name": "EnumerateDevices",
        "props": [
            {"p": "payload"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"TransactionID\":\"1\",\"Action\":\"EnumerateDevices\"}",
        "payloadType": "json",
        "x": 930,
        "y": 140,
        "wires": [
            ["42d5469df169d2ac"]
        ]
    },
    {
        "id": "10dcd01bc622b619",
        "type": "inject",
        "z": "aca2f627a3aa075b",
        "name": "GetStatus",
        "props": [
            {"p": "payload"}
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"TransactionID\":\"8\",\"Action\":\"GetStatus\"}",
        "payloadType": "json",
        "x": 900,
        "y": 100,
        "wires": [
            ["42d5469df169d2ac"]
        ]
    },
    {
        "id": "af2b5f92f9d2931f",
        "type": "mqtt-broker",
        "name": "",
        "broker": "ie-databus",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]