Node-RED Sample Code for OPC UA Read/Write

[
    {
        "id": "f6f2187d.f17ca8",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "cc7fc0bedacc876f",
        "type": "OpcUa-Endpoint",
        "endpoint": "opc.tcp://192.168.0.2:4840",
        "secpol": "None",
        "secmode": "None",
        "login": false
    },
    {
        "id": "3cc11d24.ff01a2",
        "type": "comment",
        "z": "f6f2187d.f17ca8",
        "name": "WARNING: please check you have started this container with a volume that is mounted to /data\\n otherwise any flow changes are lost when you redeploy or upgrade the container\\n (e.g. upgrade to a more recent node-red docker image).\\n  If you are using named volumes you can ignore this warning.\\n Double click or see info side panel to learn how to start Node-RED in Docker to save your work",
        "info": "\nTo start docker with a bind mount volume (-v option), for example:\n\n```\ndocker run -it -p 1880:1880 -v /home/user/node_red_data:/data --name mynodered nodered/node-red\n```\n\nwhere `/home/user/node_red_data` is a directory on your host machine where you want to store your flows.\n\nIf you do not do this then you can experiment and redploy flows, but if you restart or upgrade the container the flows will be disconnected and lost. \n\nThey will still exist in a hidden data volume, which can be recovered using standard docker techniques, but that is much more complex than just starting with a named volume as described above.",
        "x": 350,
        "y": 80,
        "wires": []
    },
    {
        "id": "78b6032af6d1a7fc",
        "type": "inject",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 280,
        "wires": [
            [
                "5c96b661c8321bea",
                "614e3f076d86f84c",
                "9e733abab0e17327"
            ]
        ]
    },
    {
        "id": "e527da189e443f12",
        "type": "OpcUa-Client",
        "z": "f6f2187d.f17ca8",
        "endpoint": "cc7fc0bedacc876f",
        "action": "subscribe",
        "deadbandtype": "a",
        "deadbandvalue": 1,
        "time": "1",
        "timeUnit": "s",
        "certificate": "n",
        "localfile": "",
        "localkeyfile": "",
        "securitymode": "None",
        "securitypolicy": "None",
        "name": "",
        "x": 580,
        "y": 280,
        "wires": [
            [
                "c4f7e5c924d4f3e6"
            ]
        ]
    },
    {
        "id": "5c96b661c8321bea",
        "type": "OpcUa-Item",
        "z": "f6f2187d.f17ca8",
        "item": "ns=5;s=Arp.Plc.Eclr/MainInstance.InA",
        "datatype": "Boolean",
        "value": "",
        "name": "InA",
        "x": 350,
        "y": 280,
        "wires": [
            [
                "e527da189e443f12"
            ]
        ]
    },
    {
        "id": "c4f7e5c924d4f3e6",
        "type": "debug",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 790,
        "y": 280,
        "wires": []
    },
    {
        "id": "d40ff95514f3883b",
        "type": "comment",
        "z": "f6f2187d.f17ca8",
        "name": "Read OPC UA",
        "info": "",
        "x": 140,
        "y": 220,
        "wires": []
    },
    {
        "id": "614e3f076d86f84c",
        "type": "OpcUa-Item",
        "z": "f6f2187d.f17ca8",
        "item": "ns=5;s=Arp.Plc.Eclr/MainInstance.InB",
        "datatype": "Boolean",
        "value": "",
        "name": "InB",
        "x": 350,
        "y": 320,
        "wires": [
            [
                "e527da189e443f12"
            ]
        ]
    },
    {
        "id": "9e733abab0e17327",
        "type": "OpcUa-Item",
        "z": "f6f2187d.f17ca8",
        "item": "ns=5;s=Arp.Plc.Eclr/MainInstance.OutA",
        "datatype": "Boolean",
        "value": "",
        "name": "OutA",
        "x": 350,
        "y": 360,
        "wires": [
            [
                "e527da189e443f12"
            ]
        ]
    },
    {
        "id": "e6f80bde3322ec5a",
        "type": "comment",
        "z": "f6f2187d.f17ca8",
        "name": "Write OPC UA",
        "info": "",
        "x": 130,
        "y": 400,
        "wires": []
    },
    {
        "id": "aba8518a09229b69",
        "type": "OpcUa-Client",
        "z": "f6f2187d.f17ca8",
        "endpoint": "cc7fc0bedacc876f",
        "action": "write",
        "deadbandtype": "a",
        "deadbandvalue": 1,
        "time": 10,
        "timeUnit": "s",
        "certificate": "n",
        "localfile": "",
        "localkeyfile": "",
        "securitymode": "None",
        "securitypolicy": "None",
        "name": "",
        "x": 580,
        "y": 520,
        "wires": [
            [
                "d4d389011fa05bfc"
            ]
        ]
    },
    {
        "id": "594c5d4d8439ded4",
        "type": "OpcUa-Item",
        "z": "f6f2187d.f17ca8",
        "item": "ns=5;s=Arp.Plc.Eclr/MainInstance.InA",
        "datatype": "Boolean",
        "value": "",
        "name": "InA",
        "x": 350,
        "y": 460,
        "wires": [
            [
                "aba8518a09229b69"
            ]
        ]
    },
    {
        "id": "985d74da4a9cbfe2",
        "type": "OpcUa-Item",
        "z": "f6f2187d.f17ca8",
        "item": "ns=5;s=Arp.Plc.Eclr/MainInstance.InB",
        "datatype": "Boolean",
        "value": "",
        "name": "InB",
        "x": 350,
        "y": 580,
        "wires": [
            [
                "aba8518a09229b69"
            ]
        ]
    },
    {
        "id": "d4d389011fa05bfc",
        "type": "debug",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 790,
        "y": 520,
        "wires": []
    },
    {
        "id": "2b61b74e6edb533d",
        "type": "inject",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 150,
        "y": 460,
        "wires": [
            [
                "594c5d4d8439ded4"
            ]
        ]
    },
    {
        "id": "35a36c4bf11c36b6",
        "type": "inject",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "x": 150,
        "y": 500,
        "wires": [
            [
                "594c5d4d8439ded4"
            ]
        ]
    },
    {
        "id": "85c63da4057e7d0e",
        "type": "inject",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 150,
        "y": 560,
        "wires": [
            [
                "985d74da4a9cbfe2"
            ]
        ]
    },
    {
        "id": "36c7cdeb59c1b6d8",
        "type": "inject",
        "z": "f6f2187d.f17ca8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "x": 150,
        "y": 600,
        "wires": [
            [
                "985d74da4a9cbfe2"
            ]
        ]
    }
]