通过Node-RED规则引擎的方式接入OPC UA协议的设备示例
JSON代码:
[
{
"id": "9d9c38ec344e7735",
"type": "OpcUa-Item",
"z": "60f431051db97cc3",
"item": "ns=2;i=3",
"datatype": "Boolean",
"value": "",
"name": "onoff",
"x": 490,
"y": 700,
"wires": [
[
"80855848c6860989"
]
]
},
{
"id": "55f7470ff76dd8d2",
"type": "inject",
"z": "60f431051db97cc3",
"name": "Read",
"repeat": "",
"crontab": "",
"once": false,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 230,
"y": 700,
"wires": [
[
"9d9c38ec344e7735"
]
]
},
{
"id": "0f743757339e1cb1",
"type": "debug",
"z": "60f431051db97cc3",
"name": "Read value Payload",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1000,
"y": 740,
"wires": []
},
{
"id": "80855848c6860989",
"type": "OpcUa-Client",
"z": "60f431051db97cc3",
"endpoint": "0be9dfccb357d958",
"action": "read",
"deadbandvalue": "",
"time": "",
"localfile": "",
"localkeyfile": "",
"folderName4PKI": "",
"name": "Test server (read items)",
"x": 730,
"y": 740,
"wires": [
[
"0f743757339e1cb1"
]
]
},
{
"id": "85c49efb5789831c",
"type": "OpcUa-Item",
"z": "60f431051db97cc3",
"item": "ns=2;i=3",
"datatype": "Boolean",
"value": "",
"name": "onoff",
"x": 490,
"y": 820,
"wires": [
[
"37045a9e68e73b23"
]
]
},
{
"id": "1473279c8942b667",
"type": "inject",
"z": "60f431051db97cc3",
"name": "Subscribe",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "1000",
"payloadType": "num",
"x": 240,
"y": 820,
"wires": [
[
"85c49efb5789831c"
]
]
},
{
"id": "93697a8af02cbdfc",
"type": "debug",
"z": "60f431051db97cc3",
"name": "Subscribed values",
"active": true,
"console": "false",
"complete": "payload",
"x": 990,
"y": 840,
"wires": []
},
{
"id": "b440ec73f3751ad8",
"type": "inject",
"z": "60f431051db97cc3",
"name": "Read",
"repeat": "",
"crontab": "",
"once": false,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 230,
"y": 740,
"wires": [
[
"e973e6b515c2d9d0"
]
]
},
{
"id": "e973e6b515c2d9d0",
"type": "OpcUa-Item",
"z": "60f431051db97cc3",
"item": "ns=2;i=2",
"datatype": "Int64",
"value": "",
"name": "temperature",
"x": 510,
"y": 740,
"wires": [
[
"80855848c6860989"
]
]
},
{
"id": "37045a9e68e73b23",
"type": "OpcUa-Client",
"z": "60f431051db97cc3",
"endpoint": "0be9dfccb357d958",
"action": "subscribe",
"deadbandvalue": "",
"time": "5",
"timeUnit": "s",
"localfile": "",
"localkeyfile": "",
"folderName4PKI": "",
"name": "",
"x": 760,
"y": 840,
"wires": [
[
"93697a8af02cbdfc"
]
]
},
{
"id": "5a328ab00b90267b",
"type": "debug",
"z": "60f431051db97cc3",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 510,
"y": 1100,
"wires": []
},
{
"id": "15b3d1190375e4b8",
"type": "OpcUa-Item",
"z": "60f431051db97cc3",
"item": "ns=2;i=2",
"datatype": "Int64",
"value": "",
"name": "temperature",
"x": 510,
"y": 860,
"wires": [
[
"37045a9e68e73b23"
]
]
},
{
"id": "0b248b8c08466d93",
"type": "inject",
"z": "60f431051db97cc3",
"name": "Subscribe",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "1000",
"payloadType": "num",
"x": 240,
"y": 860,
"wires": [
[
"15b3d1190375e4b8"
]
]
},
{
"id": "2c8433d549408345",
"type": "catch",
"z": "60f431051db97cc3",
"name": "",
"scope": null,
"x": 260,
"y": 1100,
"wires": [
[
"5a328ab00b90267b"
]
]
},
{
"id": "651373996f9619a7",
"type": "OpcUa-Event",
"z": "60f431051db97cc3",
"root": "ns=2;i=7",
"activatecustomevent": false,
"eventtype": "i=2041",
"customeventtype": "",
"name": "All events from server",
"x": 540,
"y": 1020,
"wires": [
[
"11b30185331fbb23"
]
]
},
{
"id": "9736a6cd4b1cba92",
"type": "inject",
"z": "60f431051db97cc3",
"name": "Subscribe Events (250ms)",
"props": [
{
"p": "payload",
"v": "250",
"vt": "num"
},
{
"p": "topic",
"v": "",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"topic": "",
"payload": "250",
"payloadType": "num",
"x": 290,
"y": 1020,
"wires": [
[
"651373996f9619a7"
]
]
},
{
"id": "30cf281803169075",
"type": "debug",
"z": "60f431051db97cc3",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 1050,
"y": 1020,
"wires": []
},
{
"id": "11b30185331fbb23",
"type": "OpcUa-Client",
"z": "60f431051db97cc3",
"endpoint": "0be9dfccb357d958",
"action": "events",
"deadbandvalue": "",
"time": "10",
"timeUnit": "s",
"localfile": "",
"localkeyfile": "",
"folderName4PKI": "",
"name": "Events",
"x": 730,
"y": 1020,
"wires": [
[
"30cf281803169075"
]
]
},
{
"id": "0be9dfccb357d958",
"type": "OpcUa-Endpoint",
"endpoint": "opc.tcp://101.43.49.73:4840",
"secpol": "None",
"secmode": "None",
"none": true,
"login": false,
"usercert": false,
"usercertificate": "",
"userprivatekey": ""
}
]