node-red-contrib-iiot-opcua - Test environment

Example test environment flow:

  • Server
  • ASO
  • CMD
  • Listener
  • Browser
  • Write
  • Response

you need the node-red-dashboard package

[
    {
        "id": "93c8c3de.9943a",
        "type": "tab",
        "label": "OPC UA IIoT"
    },
    {
        "id": "63234c56.bd8b24",
        "type": "OPCUA-IIoT-Write",
        "z": "93c8c3de.9943a",
        "connector": "9d538815.3bfc88",
        "name": "",
        "showStatusActivities": false,
        "showErrors": false,
        "x": 470,
        "y": 560,
        "wires": [
            [
                "e3808431.205618",
                "2bbbb903.c02ba6",
                "1291279f.0ebd48"
            ]
        ]
    },
    {
        "id": "31f5c0c0.eb7c2",
        "type": "OPCUA-IIoT-Inject",
        "z": "93c8c3de.9943a",
        "payload": "2",
        "payloadType": "num",
        "topic": "ns=4;s=TestReadWrite",
        "datatype": "Double",
        "repeat": "0.5",
        "crontab": "",
        "once": false,
        "name": "TestReadWrite",
        "x": 160,
        "y": 560,
        "wires": [
            [
                "7fa1872f.b01528"
            ]
        ]
    },
    {
        "id": "e3808431.205618",
        "type": "OPCUA-IIoT-Response",
        "z": "93c8c3de.9943a",
        "name": "",
        "showStatusActivities": false,
        "showErrors": false,
        "x": 620,
        "y": 600,
        "wires": [
            []
        ]
    },
    {
        "id": "2bbbb903.c02ba6",
        "type": "debug",
        "z": "93c8c3de.9943a",
        "name": "",
        "active": false,
        "console": "false",
        "complete": "true",
        "x": 610,
        "y": 560,
        "wires": []
    },
    {
        "id": "1291279f.0ebd48",
        "type": "debug",
        "z": "93c8c3de.9943a",
        "name": "",
        "active": false,
        "console": "false",
        "complete": "false",
        "x": 630,
        "y": 520,
        "wires": []
    },
    {
        "id": "e5428ab0.d8dda8",
        "type": "OPCUA-IIoT-Browser",
        "z": "93c8c3de.9943a",
        "connector": "9d538815.3bfc88",
        "nodeId": "",
        "name": "",
        "showStatusActivities": false,
        "showErrors": false,
        "x": 440,
        "y": 360,
        "wires": [
            [
                "96ae60bb.e85f2",
                "d7c7ca0f.be5968"
            ]
        ]
    },
    {
        "id": "96ae60bb.e85f2",
        "type": "ui_template",
        "z": "93c8c3de.9943a",
        "group": "61b85fdb.da419",
        "name": "",
        "order": 1,
        "width": 0,
        "height": 0,
        "format": "<div layout=\"column\" layout-align=\"space-between\">\n    <div layout=\"row\" layout-align=\"space-around center\">\n        <div>{{msg.payload.endpoint}}</div>\n    </div>\n    <div layout=\"row\" layout-align=\"space-around center\">\n        <div>{{msg.payload.browseTopic}} with {{msg.payload.browserResultCount}} references</div>\n    </div>\n    <div layout=\"row\" layout-align=\"space-between center\">\n        <h1>Results</h1>\n    </div>\n    <div layout=\"row\" layout-align=\"space-between center\">\n        <select ng-model=\"item\" ng-options=\"item.displayName.text for item in msg.payload.browserItems\">\n            <option value=\"\">-- Root --</option>\n        </select>\n        <button ng-click=\"send({payload: {actiontype: 'browse', root: item}})\">Browse</button>\n    </div>\n    <div layout=\"row\" layout-align=\"space-between center\" style=\"margin: 0 auto;heigth:auto\">\n        <div layout-align=\"space-between\">\n        <ul ng-repeat=\"item in msg.payload.browserItems\">\n            <li>{{item.displayName.text}} ( {{item.nodeId}} - {{item.browseName}} )</li>\n        </ul>\n        </div>\n    </div>\n</div>",
        "storeOutMessages": false,
        "fwdInMessages": false,
        "x": 440,
        "y": 300,
        "wires": [
            [
                "e5428ab0.d8dda8"
            ]
        ]
    },
    {
        "id": "d7c7ca0f.be5968",
        "type": "debug",
        "z": "93c8c3de.9943a",
        "name": "",
        "active": false,
        "console": "false",
        "complete": "false",
        "x": 630,
        "y": 360,
        "wires": []
    },
    {
        "id": "bde7b0fe.02cc9",
        "type": "OPCUA-IIoT-Inject",
        "z": "93c8c3de.9943a",
        "payload": "",
        "payloadType": "date",
        "topic": "ns=0;i=85",
        "datatype": "NodeId",
        "repeat": "",
        "crontab": "",
        "once": true,
        "name": "Root",
        "x": 110,
        "y": 360,
        "wires": [
            [
                "14c75c26.d1bcf4"
            ]
        ]
    },
    {
        "id": "6bd8c1ed.62ec4",
        "type": "OPCUA-IIoT-Server",
        "z": "93c8c3de.9943a",
        "port": "55388",
        "endpoint": "",
        "acceptExternalCommands": true,
        "maxAllowedSessionNumber": "",
        "maxConnectionsPerEndpoint": "",
        "maxAllowedSubscriptionNumber": "",
        "alternateHostname": "",
        "name": "",
        "showStatusActivities": false,
        "showErrors": false,
        "allowAnonymous": true,
        "users": [
            {
                "name": "bianco",
                "password": "royal"
            },
            {
                "name": "klaus",
                "password": "test"
            }
        ],
        "x": 690,
        "y": 100,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "f9021590.7d7b18",
        "type": "OPCUA-IIoT-Server-Command",
        "z": "93c8c3de.9943a",
        "commandtype": "restart",
        "nodeId": "",
        "name": "",
        "x": 440,
        "y": 200,
        "wires": [
            [
                "6bd8c1ed.62ec4"
            ]
        ]
    },
    {
        "id": "a6a813c7.59904",
        "type": "inject",
        "z": "93c8c3de.9943a",
        "name": "ASO",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": true,
        "x": 130,
        "y": 100,
        "wires": [
            [
                "ce88778a.d955e8"
            ]
        ]
    },
    {
        "id": "ce88778a.d955e8",
        "type": "delay",
        "z": "93c8c3de.9943a",
        "name": "",
        "pauseType": "delay",
        "timeout": "3",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 300,
        "y": 100,
        "wires": [
            [
                "22970ee8.cfe9c2"
            ]
        ]
    },
    {
        "id": "3f2ff40a.16d53c",
        "type": "ui_button",
        "z": "93c8c3de.9943a",
        "name": "",
        "group": "61b85fdb.da419",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Restart OPC UA Server",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "",
        "payloadType": "str",
        "topic": "",
        "x": 170,
        "y": 200,
        "wires": [
            [
                "f9021590.7d7b18"
            ]
        ]
    },
    {
        "id": "e745e507.62af88",
        "type": "OPCUA-IIoT-Listener",
        "z": "93c8c3de.9943a",
        "connector": "9d538815.3bfc88",
        "action": "subscribe",
        "queueSize": 10,
        "name": "",
        "showStatusActivities": false,
        "showErrors": false,
        "x": 440,
        "y": 480,
        "wires": [
            [
                "f7a42afd.ceed38",
                "1374eac7.f9dd85"
            ],
            []
        ]
    },
    {
        "id": "5fa17864.eddf28",
        "type": "OPCUA-IIoT-Inject",
        "z": "93c8c3de.9943a",
        "payload": "1",
        "payloadType": "num",
        "topic": "ns=4;s=TestReadWrite",
        "datatype": "Double",
        "repeat": "",
        "crontab": "",
        "once": false,
        "name": "TestReadWrite Sub",
        "x": 190,
        "y": 460,
        "wires": [
            [
                "e745e507.62af88"
            ]
        ]
    },
    {
        "id": "1374eac7.f9dd85",
        "type": "ui_gauge",
        "z": "93c8c3de.9943a",
        "name": "",
        "group": "61b85fdb.da419",
        "order": 5,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Gauge",
        "label": "units",
        "format": "{{value | number:2}}",
        "min": "-1000",
        "max": "80000",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 610,
        "y": 420,
        "wires": []
    },
    {
        "id": "84ecf208.1fce7",
        "type": "ui_button",
        "z": "93c8c3de.9943a",
        "name": "",
        "group": "61b85fdb.da419",
        "order": 6,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Subscribe/Unsubscribe",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "1",
        "payloadType": "str",
        "topic": "ns=4;s=TestReadWrite",
        "x": 210,
        "y": 500,
        "wires": [
            [
                "e745e507.62af88"
            ]
        ]
    },
    {
        "id": "f7a42afd.ceed38",
        "type": "debug",
        "z": "93c8c3de.9943a",
        "name": "",
        "active": false,
        "console": "false",
        "complete": "false",
        "x": 630,
        "y": 460,
        "wires": []
    },
    {
        "id": "22970ee8.cfe9c2",
        "type": "OPCUA-IIoT-Server-ASO",
        "z": "93c8c3de.9943a",
        "nodeId": "ns=5;s=TestFolder",
        "browsename": "TestFolder",
        "displayname": "Test Folder",
        "objecttype": "61",
        "datatype": "",
        "value": "",
        "referenceNodeId": "ns=0;i=85",
        "referencetype": "",
        "name": "",
        "x": 450,
        "y": 100,
        "wires": [
            [
                "6bd8c1ed.62ec4",
                "cdc1a2d8.b36f6"
            ]
        ]
    },
    {
        "id": "14c75c26.d1bcf4",
        "type": "delay",
        "z": "93c8c3de.9943a",
        "name": "",
        "pauseType": "delay",
        "timeout": "3",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 260,
        "y": 360,
        "wires": [
            [
                "e5428ab0.d8dda8"
            ]
        ]
    },
    {
        "id": "4cf3b5f0.8f965c",
        "type": "OPCUA-IIoT-Server-Command",
        "z": "93c8c3de.9943a",
        "commandtype": "deleteNode",
        "nodeId": "ns=5;s=TestFolder",
        "name": "",
        "x": 440,
        "y": 240,
        "wires": [
            [
                "6bd8c1ed.62ec4",
                "cdc1a2d8.b36f6"
            ]
        ]
    },
    {
        "id": "ad4db10c.62acc",
        "type": "ui_button",
        "z": "93c8c3de.9943a",
        "name": "",
        "group": "61b85fdb.da419",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Remove Test Folder",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "",
        "payloadType": "str",
        "topic": "ns=5;s=TestFolder",
        "x": 180,
        "y": 240,
        "wires": [
            [
                "4cf3b5f0.8f965c"
            ]
        ]
    },
    {
        "id": "cdc1a2d8.b36f6",
        "type": "function",
        "z": "93c8c3de.9943a",
        "name": "Rebrowse",
        "func": "msg.topic = 'ns=0;i=85'\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 860,
        "y": 360,
        "wires": [
            [
                "14c75c26.d1bcf4"
            ]
        ]
    },
    {
        "id": "eb8a7e68.87d71",
        "type": "ui_button",
        "z": "93c8c3de.9943a",
        "name": "",
        "group": "61b85fdb.da419",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Add Test Folder",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "",
        "payloadType": "str",
        "topic": "",
        "x": 280,
        "y": 60,
        "wires": [
            [
                "22970ee8.cfe9c2"
            ]
        ]
    },
    {
        "id": "7fa1872f.b01528",
        "type": "function",
        "z": "93c8c3de.9943a",
        "name": "Random",
        "func": "var min = 1000 * -1;\nmsg.payload = Math.random() * (80000 - min) + min;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 320,
        "y": 560,
        "wires": [
            [
                "63234c56.bd8b24"
            ]
        ]
    },
    {
        "id": "9d538815.3bfc88",
        "type": "OPCUA-IIoT-Connector",
        "z": "",
        "endpoint": "opc.tcp://localhost:55388/UA/NodeREDIIOTServer",
        "keepSessionAlive": true,
        "loginEnabled": false,
        "securityPolicy": "None",
        "securityMode": "NONE",
        "name": "Local Server",
        "showStatusActivities": false,
        "showErrors": false
    },
    {
        "id": "61b85fdb.da419",
        "type": "ui_group",
        "z": "",
        "name": "Default",
        "tab": "8c42476d.ae08e8",
        "disp": true,
        "width": "10"
    },
    {
        "id": "8c42476d.ae08e8",
        "type": "ui_tab",
        "z": "93c8c3de.9943a",
        "name": "Node-RED OPC UA IIoT",
        "icon": "dashboard"
    }
]
biancode

Flow Info

created 1 month ago

Node Types

Core
  • debug (x4)
  • delay (x2)
  • function (x2)
  • inject (x1)
Other
  • OPCUA-IIoT-Browser (x1)
  • OPCUA-IIoT-Connector (x1)
  • OPCUA-IIoT-Inject (x3)
  • OPCUA-IIoT-Listener (x1)
  • OPCUA-IIoT-Response (x1)
  • OPCUA-IIoT-Server (x1)
  • OPCUA-IIoT-Server-ASO (x1)
  • OPCUA-IIoT-Server-Command (x2)
  • OPCUA-IIoT-Write (x1)
  • tab (x1)
  • ui_button (x4)
  • ui_gauge (x1)
  • ui_group (x1)
  • ui_tab (x1)
  • ui_template (x1)

Tags

  • opcua
  • opc
  • ua
  • iot
  • iiot
  • information
  • model
  • rami4.0
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option