@vitormnm/node-red-simple-opcua 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/flows_simple_opc.json +1 -0
- package/package.json +8 -3
- package/client/lib/opcua-client-browser.js +0 -291
- package/client/lib/opcua-client-read-service.js +0 -16
- package/client/lib/opcua-client-subscription-id-service.js +0 -25
- package/client/lib/opcua-client-subscription-service.js +0 -171
- package/client/lib/opcua-client-write-service.js +0 -53
- package/client/opcua-client-config.html +0 -80
- package/client/opcua-client-config.js +0 -159
- package/client/opcua-client-utils.js +0 -320
- package/client/opcua-client.html +0 -1225
- package/client/opcua-client.js +0 -380
- package/object.json +0 -65
- package/server/lib/opcua-address-space-alarm.js +0 -341
- package/server/lib/opcua-address-space-builder.js +0 -1456
- package/server/lib/opcua-config.js +0 -546
- package/server/lib/opcua-constants.js +0 -109
- package/server/lib/opcua-server-events-child.js +0 -140
- package/server/lib/opcua-server-methods.js +0 -198
- package/server/lib/opcua-server-runtime-child.js +0 -729
- package/server/lib/opcua-server-runtime.js +0 -311
- package/server/lib/opcua-server-status-child.js +0 -188
- package/server/lib/server-node-utils.js +0 -16
- package/server/opcua-server-io.html +0 -347
- package/server/opcua-server-io.js +0 -463
- package/server/opcua-server-registry.js +0 -270
- package/server/opcua-server.css +0 -265
- package/server/opcua-server.html +0 -1548
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"id":"8cfd21c364c2df03","type":"tab","label":"opcua server","disabled":false,"info":"","env":[]},{"id":"151212437222dae0","type":"tab","label":"opcua client","disabled":false,"info":"","env":[]},{"id":"7c4416993db757dd","type":"tab","label":"opcua client browse all tags","disabled":false,"info":"","env":[]},{"id":"2c50499b89653464","type":"group","z":"8cfd21c364c2df03","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["24d49fb4730ddb0e","c4be4c26dc82c1e0","aa98d508aa93d8a4","fc4adb1b41b878d1","cea374e6d3345ea4","23d02e0b9d8214c0","b89df44c1e418bb3","bab77d6d3da6a778","7fa5b7577fb457c9"],"x":74,"y":1179,"w":872,"h":222},{"id":"d0ee96529905f5f9","type":"group","z":"8cfd21c364c2df03","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["445f843e25c0a0d5","ac96540b903f3ba5","1dc6b0317f7865e5","640b4ac3bd6d7603","ef8956faa8f46c82","10098330bac46e38","ec7f4d67c496c5d1","0292e098827fb16e","94c8e2c954522cf9","5660f34e554bb6f5"],"x":74,"y":839,"w":902,"h":302},{"id":"60b19848ebbc5356","type":"group","z":"8cfd21c364c2df03","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["a49f5a89da5155bc","14b097a343c4f0df","1b598fc1781b29e1","ee5372a7e7a8edbd","b9d2a0cfd9e9b4ac"],"x":74,"y":479,"w":912,"h":142},{"id":"6052786fca1151e5","type":"group","z":"8cfd21c364c2df03","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["2539932222902ee0","3496dfa358242797","2c5bd58258277ca0","eebad7aed2185cda","7ba31a677445ec83","25e830d51c339c4e","2ac26da7c2c45837"],"x":64,"y":219,"w":812,"h":222},{"id":"b33901b7b12af86c","type":"group","z":"8cfd21c364c2df03","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["272ce77b614d8cc3","f5824dbc89d628fa","e84bb307d95e6a70"],"x":74,"y":659,"w":482,"h":142},{"id":"3ccc34feec0630dd","type":"group","z":"8cfd21c364c2df03","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["8a78dbc7de4c8cc9","72a79bc79b4cc0bb","ab84f0db1e246e82","e15d8d090c4d94a1"],"x":74,"y":39,"w":752,"h":142},{"id":"8ccd7a60c46f9762","type":"group","z":"151212437222dae0","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["8f829d3785d42f88","5b22ed56f0a54f73","ccf537fdb44b4318","e7fa2bb906fc87c6","a34ce9528509a2c9","f3f0115e9d6b6b7a","3da807b7d25b85a9","ce2f03338a7cf2f5","33be489edef189fb","f6b7ea864ee0abfb","49f11177029d14ec","e812bef55f237f13","81af739c946465e4","09825afc617c880f","3f191c29e1ff64d8"],"x":54,"y":19,"w":1052,"h":482},{"id":"66eeced42fde3a96","type":"group","z":"151212437222dae0","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["59def5e9e9b0d450","01fb75eb1f813561","18307b76be9fc4b8","9a0b96daf2932d2c","fe096aef2045d911","7585676656604416","b389c0b3ac04d24e","163f37291329348b","de736fbb70b3bed4","d3fc0790651831ba"],"x":54,"y":559,"w":792,"h":382},{"id":"5aa5f21d2362ae83","type":"group","z":"151212437222dae0","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["559d41bd53945bd5","748d5c965bafe12f","a0c7740ad5c228df","523deb9018b6ed8f","c7018fe1a57d52df","9022c388f2a0a7b4","931f4a35aad5bb36","c00210b53afb879f","79119ea93930df91","5d4533a3ba0f04e8","0f459071b408f013","1bd1baf1884a61f9","99978349bb284a24","ed4187aa4995ac37","d146a15bf3c1ef33","f42f94894ccf2130","8e3c2676e9261e83"],"x":54,"y":959,"w":1072,"h":442},{"id":"7d087d18c99ee40b","type":"group","z":"151212437222dae0","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["ec63f36201edeb79","0e0a2fafc6969bbe","b534f3ac9840bdbc","0d0e206efa537357"],"x":54,"y":1439,"w":702,"h":142},{"id":"964be834f8995b1f","type":"group","z":"7c4416993db757dd","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["15e6db0599d497f4","244f561362390d9b","a16b3ffac4577d7c","e15fbd6363db8dbf","264e04316ce1bd12","3c245643349610db","90cf455439e6ab19","bcf7a54f2db2b4d1","acf7ead8b3b60917","f567148921a5d156","2ff0239edb93715c","79ebb05980a75f4f","410af6a25e62ab73","98b977cfe3480521","f0a29574ae62147a","100264ab897a4b75","4a8db72f8adb2859"],"x":34,"y":99,"w":1572,"h":482},{"id":"e7ababb4a28f644f","type":"group","z":"151212437222dae0","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["b2d099b89f3514cd","38cb1e7a2e2937a7","e2cf88d7252bc0aa","cefc4b175cd724d0","4d17a07cc2dd4180","02dbd16c9b764114","34ade9caad375180","2434820a659402c4"],"x":54,"y":1639,"w":912,"h":242},{"id":"b09a1570957d3c44","type":"opcua-client-config","name":"","endpoint":"opc.tcp://localhost:5840/","securityPolicy":"None","securityMode":"None","authType":"anonymous"},{"id":"8a78dbc7de4c8cc9","type":"opc-ua-server","z":"8cfd21c364c2df03","g":"3ccc34feec0630dd","name":"","resourcePath":"/","serverName":"myServer1","allowAnonymous":true,"port":"5840","maxConnections":10,"securityPolicy":"None","securityMode":"None","namespaceUri":"urn:node-red:opc-ua-server","tree":"{\n \"objects\": [],\n \"folders\": [\n {\n \"name\": \"myServer1\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [\n {\n \"name\": \"folderMethod\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [],\n \"alarms\": [],\n \"methods\": [\n {\n \"name\": \"methodSum\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"inputs\": [\n {\n \"name\": \"var1\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n },\n {\n \"name\": \"var2\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"result\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n }\n ]\n },\n {\n \"name\": \"methodMultiplication\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"inputs\": [\n {\n \"name\": \"var1\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n },\n {\n \"name\": \"var2\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"result\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n }\n ]\n }\n ],\n \"objectsTypes\": []\n },\n {\n \"name\": \"folderAlarms\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [],\n \"alarms\": [\n {\n \"name\": \"levelAlarm1\",\n \"variableNodeId\": \"myServer1.variableLevelAlarm\",\n \"type\": \"levelAlarm\",\n \"enabled\": true,\n \"severity\": 500,\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"highHighLimit\": 90,\n \"highHighMessage\": \"High High alarm\",\n \"highLimit\": 80,\n \"highMessage\": \"High alarm\",\n \"lowLimit\": 20,\n \"lowMessage\": \"Low alarm\",\n \"lowLowLimit\": 10,\n \"lowLowMessage\": \"Low Low alarm\",\n \"normalStateValue\": 0,\n \"digitalMessage\": \"Digital alarm\"\n },\n {\n \"name\": \"digitalAlarm1\",\n \"variableNodeId\": \"myServer1.variableDigitalAlarm\",\n \"type\": \"digitalAlarm\",\n \"enabled\": true,\n \"severity\": 500,\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"highHighLimit\": 100,\n \"highHighMessage\": \"High High alarm\",\n \"highLimit\": 80,\n \"highMessage\": \"High alarm\",\n \"lowLimit\": 20,\n \"lowMessage\": \"Low alarm\",\n \"lowLowLimit\": 0,\n \"lowLowMessage\": \"Low Low alarm\",\n \"normalStateValue\": 0,\n \"digitalMessage\": \"Digital alarm\"\n }\n ],\n \"methods\": [],\n \"objectsTypes\": []\n },\n {\n \"name\": \"folderCustomObjectType\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": [\n {\n \"name\": \"customObjectType1\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"ns=2;s=myServer1.folderCustomObjectType.customObjectType1\",\n \"namespaceId\": 2,\n \"objectsType\": \"customObjectType\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": []\n },\n {\n \"name\": \"customObjectType2\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"ns=2;s=myServer1.folderCustomObjectType.customObjectType2\",\n \"namespaceId\": 2,\n \"objectsType\": \"customObjectType\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": []\n }\n ]\n }\n ],\n \"objects\": [\n {\n \"name\": \"newObject\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [\n {\n \"name\": \"newVariable\",\n \"type\": \"Int32\",\n \"value\": \"\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2\n },\n {\n \"name\": \"newVariable2\",\n \"type\": \"Float\",\n \"value\": \"123.3\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2\n }\n ],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": []\n }\n ],\n \"variables\": [\n {\n \"name\": \"variableLevelAlarm\",\n \"type\": \"Int32\",\n \"value\": \"50\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2\n },\n {\n \"name\": \"variableDigitalAlarm\",\n \"type\": \"Boolean\",\n \"value\": \"0\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2\n }\n ],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": []\n }\n ],\n \"objectsTypes\": [\n {\n \"name\": \"customObjectType\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"ns=2;s=customObjectType\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [\n {\n \"name\": \"var1\",\n \"type\": \"Int32\",\n \"value\": \"\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"ns=2;s=customObjectType.var1\",\n \"namespaceId\": 2\n },\n {\n \"name\": \"var2\",\n \"type\": \"Int32\",\n \"value\": \"\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"ns=2;s=customObjectType.var2\",\n \"namespaceId\": 2\n }\n ],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": []\n }\n ],\n \"nameSpaces\": [\n {\n \"id\": 2,\n \"name\": \"urn:node-red:opc-ua-server\"\n },\n {\n \"id\": 3,\n \"name\": \"urn:plant2:3\"\n }\n ]\n}","x":730,"y":140,"wires":[]},{"id":"2539932222902ee0","type":"opcua-server-io","z":"8cfd21c364c2df03","g":"6052786fca1151e5","name":"","serverRef":"myServer1","mode":"method-input","identifierType":"path","tagPath":"","tagNodeId":"","methodName":"methodSum","intervalMs":500,"inputs":0,"outputs":1,"x":170,"y":300,"wires":[["2c5bd58258277ca0"]]},{"id":"3496dfa358242797","type":"opcua-server-io","z":"8cfd21c364c2df03","g":"6052786fca1151e5","name":"","serverRef":"myServer1","mode":"method-output","identifierType":"path","tagPath":"","tagNodeId":"","methodName":"methodSum","intervalMs":500,"inputs":1,"outputs":0,"x":730,"y":300,"wires":[]},{"id":"2c5bd58258277ca0","type":"function","z":"8cfd21c364c2df03","g":"6052786fca1151e5","name":"function 2","func":"var input1 = msg.payload[0].value\nvar input2 = msg.payload[1].value\n\nmsg.payload = [\n {\n dataType: \"Float\",\n value: input1 + input2\n }\n];\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":300,"wires":[["3496dfa358242797"]]},{"id":"a49f5a89da5155bc","type":"inject","z":"8cfd21c364c2df03","g":"60b19848ebbc5356","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":580,"wires":[["14b097a343c4f0df"]]},{"id":"14b097a343c4f0df","type":"function","z":"8cfd21c364c2df03","g":"60b19848ebbc5356","name":"function 47","func":"const min = 30;\nconst max = 40;\nconst randomInt1 = Math.floor(Math.random() * (max - min + 1)) + min;\nconst randomInt2 = Math.floor(Math.random() * (max - min + 1)) + min;\nconst randomInt3 = Math.floor(Math.random() * (max - min + 1)) + min;\n\n\nmsg.payload = [\n {\n \"nodePath\": \"myServer1.newObject\",\n \"severity\": 0,\n \"message\": \"newObject message\"\n },\n {\n \"nodePath\": \"myServer1.newObject\",\n \"severity\": 500,\n \"message\": \"newObject message 2\"\n },\n {\n \"nodePath\": \"myServer1.newObject\",\n \"severity\": 1000,\n \"message\": \"newObject message 3\"\n }\n]\n\n\n\n\n\n\n\n\nreturn msg","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":580,"wires":[["ee5372a7e7a8edbd"]]},{"id":"1b598fc1781b29e1","type":"debug","z":"8cfd21c364c2df03","g":"60b19848ebbc5356","name":"debug 38","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":880,"y":580,"wires":[]},{"id":"ee5372a7e7a8edbd","type":"opcua-server-io","z":"8cfd21c364c2df03","g":"60b19848ebbc5356","name":"","serverRef":"myServer1","mode":"event","identifierType":"path","tagPath":"","tagNodeId":"","methodName":"","intervalMs":500,"inputs":1,"outputs":1,"x":660,"y":580,"wires":[["1b598fc1781b29e1"]]},{"id":"b9d2a0cfd9e9b4ac","type":"comment","z":"8cfd21c364c2df03","g":"60b19848ebbc5356","name":"event","info":"","x":170,"y":520,"wires":[]},{"id":"72a79bc79b4cc0bb","type":"inject","z":"8cfd21c364c2df03","g":"3ccc34feec0630dd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":140,"wires":[["ab84f0db1e246e82"]]},{"id":"ab84f0db1e246e82","type":"template","z":"8cfd21c364c2df03","g":"3ccc34feec0630dd","name":"","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n \"objects\": [],\n \"folders\": [\n {\n \"name\": \"myServer1\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [\n {\n \"name\": \"folderMethod\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [],\n \"alarms\": [],\n \"methods\": [\n {\n \"name\": \"methodSum\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"inputs\": [\n {\n \"name\": \"var1\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n },\n {\n \"name\": \"var2\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"result\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n }\n ]\n },\n {\n \"name\": \"methodMultiplication\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"inputs\": [\n {\n \"name\": \"var1\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n },\n {\n \"name\": \"var2\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n }\n ],\n \"outputs\": [\n {\n \"name\": \"result\",\n \"type\": \"Float\",\n \"displayName\": \"\",\n \"description\": \"\"\n }\n ]\n }\n ],\n \"objectsTypes\": []\n },\n {\n \"name\": \"folderAlarms\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [],\n \"alarms\": [\n {\n \"name\": \"levelAlarm1\",\n \"variableNodeId\": \"myServer1.variableLevelAlarm\",\n \"type\": \"levelAlarm\",\n \"enabled\": true,\n \"severity\": 500,\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"highHighLimit\": 90,\n \"highHighMessage\": \"High High alarm\",\n \"highLimit\": 80,\n \"highMessage\": \"High alarm\",\n \"lowLimit\": 20,\n \"lowMessage\": \"Low alarm\",\n \"lowLowLimit\": 10,\n \"lowLowMessage\": \"Low Low alarm\",\n \"normalStateValue\": 0,\n \"digitalMessage\": \"Digital alarm\"\n },\n {\n \"name\": \"digitalAlarm1\",\n \"variableNodeId\": \"myServer1.variableDigitalAlarm\",\n \"type\": \"digitalAlarm\",\n \"enabled\": true,\n \"severity\": 500,\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"highHighLimit\": 100,\n \"highHighMessage\": \"High High alarm\",\n \"highLimit\": 80,\n \"highMessage\": \"High alarm\",\n \"lowLimit\": 20,\n \"lowMessage\": \"Low alarm\",\n \"lowLowLimit\": 0,\n \"lowLowMessage\": \"Low Low alarm\",\n \"normalStateValue\": 0,\n \"digitalMessage\": \"Digital alarm\"\n }\n ],\n \"methods\": [],\n \"objectsTypes\": []\n },\n {\n \"name\": \"folderCustomObjectType\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": [\n {\n \"name\": \"customObjectType1\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"ns=2;s=myServer1.folderCustomObjectType.customObjectType1\",\n \"namespaceId\": 2,\n \"objectsType\": \"customObjectType\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": []\n },\n {\n \"name\": \"customObjectType2\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"ns=2;s=myServer1.folderCustomObjectType.customObjectType2\",\n \"namespaceId\": 2,\n \"objectsType\": \"customObjectType\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": []\n }\n ]\n }\n ],\n \"objects\": [\n {\n \"name\": \"newObject\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [\n {\n \"name\": \"newVariable\",\n \"type\": \"Int32\",\n \"value\": \"\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2\n },\n {\n \"name\": \"newVariable2\",\n \"type\": \"Float\",\n \"value\": \"123.3\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2\n }\n ],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": []\n }\n ],\n \"variables\": [\n {\n \"name\": \"variableLevelAlarm\",\n \"type\": \"Int32\",\n \"value\": \"50\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2\n },\n {\n \"name\": \"variableDigitalAlarm\",\n \"type\": \"Boolean\",\n \"value\": \"0\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"\",\n \"namespaceId\": 2\n }\n ],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": []\n }\n ],\n \"objectsTypes\": [\n {\n \"name\": \"customObjectType\",\n \"displayName\": \"\",\n \"description\": \"\",\n \"nodeId\": \"ns=2;s=customObjectType\",\n \"namespaceId\": 2,\n \"objectsType\": \"\",\n \"folders\": [],\n \"objects\": [],\n \"variables\": [\n {\n \"name\": \"var1\",\n \"type\": \"Int32\",\n \"value\": \"\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"ns=2;s=customObjectType.var1\",\n \"namespaceId\": 2\n },\n {\n \"name\": \"var2\",\n \"type\": \"Int32\",\n \"value\": \"\",\n \"access\": \"readwrite\",\n \"description\": \"\",\n \"displayName\": \"\",\n \"nodeId\": \"ns=2;s=customObjectType.var2\",\n \"namespaceId\": 2\n }\n ],\n \"alarms\": [],\n \"methods\": [],\n \"objectsTypes\": []\n }\n ],\n \"nameSpaces\": [\n {\n \"id\": 2,\n \"name\": \"urn:node-red:opc-ua-server\"\n },\n {\n \"id\": 3,\n \"name\": \"urn:plant2:3\"\n }\n ]\n}","output":"json","x":480,"y":140,"wires":[["8a78dbc7de4c8cc9"]]},{"id":"272ce77b614d8cc3","type":"opcua-server-io","z":"8cfd21c364c2df03","g":"b33901b7b12af86c","name":"","serverRef":"myServer1","mode":"events","identifierType":"path","tagPath":"","tagNodeId":"","methodName":"","intervalMs":"1000","inputs":0,"outputs":1,"x":180,"y":760,"wires":[["f5824dbc89d628fa"]]},{"id":"f5824dbc89d628fa","type":"debug","z":"8cfd21c364c2df03","g":"b33901b7b12af86c","name":"debug 1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":760,"wires":[]},{"id":"e84bb307d95e6a70","type":"comment","z":"8cfd21c364c2df03","g":"b33901b7b12af86c","name":"events server read and write(clients)","info":"","x":240,"y":700,"wires":[]},{"id":"445f843e25c0a0d5","type":"inject","z":"8cfd21c364c2df03","g":"d0ee96529905f5f9","name":"alarm on","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"payload1","v":"92","vt":"num"},{"p":"payload2","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":980,"wires":[["1dc6b0317f7865e5"]]},{"id":"ac96540b903f3ba5","type":"opcua-server-io","z":"8cfd21c364c2df03","g":"d0ee96529905f5f9","name":"","serverRef":"myServer1","mode":"write","identifierType":"path","tagPath":"","tagNodeId":"","methodName":"","intervalMs":500,"inputs":1,"outputs":1,"x":640,"y":940,"wires":[["640b4ac3bd6d7603"]]},{"id":"1dc6b0317f7865e5","type":"function","z":"8cfd21c364c2df03","g":"d0ee96529905f5f9","name":"function 1","func":"msg.payload = [\n {\n \"name\": \"variableLevelAlarm\",\n \"path\": \"myServer1.variableLevelAlarm\",\n \"value\" : msg.payload1\n },\n {\n \"name\": \"variablDigitalAlarm\",\n \"path\": \"myServer1.variableDigitalAlarm\",\n \"value\" : msg.payload2\n }\n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":940,"wires":[["ac96540b903f3ba5"]]},{"id":"640b4ac3bd6d7603","type":"debug","z":"8cfd21c364c2df03","g":"d0ee96529905f5f9","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":920,"wires":[]},{"id":"ef8956faa8f46c82","type":"comment","z":"8cfd21c364c2df03","g":"d0ee96529905f5f9","name":"write","info":"","x":150,"y":880,"wires":[]},{"id":"24d49fb4730ddb0e","type":"inject","z":"8cfd21c364c2df03","g":"2c50499b89653464","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":1360,"wires":[["c4be4c26dc82c1e0"]]},{"id":"c4be4c26dc82c1e0","type":"opcua-server-io","z":"8cfd21c364c2df03","g":"2c50499b89653464","name":"read direct","serverRef":"myServer1","mode":"read","identifierType":"path","tagPath":"myServer1.variableLevelAlarm","tagNodeId":"","methodName":"","intervalMs":500,"inputs":1,"outputs":1,"x":540,"y":1360,"wires":[["aa98d508aa93d8a4"]]},{"id":"aa98d508aa93d8a4","type":"debug","z":"8cfd21c364c2df03","g":"2c50499b89653464","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":1360,"wires":[]},{"id":"10098330bac46e38","type":"inject","z":"8cfd21c364c2df03","g":"d0ee96529905f5f9","name":"alarm off","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"payload1","v":"50","vt":"num"},{"p":"payload2","v":"false","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":940,"wires":[["1dc6b0317f7865e5"]]},{"id":"ec7f4d67c496c5d1","type":"comment","z":"8cfd21c364c2df03","g":"d0ee96529905f5f9","name":"write single","info":"","x":200,"y":1040,"wires":[]},{"id":"0292e098827fb16e","type":"inject","z":"8cfd21c364c2df03","g":"d0ee96529905f5f9","name":"51","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"51","payloadType":"num","x":170,"y":1100,"wires":[["94c8e2c954522cf9"]]},{"id":"94c8e2c954522cf9","type":"opcua-server-io","z":"8cfd21c364c2df03","g":"d0ee96529905f5f9","name":"write direct","serverRef":"myServer1","mode":"write","identifierType":"path","tagPath":"myServer1.variableLevelAlarm","tagNodeId":"","methodName":"","intervalMs":500,"inputs":1,"outputs":1,"x":400,"y":1100,"wires":[["5660f34e554bb6f5"]]},{"id":"5660f34e554bb6f5","type":"debug","z":"8cfd21c364c2df03","g":"d0ee96529905f5f9","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":640,"y":1100,"wires":[]},{"id":"fc4adb1b41b878d1","type":"inject","z":"8cfd21c364c2df03","g":"2c50499b89653464","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":1280,"wires":[["cea374e6d3345ea4"]]},{"id":"cea374e6d3345ea4","type":"function","z":"8cfd21c364c2df03","g":"2c50499b89653464","name":"function 3","func":"msg.payload = [\n {\n \"name\": \"variableLevelAlarm\",\n \"path\": \"myServer1.variableLevelAlarm\",\n \"value\" : msg.payload1\n },\n {\n \"name\": \"variablDigitalAlarm\",\n \"path\": \"myServer1.variableDigitalAlarm\",\n \"value\" : msg.payload2\n }\n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":1280,"wires":[["23d02e0b9d8214c0"]]},{"id":"23d02e0b9d8214c0","type":"opcua-server-io","z":"8cfd21c364c2df03","g":"2c50499b89653464","name":"","serverRef":"myServer1","mode":"read","identifierType":"path","tagPath":"","tagNodeId":"","methodName":"","intervalMs":500,"inputs":1,"outputs":1,"x":640,"y":1280,"wires":[["b89df44c1e418bb3"]]},{"id":"b89df44c1e418bb3","type":"debug","z":"8cfd21c364c2df03","g":"2c50499b89653464","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":840,"y":1280,"wires":[]},{"id":"bab77d6d3da6a778","type":"comment","z":"8cfd21c364c2df03","g":"2c50499b89653464","name":"read","info":"","x":150,"y":1220,"wires":[]},{"id":"7fa5b7577fb457c9","type":"comment","z":"8cfd21c364c2df03","g":"2c50499b89653464","name":"read single","info":"","x":200,"y":1320,"wires":[]},{"id":"eebad7aed2185cda","type":"comment","z":"8cfd21c364c2df03","g":"6052786fca1151e5","name":"methods","info":"","x":160,"y":260,"wires":[]},{"id":"7ba31a677445ec83","type":"opcua-server-io","z":"8cfd21c364c2df03","g":"6052786fca1151e5","name":"","serverRef":"myServer1","mode":"method-input","identifierType":"path","tagPath":"","tagNodeId":"","methodName":"methodMultiplication","intervalMs":500,"inputs":0,"outputs":1,"x":190,"y":400,"wires":[["2ac26da7c2c45837"]]},{"id":"25e830d51c339c4e","type":"opcua-server-io","z":"8cfd21c364c2df03","g":"6052786fca1151e5","name":"","serverRef":"myServer1","mode":"method-output","identifierType":"path","tagPath":"","tagNodeId":"","methodName":"methodMultiplication","intervalMs":500,"inputs":1,"outputs":0,"x":750,"y":400,"wires":[]},{"id":"2ac26da7c2c45837","type":"function","z":"8cfd21c364c2df03","g":"6052786fca1151e5","name":"function 4","func":"var input1 = msg.payload[0].value\nvar input2 = msg.payload[1].value\n\nmsg.payload = [\n {\n dataType: \"Float\",\n value: input1 * input2\n }\n];\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":400,"wires":[["25e830d51c339c4e"]]},{"id":"e15d8d090c4d94a1","type":"comment","z":"8cfd21c364c2df03","g":"3ccc34feec0630dd","name":"server","info":"","x":190,"y":80,"wires":[]},{"id":"8f829d3785d42f88","type":"opcua-client","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"client read direct","connection":"b09a1570957d3c44","mode":"read","selectedItems":"[\n {\n \"name\": \"variableLevelAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableLevelAlarm\",\n \"type\": \"Int32\",\n \"nodeClass\": \"Variable\",\n \"hasTypeDefinition\": {\n \"nodeID\": \"ns=0;i=63\",\n \"browseName\": \"BaseDataVariableType\",\n \"displayName\": \"BaseDataVariableType\"\n },\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n },\n {\n \"name\": \"variableDigitalAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableDigitalAlarm\",\n \"type\": \"Boolean\",\n \"nodeClass\": \"Variable\",\n \"hasTypeDefinition\": {\n \"nodeID\": \"ns=0;i=63\",\n \"browseName\": \"BaseDataVariableType\",\n \"displayName\": \"BaseDataVariableType\"\n },\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n }\n]","samplingInterval":250,"publishingInterval":250,"x":440,"y":120,"wires":[["ccf537fdb44b4318"]]},{"id":"5b22ed56f0a54f73","type":"inject","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":120,"wires":[["8f829d3785d42f88"]]},{"id":"ccf537fdb44b4318","type":"debug","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":640,"y":120,"wires":[]},{"id":"e7fa2bb906fc87c6","type":"opcua-client","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"client read ","connection":"b09a1570957d3c44","mode":"read","selectedItems":"[]","samplingInterval":250,"publishingInterval":250,"x":630,"y":240,"wires":[["f3f0115e9d6b6b7a"]]},{"id":"a34ce9528509a2c9","type":"inject","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":240,"wires":[["3da807b7d25b85a9"]]},{"id":"f3f0115e9d6b6b7a","type":"debug","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":880,"y":240,"wires":[]},{"id":"3da807b7d25b85a9","type":"function","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"function 5","func":"msg.payload = [\n {\n \"name\": \"variableLevelAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableLevelAlarm\",\n \"type\": \"Int32\"\n },\n {\n \"name\": \"variableDigitalAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableDigitalAlarm\",\n \"type\": \"Boolean\"\n }\n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":240,"wires":[["e7fa2bb906fc87c6"]]},{"id":"ce2f03338a7cf2f5","type":"opcua-client","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"client read Subscripition","connection":"b09a1570957d3c44","mode":"subscription","selectedItems":"[]","samplingInterval":"500","publishingInterval":"500","x":670,"y":380,"wires":[["f6b7ea864ee0abfb"]]},{"id":"33be489edef189fb","type":"inject","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":380,"wires":[["49f11177029d14ec"]]},{"id":"f6b7ea864ee0abfb","type":"debug","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"debug 8","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":380,"wires":[]},{"id":"49f11177029d14ec","type":"function","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"function 6","func":"msg.payload = [\n {\n \"name\": \"variableLevelAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableLevelAlarm\",\n \"type\": \"Int32\"\n },\n {\n \"name\": \"variableDigitalAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableDigitalAlarm\",\n \"type\": \"Boolean\"\n }\n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":380,"wires":[["ce2f03338a7cf2f5"]]},{"id":"e812bef55f237f13","type":"opcua-client","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"client read Subscripition direct","connection":"b09a1570957d3c44","mode":"subscription","selectedItems":"[\n {\n \"name\": \"variableLevelAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableLevelAlarm\",\n \"type\": \"Int32\",\n \"nodeClass\": \"Variable\",\n \"hasTypeDefinition\": {\n \"nodeID\": \"ns=0;i=63\",\n \"browseName\": \"BaseDataVariableType\",\n \"displayName\": \"BaseDataVariableType\"\n },\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n },\n {\n \"name\": \"variableDigitalAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableDigitalAlarm\",\n \"type\": \"Boolean\",\n \"nodeClass\": \"Variable\",\n \"hasTypeDefinition\": {\n \"nodeID\": \"ns=0;i=63\",\n \"browseName\": \"BaseDataVariableType\",\n \"displayName\": \"BaseDataVariableType\"\n },\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n }\n]","samplingInterval":"500","publishingInterval":"500","x":690,"y":460,"wires":[["09825afc617c880f"]]},{"id":"81af739c946465e4","type":"inject","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":460,"wires":[["e812bef55f237f13"]]},{"id":"09825afc617c880f","type":"debug","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1000,"y":460,"wires":[]},{"id":"3f191c29e1ff64d8","type":"comment","z":"151212437222dae0","g":"8ccd7a60c46f9762","name":"read","info":"","x":130,"y":60,"wires":[]},{"id":"59def5e9e9b0d450","type":"comment","z":"151212437222dae0","g":"66eeced42fde3a96","name":"write","info":"","x":130,"y":600,"wires":[]},{"id":"01fb75eb1f813561","type":"opcua-client","z":"151212437222dae0","g":"66eeced42fde3a96","name":"client write direct","connection":"b09a1570957d3c44","mode":"write","selectedItems":"[\n {\n \"name\": \"variableLevelAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableLevelAlarm\",\n \"type\": \"Int32\",\n \"nodeClass\": \"Variable\",\n \"hasTypeDefinition\": {\n \"nodeID\": \"ns=0;i=63\",\n \"browseName\": \"BaseDataVariableType\",\n \"displayName\": \"BaseDataVariableType\"\n },\n \"valueProperty\": \"payload1\",\n \"valuePropertyType\": \"msg\"\n },\n {\n \"name\": \"variableDigitalAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableDigitalAlarm\",\n \"type\": \"Boolean\",\n \"nodeClass\": \"Variable\",\n \"hasTypeDefinition\": {\n \"nodeID\": \"ns=0;i=63\",\n \"browseName\": \"BaseDataVariableType\",\n \"displayName\": \"BaseDataVariableType\"\n },\n \"valueProperty\": \"payload2\",\n \"valuePropertyType\": \"msg\"\n }\n]","samplingInterval":250,"publishingInterval":250,"x":430,"y":680,"wires":[["18307b76be9fc4b8"]]},{"id":"18307b76be9fc4b8","type":"debug","z":"151212437222dae0","g":"66eeced42fde3a96","name":"debug 10","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":680,"wires":[]},{"id":"9a0b96daf2932d2c","type":"inject","z":"151212437222dae0","g":"66eeced42fde3a96","name":"alarm on","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"payload1","v":"92","vt":"num"},{"p":"payload2","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":740,"wires":[["01fb75eb1f813561"]]},{"id":"fe096aef2045d911","type":"inject","z":"151212437222dae0","g":"66eeced42fde3a96","name":"alarm off","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"payload1","v":"50","vt":"num"},{"p":"payload2","v":"false","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":680,"wires":[["01fb75eb1f813561"]]},{"id":"7585676656604416","type":"opcua-client","z":"151212437222dae0","g":"66eeced42fde3a96","name":"client write ","connection":"b09a1570957d3c44","mode":"write","selectedItems":"[]","samplingInterval":250,"publishingInterval":250,"x":570,"y":820,"wires":[["b389c0b3ac04d24e"]]},{"id":"b389c0b3ac04d24e","type":"debug","z":"151212437222dae0","g":"66eeced42fde3a96","name":"debug 11","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":740,"y":820,"wires":[]},{"id":"163f37291329348b","type":"inject","z":"151212437222dae0","g":"66eeced42fde3a96","name":"alarm on","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"payload1","v":"92","vt":"num"},{"p":"payload2","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":900,"wires":[["d3fc0790651831ba"]]},{"id":"de736fbb70b3bed4","type":"inject","z":"151212437222dae0","g":"66eeced42fde3a96","name":"alarm off","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"payload1","v":"50","vt":"num"},{"p":"payload2","v":"false","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":840,"wires":[["d3fc0790651831ba"]]},{"id":"d3fc0790651831ba","type":"function","z":"151212437222dae0","g":"66eeced42fde3a96","name":"function 7","func":"msg.payload = [\n {\n \"name\": \"variableLevelAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableLevelAlarm\",\n \"type\": \"Int32\",\n \"nodeClass\": \"Variable\",\n \"value\" : msg.payload1\n \n },\n {\n \"name\": \"variableDigitalAlarm\",\n \"nodeID\": \"ns=2;s=myServer1.variableDigitalAlarm\",\n \"type\": \"Boolean\",\n \"nodeClass\": \"Variable\",\n \"value\" : msg.payload2\n\n }\n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":820,"wires":[["7585676656604416"]]},{"id":"559d41bd53945bd5","type":"opcua-client","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"client method","connection":"b09a1570957d3c44","mode":"method","selectedItems":"[\n {\n \"name\": \"soma\",\n \"nodeID\": \"ns=2;s=teste.soma\",\n \"nodeClass\": \"Method\",\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n }\n]","samplingInterval":250,"publishingInterval":250,"x":830,"y":1100,"wires":[["a0c7740ad5c228df"]]},{"id":"748d5c965bafe12f","type":"inject","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":1100,"wires":[["c7018fe1a57d52df"]]},{"id":"a0c7740ad5c228df","type":"debug","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"debug 52","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1020,"y":1100,"wires":[]},{"id":"523deb9018b6ed8f","type":"function","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"method refresh","func":"msg.payload = [\n {\n \"name\": \"metodo1\",\n \"nodeID\": \"ns=0;i=3875\",\n \"inputs\": [\n {\n \"name\": \"i1\",\n \"type\": \"UInt32\",\n \"value\": msg.payload\n },\n ]\n },\n\n \n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":1100,"wires":[["559d41bd53945bd5"]]},{"id":"c7018fe1a57d52df","type":"opcua-client","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"client get id","connection":"b09a1570957d3c44","mode":"getSubscriptionId","selectedItems":"[\n {\n \"name\": \"soma\",\n \"nodeID\": \"ns=2;s=teste.soma\",\n \"nodeClass\": \"Method\",\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n }\n]","samplingInterval":250,"publishingInterval":250,"x":450,"y":1100,"wires":[["523deb9018b6ed8f"]]},{"id":"9022c388f2a0a7b4","type":"comment","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"method refresh","info":"","x":160,"y":1000,"wires":[]},{"id":"ec63f36201edeb79","type":"opcua-client","z":"151212437222dae0","g":"7d087d18c99ee40b","name":"client Events","connection":"b09a1570957d3c44","mode":"events","selectedItems":"[\n {\n \"name\": \"Server\",\n \"nodeID\": \"ns=0;i=2253\",\n \"nodeClass\": \"Object\",\n \"hasTypeDefinition\": {\n \"nodeID\": \"ns=0;i=2004\",\n \"browseName\": \"ServerType\",\n \"displayName\": \"ServerType\"\n },\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n }\n]","samplingInterval":250,"publishingInterval":250,"x":450,"y":1540,"wires":[["b534f3ac9840bdbc"]]},{"id":"0e0a2fafc6969bbe","type":"inject","z":"151212437222dae0","g":"7d087d18c99ee40b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":1540,"wires":[["ec63f36201edeb79"]]},{"id":"b534f3ac9840bdbc","type":"debug","z":"151212437222dae0","g":"7d087d18c99ee40b","name":"debug 12","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":1540,"wires":[]},{"id":"0d0e206efa537357","type":"comment","z":"151212437222dae0","g":"7d087d18c99ee40b","name":"events","info":"","x":130,"y":1480,"wires":[]},{"id":"931f4a35aad5bb36","type":"inject","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":1220,"wires":[["79119ea93930df91"]]},{"id":"c00210b53afb879f","type":"opcua-client","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"client method","connection":"b09a1570957d3c44","mode":"method","selectedItems":"[\n {\n \"name\": \"soma\",\n \"nodeID\": \"ns=2;s=teste.soma\",\n \"nodeClass\": \"Method\",\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n }\n]","samplingInterval":250,"publishingInterval":250,"x":670,"y":1220,"wires":[["5d4533a3ba0f04e8"]]},{"id":"79119ea93930df91","type":"function","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"method methodSum","func":"msg.payload = [\n {\n \"name\": \"methodSum\",\n \"nodeID\": \"ns=2;s=myServer1.folderMethod.methodSum\",\n \"inputs\": [\n {\n \"name\": \"var1\",\n \"type\": \"Float\",\n \"value\": 5\n },\n {\n \"name\": \"var2\",\n \"type\": \"Float\",\n \"value\": 5\n }\n ]\n }\n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":1220,"wires":[["c00210b53afb879f"]]},{"id":"5d4533a3ba0f04e8","type":"debug","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"debug 13","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850,"y":1220,"wires":[]},{"id":"0f459071b408f013","type":"comment","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"refresh event","info":"","x":150,"y":1060,"wires":[]},{"id":"1bd1baf1884a61f9","type":"comment","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"methodSum","info":"","x":150,"y":1160,"wires":[]},{"id":"99978349bb284a24","type":"opcua-client","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"client method","connection":"b09a1570957d3c44","mode":"method","selectedItems":"[\n {\n \"name\": \"soma\",\n \"nodeID\": \"ns=2;s=teste.soma\",\n \"nodeClass\": \"Method\",\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n }\n]","samplingInterval":250,"publishingInterval":250,"x":830,"y":1360,"wires":[["f42f94894ccf2130"]]},{"id":"ed4187aa4995ac37","type":"inject","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":1360,"wires":[["d146a15bf3c1ef33"]]},{"id":"d146a15bf3c1ef33","type":"function","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"levelAlarm1-Acknowledge","func":"\n\nmsg.payload = [\n {\n \"name\": \"metodo1\",\n \"nodeID\": \"ns=2;s=myServer1.folderAlarms.levelAlarm1-Acknowledge\",\n \"inputs\": [\n {\n \"name\": \"i1\",\n \"type\": \"ByteString\",\n \"value\": \"\"\n },\n {\n \"name\": \"i2\",\n \"type\": \"LocalizedText\",\n \"value\": \"\"\n },\n ]\n },\n\n\n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":1360,"wires":[["99978349bb284a24"]]},{"id":"f42f94894ccf2130","type":"debug","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"debug 14","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":990,"y":1360,"wires":[]},{"id":"8e3c2676e9261e83","type":"comment","z":"151212437222dae0","g":"5aa5f21d2362ae83","name":"method Acknowledge","info":"","x":180,"y":1300,"wires":[]},{"id":"b2d099b89f3514cd","type":"opcua-client","z":"151212437222dae0","g":"e7ababb4a28f644f","name":"client browse direct","connection":"b09a1570957d3c44","mode":"browse","selectedItems":"[\n {\n \"name\": \"myServer1\",\n \"nodeID\": \"ns=2;s=myServer1\",\n \"nodeClass\": \"Object\",\n \"hasTypeDefinition\": {\n \"nodeID\": \"ns=0;i=61\",\n \"browseName\": \"FolderType\",\n \"displayName\": \"FolderType\"\n },\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n },\n {\n \"name\": \"folderAlarms\",\n \"nodeID\": \"ns=2;s=myServer1.folderAlarms\",\n \"nodeClass\": \"Object\",\n \"hasTypeDefinition\": {\n \"nodeID\": \"ns=0;i=61\",\n \"browseName\": \"FolderType\",\n \"displayName\": \"FolderType\"\n },\n \"valueProperty\": \"payload\",\n \"valuePropertyType\": \"msg\"\n }\n]","samplingInterval":250,"publishingInterval":250,"x":450,"y":1740,"wires":[["cefc4b175cd724d0"]]},{"id":"38cb1e7a2e2937a7","type":"comment","z":"151212437222dae0","g":"e7ababb4a28f644f","name":"browse ","info":"","x":130,"y":1680,"wires":[]},{"id":"e2cf88d7252bc0aa","type":"inject","z":"151212437222dae0","g":"e7ababb4a28f644f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":1740,"wires":[["b2d099b89f3514cd"]]},{"id":"cefc4b175cd724d0","type":"debug","z":"151212437222dae0","g":"e7ababb4a28f644f","name":"debug 15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":1740,"wires":[]},{"id":"4d17a07cc2dd4180","type":"opcua-client","z":"151212437222dae0","g":"e7ababb4a28f644f","name":"client browse ","connection":"b09a1570957d3c44","mode":"browse","selectedItems":"[]","samplingInterval":250,"publishingInterval":250,"x":630,"y":1840,"wires":[["34ade9caad375180"]]},{"id":"02dbd16c9b764114","type":"inject","z":"151212437222dae0","g":"e7ababb4a28f644f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":1840,"wires":[["2434820a659402c4"]]},{"id":"34ade9caad375180","type":"debug","z":"151212437222dae0","g":"e7ababb4a28f644f","name":"debug 16","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":860,"y":1840,"wires":[]},{"id":"2434820a659402c4","type":"function","z":"151212437222dae0","g":"e7ababb4a28f644f","name":"browse ","func":"msg.payload = [\n {\n \"name\": \"myServer1\",\n \"nodeID\": \"ns=2;s=myServer1\",\n \n },\n {\n \"name\": \"folderAlarms\",\n \"nodeID\": \"ns=2;s=myServer1.folderAlarms\",\n \n }\n]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":1840,"wires":[["4d17a07cc2dd4180"]]},{"id":"15e6db0599d497f4","type":"opcua-client","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"","connection":"b09a1570957d3c44","mode":"browse","selectedItems":"[]","samplingInterval":250,"publishingInterval":250,"x":590,"y":340,"wires":[["e15fbd6363db8dbf","410af6a25e62ab73"]]},{"id":"244f561362390d9b","type":"inject","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":340,"wires":[["a16b3ffac4577d7c","410af6a25e62ab73"]]},{"id":"a16b3ffac4577d7c","type":"function","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"ns=2;s=myServer1","func":"msg.payload = [{\n \"nodeId\" : \"ns=2;s=myServer1\"\n}]\n\nflow.set(\"variables\", [])\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":340,"wires":[["15e6db0599d497f4"]]},{"id":"e15fbd6363db8dbf","type":"change","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0].browse","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":340,"wires":[["264e04316ce1bd12"]]},{"id":"264e04316ce1bd12","type":"split","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","property":"payload","x":1010,"y":340,"wires":[["3c245643349610db"]]},{"id":"3c245643349610db","type":"switch","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"","property":"payload.nodeClass","propertyType":"msg","rules":[{"t":"eq","v":"Object","vt":"str"},{"t":"eq","v":"Variable","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1170,"y":340,"wires":[["90cf455439e6ab19"],["bcf7a54f2db2b4d1"]]},{"id":"90cf455439e6ab19","type":"function","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"function 39","func":"msg.payload = [msg.payload]\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":810,"y":140,"wires":[["15e6db0599d497f4"]]},{"id":"bcf7a54f2db2b4d1","type":"function","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"flow.set(\"variables\")","func":"var variables = flow.get(\"variables\")\n\nvariables.push( {\n \"name\": msg.payload.browseName ,\n \"nodeID\": msg.payload.nodeID\n })\n\nflow.set(\"variables\" , variables)\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1390,"y":380,"wires":[["f0a29574ae62147a"]]},{"id":"acf7ead8b3b60917","type":"opcua-client","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"Subscription all variables in server","connection":"b09a1570957d3c44","mode":"subscription","selectedItems":"[]","samplingInterval":250,"publishingInterval":250,"x":640,"y":540,"wires":[["2ff0239edb93715c"]]},{"id":"f567148921a5d156","type":"change","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"variables","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":540,"wires":[["acf7ead8b3b60917"]]},{"id":"2ff0239edb93715c","type":"debug","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"debug 32","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":900,"y":540,"wires":[]},{"id":"79ebb05980a75f4f","type":"trigger","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"2","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":180,"y":540,"wires":[["f567148921a5d156"]]},{"id":"410af6a25e62ab73","type":"function","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"reset","func":"msg.reset = 1\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":420,"wires":[["4a8db72f8adb2859"]]},{"id":"98b977cfe3480521","type":"comment","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"Subscription all variables in server and flow.set","info":"","x":270,"y":180,"wires":[]},{"id":"f0a29574ae62147a","type":"link out","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"link out 1","mode":"link","links":["100264ab897a4b75"],"x":1565,"y":380,"wires":[]},{"id":"100264ab897a4b75","type":"link in","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"link in trigger","links":["f0a29574ae62147a","4a8db72f8adb2859"],"x":85,"y":540,"wires":[["79ebb05980a75f4f"]]},{"id":"4a8db72f8adb2859","type":"link out","z":"7c4416993db757dd","g":"964be834f8995b1f","name":"link out 2","mode":"link","links":["100264ab897a4b75"],"x":505,"y":420,"wires":[]},{"id":"1639a5f612680d01","type":"global-config","env":[],"modules":{"@vitormnm/node-red-simple-opcua":"1.0.0"}}]
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitormnm/node-red-simple-opcua",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"description": "Custom Node-RED OPC UA server node powered by node-opcua",
|
|
8
8
|
"main": "server/opcua-server.js",
|
|
9
9
|
"node-red": {
|
|
10
|
+
"version": ">=3.0.0",
|
|
10
11
|
"nodes": {
|
|
11
12
|
"opc-ua-server": "server/opcua-server.js",
|
|
12
13
|
"opcua-server-io": "server/opcua-server-io.js",
|
|
@@ -14,6 +15,10 @@
|
|
|
14
15
|
"opcua-client": "client/opcua-client.js"
|
|
15
16
|
}
|
|
16
17
|
},
|
|
18
|
+
"files": [
|
|
19
|
+
"resources/*",
|
|
20
|
+
"examples/*"
|
|
21
|
+
],
|
|
17
22
|
"scripts": {
|
|
18
23
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
24
|
},
|
|
@@ -29,7 +34,7 @@
|
|
|
29
34
|
"opcua-server"
|
|
30
35
|
],
|
|
31
36
|
"dependencies": {
|
|
32
|
-
"node-opcua": "2.
|
|
37
|
+
"node-opcua": "2.173.1"
|
|
33
38
|
},
|
|
34
39
|
"repository": {
|
|
35
40
|
"type": "git",
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
AttributeIds,
|
|
5
|
-
BrowseDirection,
|
|
6
|
-
DataType,
|
|
7
|
-
NodeClass,
|
|
8
|
-
coerceNodeId,
|
|
9
|
-
makeNodeId
|
|
10
|
-
} = require("node-opcua");
|
|
11
|
-
|
|
12
|
-
async function browseNode(session, root) {
|
|
13
|
-
const nodeID = normalizeNodeId(root.nodeID || root.nodeId || ROOT_NODE_ID);
|
|
14
|
-
const result = {
|
|
15
|
-
name: root.name || await readBrowseName(session, nodeID, "RootFolder"),
|
|
16
|
-
nodeID,
|
|
17
|
-
browse: []
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const browseResult = await session.browse({
|
|
21
|
-
nodeId: nodeID,
|
|
22
|
-
browseDirection: BrowseDirection.Forward,
|
|
23
|
-
includeSubtypes: true,
|
|
24
|
-
resultMask: 63
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const references = browseResult && Array.isArray(browseResult.references)
|
|
28
|
-
? browseResult.references
|
|
29
|
-
: [];
|
|
30
|
-
|
|
31
|
-
for (const reference of references) {
|
|
32
|
-
result.browse.push(await mapReference(session, reference));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function normalizeBrowseRoots(payload) {
|
|
39
|
-
if (payload === undefined || payload === null) {
|
|
40
|
-
return [{ name: "RootFolder", nodeID: ROOT_NODE_ID }];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (!Array.isArray(payload)) {
|
|
44
|
-
throw new Error("OPC UA browse expects msg.payload as an array");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (!payload.length) {
|
|
48
|
-
return [{ name: "RootFolder", nodeID: ROOT_NODE_ID }];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return payload.map((item) => {
|
|
52
|
-
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
53
|
-
throw new Error("Each browse item must be an object");
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
name: typeof item.name === "string" && item.name.trim() ? item.name.trim() : "",
|
|
58
|
-
nodeID: normalizeNodeId(item.nodeID || item.nodeId)
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function mapReference(session, reference) {
|
|
64
|
-
const childNodeId = normalizeNodeId(reference.nodeId);
|
|
65
|
-
const nodeClass = resolveNodeClassName(reference.nodeClass);
|
|
66
|
-
const browseName = extractBrowseName(reference.browseName, childNodeId);
|
|
67
|
-
const item = {
|
|
68
|
-
nodeID: childNodeId,
|
|
69
|
-
nodeClass,
|
|
70
|
-
browseName,
|
|
71
|
-
displayName: extractDisplayName(reference.displayName, browseName),
|
|
72
|
-
description: await readDescription(session, childNodeId)
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const hasTypeDefinition = await readHasTypeDefinition(session, childNodeId);
|
|
76
|
-
if (hasTypeDefinition) {
|
|
77
|
-
item.hasTypeDefinition = hasTypeDefinition;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (nodeClass === "Variable") {
|
|
81
|
-
item.value = await readValue(session, childNodeId);
|
|
82
|
-
item.dataType = await readDataType(session, childNodeId);
|
|
83
|
-
return item;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (nodeClass === "Method") {
|
|
87
|
-
const definition = await readMethodArguments(session, childNodeId);
|
|
88
|
-
item.inputArguments = definition.inputArguments;
|
|
89
|
-
item.outputArguments = definition.outputArguments;
|
|
90
|
-
return item;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return item;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async function readHasTypeDefinition(session, nodeId) {
|
|
97
|
-
try {
|
|
98
|
-
const browseResult = await session.browse({
|
|
99
|
-
nodeId,
|
|
100
|
-
browseDirection: BrowseDirection.Forward,
|
|
101
|
-
referenceTypeId: makeNodeId(40, 0), // HasTypeDefinition
|
|
102
|
-
includeSubtypes: false,
|
|
103
|
-
resultMask: 63
|
|
104
|
-
});
|
|
105
|
-
const references = browseResult && Array.isArray(browseResult.references)
|
|
106
|
-
? browseResult.references
|
|
107
|
-
: [];
|
|
108
|
-
if (!references.length) {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const reference = references[0];
|
|
113
|
-
const typeNodeId = normalizeNodeId(reference.nodeId);
|
|
114
|
-
return {
|
|
115
|
-
nodeID: typeNodeId,
|
|
116
|
-
browseName: extractBrowseName(reference.browseName, typeNodeId),
|
|
117
|
-
displayName: extractDisplayName(reference.displayName, typeNodeId)
|
|
118
|
-
};
|
|
119
|
-
} catch (error) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
async function readBrowseName(session, nodeId, fallback) {
|
|
125
|
-
try {
|
|
126
|
-
const dataValue = await session.read({
|
|
127
|
-
nodeId,
|
|
128
|
-
attributeId: AttributeIds.BrowseName
|
|
129
|
-
});
|
|
130
|
-
const value = dataValue && dataValue.value ? dataValue.value.value : null;
|
|
131
|
-
if (value && value.name) {
|
|
132
|
-
return String(value.name);
|
|
133
|
-
}
|
|
134
|
-
} catch (error) {
|
|
135
|
-
// Use fallback below.
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return String(fallback || nodeId);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
async function readDescription(session, nodeId) {
|
|
142
|
-
try {
|
|
143
|
-
const dataValue = await session.read({
|
|
144
|
-
nodeId,
|
|
145
|
-
attributeId: AttributeIds.Description
|
|
146
|
-
});
|
|
147
|
-
const value = dataValue && dataValue.value ? dataValue.value.value : null;
|
|
148
|
-
|
|
149
|
-
if (typeof value === "string") {
|
|
150
|
-
return value;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (value && typeof value.text === "string") {
|
|
154
|
-
return value.text;
|
|
155
|
-
}
|
|
156
|
-
} catch (error) {
|
|
157
|
-
// Return empty description when unavailable.
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return "";
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
async function readValue(session, nodeId) {
|
|
164
|
-
try {
|
|
165
|
-
const dataValue = await session.read({
|
|
166
|
-
nodeId,
|
|
167
|
-
attributeId: AttributeIds.Value
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
if (!dataValue || !dataValue.value) {
|
|
171
|
-
return "";
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const value = dataValue.value.value;
|
|
175
|
-
return value === undefined || value === null ? "" : value;
|
|
176
|
-
} catch (error) {
|
|
177
|
-
return "";
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
async function readDataType(session, nodeId) {
|
|
182
|
-
try {
|
|
183
|
-
const dataValue = await session.read({
|
|
184
|
-
nodeId,
|
|
185
|
-
attributeId: AttributeIds.DataType
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
const value = dataValue && dataValue.value ? dataValue.value.value : null;
|
|
189
|
-
if (!value) {
|
|
190
|
-
return "";
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (value.namespace === 0 && typeof value.value === "number") {
|
|
194
|
-
return DataType[value.value] || value.toString();
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return value.toString();
|
|
198
|
-
} catch (error) {
|
|
199
|
-
return "";
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
async function readMethodArguments(session, nodeId) {
|
|
204
|
-
try {
|
|
205
|
-
const definition = await session.getArgumentDefinition(nodeId);
|
|
206
|
-
return {
|
|
207
|
-
inputArguments: normalizeMethodArguments(definition && definition.inputArguments),
|
|
208
|
-
outputArguments: normalizeMethodArguments(definition && definition.outputArguments)
|
|
209
|
-
};
|
|
210
|
-
} catch (error) {
|
|
211
|
-
return {
|
|
212
|
-
inputArguments: [],
|
|
213
|
-
outputArguments: []
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function normalizeNodeId(nodeId) {
|
|
219
|
-
return coerceNodeId(nodeId).toString();
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
function resolveNodeClassName(nodeClass) {
|
|
223
|
-
if (!nodeClass && nodeClass !== 0) {
|
|
224
|
-
return "";
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (typeof nodeClass === "object" && typeof nodeClass.key === "string") {
|
|
228
|
-
return nodeClass.key;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (typeof nodeClass === "string") {
|
|
232
|
-
return nodeClass;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return NodeClass[nodeClass] || String(nodeClass);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function extractBrowseName(browseName, fallback) {
|
|
239
|
-
if (browseName && typeof browseName.name === "string" && browseName.name) {
|
|
240
|
-
return browseName.name;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return String(fallback || "");
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function extractDisplayName(displayName, fallback) {
|
|
247
|
-
if (displayName && typeof displayName.text === "string" && displayName.text) {
|
|
248
|
-
return displayName.text;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (typeof displayName === "string" && displayName) {
|
|
252
|
-
return displayName;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return String(fallback || "");
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function normalizeMethodArguments(argumentsList) {
|
|
259
|
-
if (!Array.isArray(argumentsList)) {
|
|
260
|
-
return [];
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return argumentsList.map((argument, index) => ({
|
|
264
|
-
name: argument && argument.name ? String(argument.name) : "arg" + (index + 1),
|
|
265
|
-
dataType: resolveArgumentDataType(argument && argument.dataType),
|
|
266
|
-
description: argument && argument.description && typeof argument.description.text === "string"
|
|
267
|
-
? argument.description.text
|
|
268
|
-
: ""
|
|
269
|
-
}));
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function resolveArgumentDataType(dataType) {
|
|
273
|
-
if (!dataType) {
|
|
274
|
-
return "";
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (dataType.namespace === 0 && typeof dataType.value === "number") {
|
|
278
|
-
return DataType[dataType.value] || dataType.toString();
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return dataType.toString();
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const ROOT_NODE_ID = "i=84";
|
|
285
|
-
|
|
286
|
-
module.exports = {
|
|
287
|
-
browseNode,
|
|
288
|
-
normalizeBrowseRoots,
|
|
289
|
-
normalizeNodeId,
|
|
290
|
-
ROOT_NODE_ID
|
|
291
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { dataValueToItemResult, resolveNodeId } = require("../opcua-client-utils");
|
|
4
|
-
|
|
5
|
-
class OpcUaClientReadService {
|
|
6
|
-
async execute(node, msg, session, itemsResolver) {
|
|
7
|
-
const items = itemsResolver.ensureClientItems(node, msg, "OPC UA read");
|
|
8
|
-
const nodeIds = items.map((item) => resolveNodeId(item));
|
|
9
|
-
const values = await session.readVariableValue(nodeIds);
|
|
10
|
-
return values.map((dataValue, index) => dataValueToItemResult(items[index], dataValue));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = {
|
|
15
|
-
OpcUaClientReadService
|
|
16
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { ClientSubscription } = require("node-opcua");
|
|
4
|
-
|
|
5
|
-
class OpcUaClientSubscriptionIdService {
|
|
6
|
-
async execute(node) {
|
|
7
|
-
const session = await node.connection.getSession();
|
|
8
|
-
const subscription = ClientSubscription.create(session, {
|
|
9
|
-
requestedPublishingInterval: 1000,
|
|
10
|
-
requestedLifetimeCount: 100,
|
|
11
|
-
requestedMaxKeepAliveCount: 10,
|
|
12
|
-
maxNotificationsPerPublish: 100,
|
|
13
|
-
publishingEnabled: true,
|
|
14
|
-
priority: 10
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const subscriptionId = subscription.subscriptionId;
|
|
18
|
-
await subscription.terminate();
|
|
19
|
-
return subscriptionId;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = {
|
|
24
|
-
OpcUaClientSubscriptionIdService
|
|
25
|
-
};
|