In the following flow,
I can subscribe OPC UA nodes without problem.
But I don't know how to unsubscribe them.
I have tried several methods, but anyone doesn't work.
Anyone can help out? Thank you very much.
[
{
"id": "062a6f6d48c1614e",
"type": "tab",
"label": "Flow 2",
"disabled": false,
"info": "",
"env": []
},
{
"id": "c46e9b8a7b164c0b",
"type": "junction",
"z": "062a6f6d48c1614e",
"x": 600,
"y": 320,
"wires": [
[
"a0926ffa3d78a02c"
]
]
},
{
"id": "5e08746194dfda16",
"type": "debug",
"z": "062a6f6d48c1614e",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1000,
"y": 140,
"wires": []
},
{
"id": "a0926ffa3d78a02c",
"type": "OpcUa-Client",
"z": "062a6f6d48c1614e",
"endpoint": "b19f60f1f161efad",
"action": "subscribe",
"deadbandtype": "a",
"deadbandvalue": 1,
"time": "2",
"timeUnit": "s",
"certificate": "n",
"localfile": "",
"localkeyfile": "",
"securitymode": "None",
"securitypolicy": "None",
"folderName4PKI": "",
"name": "OPC UA Client",
"x": 760,
"y": 140,
"wires": [
[
"5e08746194dfda16"
]
]
},
{
"id": "09cfc0df8496658c",
"type": "inject",
"z": "062a6f6d48c1614e",
"name": "Sub",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 210,
"y": 140,
"wires": [
[
"107dc37d2856d23a"
]
]
},
{
"id": "107dc37d2856d23a",
"type": "function",
"z": "062a6f6d48c1614e",
"name": "sub multi nodes",
"func": "msg.topic = \"multiple\";\nmsg.action = \"subscribe\";\nmsg.interval = 2000;\nmsg.payload = [];\nmsg.payload.push({ nodeId:\"ns=1;i=1447\",browseName:\"TankLevel\"});\nmsg.payload.push({ nodeId: \"ns=1;i=1431\", browseName: \"Pressure\"});\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 140,
"wires": [
[
"a0926ffa3d78a02c"
]
]
},
{
"id": "7af68e9315de13e5",
"type": "inject",
"z": "062a6f6d48c1614e",
"name": "Unsub",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 210,
"y": 240,
"wires": [
[
"edc77c3f7fb9f7f0"
]
]
},
{
"id": "edc77c3f7fb9f7f0",
"type": "function",
"z": "062a6f6d48c1614e",
"name": "unsub multi nodes",
"func": "msg.topic = \"multiple\";\nmsg.action = \"unsubscribe\";\nmsg.interval = 2000;\nmsg.payload = [];\nmsg.payload.push({ nodeId: \"ns=1;i=1447\", browseName: \"TankLevel\" });\nmsg.payload.push({ nodeId: \"ns=1;i=1431\", browseName: \"Pressure\" });\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 240,
"wires": [
[
"c46e9b8a7b164c0b"
]
]
},
{
"id": "3a61646a2570b95e",
"type": "inject",
"z": "062a6f6d48c1614e",
"name": "unsub ns=1;i=1447",
"props": [
{
"p": "topic",
"vt": "str"
},
{
"p": "action",
"v": "unsubscribe",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "ns=1;i=1447",
"x": 430,
"y": 360,
"wires": [
[
"c46e9b8a7b164c0b"
]
]
},
{
"id": "c578c12cc933218d",
"type": "inject",
"z": "062a6f6d48c1614e",
"name": "unsub ns=1;i=1431",
"props": [
{
"p": "topic",
"vt": "str"
},
{
"p": "action",
"v": "unsubscribe",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "ns=1;i=1431",
"x": 430,
"y": 400,
"wires": [
[
"c46e9b8a7b164c0b"
]
]
},
{
"id": "10e404d02eca90f8",
"type": "inject",
"z": "062a6f6d48c1614e",
"name": "Delete Subscrition",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "currentSession",
"payload": "{\"action\": \"deletesubscription\"}",
"payloadType": "json",
"x": 450,
"y": 60,
"wires": [
[
"a0926ffa3d78a02c"
]
]
},
{
"id": "b3d65d8a2834f321",
"type": "function",
"z": "062a6f6d48c1614e",
"name": "unsub multi nodes",
"func": "msg.topic = [{ nodeId: \"ns=1;i=1447\", browseName: \"TankLevel\" },{ nodeId: \"ns=1;i=1456\", browseName: \"LevelLowLimit\" }];\nmsg.action = \"unsubscribe\";\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 300,
"wires": [
[
"c46e9b8a7b164c0b"
]
]
},
{
"id": "ada6619ff9503459",
"type": "inject",
"z": "062a6f6d48c1614e",
"name": "Unsub",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 210,
"y": 300,
"wires": [
[
"b3d65d8a2834f321"
]
]
},
{
"id": "b19f60f1f161efad",
"type": "OpcUa-Endpoint",
"endpoint": "opc.tcp://opcuademo.sterfive.com:26543",
"secpol": "None",
"secmode": "None",
"none": true,
"login": false,
"usercert": false,
"usercertificate": "",
"userprivatekey": ""
}
]