node-red-contrib-opcua
node-red-contrib-opcua copied to clipboard
How to use read multiple / write multiple
I added example, look this:
Flow:
Items in normal way:
Client action:
And import inject with Topic: readmultiple
Write multiple same way.
I refactored writing to work similar way as readmultiple (this is not yet fully tested / pushed to git / published):
New version 0.2.227 is now available
Hi @mikakaraila
What should be put in the payload to use READ MULTIPLE? An array of NodeId?
Please look example from OPCUA-TEST-NODES.json there should be example on one tab.
Hello, thanks for this useful node.
I was checking the example, and I managed to trigger a multiple read. The output, however, is a series of separate messages for each parameter, as if I read them sequentially, but with no index that can be used with the Join node afterwards.
Is this the normal behaviour?
Did you check topic of the msg?
When I trigger the read multiple, I get 11 messages that look like this:
On single reads, I tried setting up other message fields before injecting the read (like msg.variable_name) but it didn't work.
The closest solution to what I need has been to use a string node to replace the substrings "ns=2;s=Machine." and ".Value" from msg.topic.nodeId, and then replace each address (for instance, M01MA01MH01#0_E_B for the appropriate variable name, "machine_started" in this case").
Then, using Join and knowing the total number of variables, I can get an object with the variable names.
Still, it looks unnecessary convoluted.
It would be more straightforward to just the Name field of the Item node to name the variable after the reading is triggered, that could be used as key in a key/value pair on the payload (instead of pushing a single value as payload). Something like this:
I've also seen that with Read Multiple, when I try to read more than once, I get an error.
What is working for me is to clear the nodeId array, add all the nodeId again, and then send the read multiple each time I want to read.
Otherwise, if I send the Read Multiple twice in a row, it works the first time, but the second time I get the following error:
I tested inject "readAll" twice to read them again. No problems. Do you inject anything else to client node?
Something like this?
Function node will use context as save each variable and then combine them to newmsg.
var variableName = msg.topic.nodeId.toString(); // substring(7); // Part after ns=3;i= or ns=1;s= variableName = variableName.substring(7); if (context.get(variableName) === undefined) { context.set(variableName, msg.payload.toString()) } console.log("Variable: " + variableName + " value:" +msg.payload.toString())
// Use # as delimeter if (context.get("variables") === undefined) { context.set("variables", variableName) variables=variableName; } else { variables = context.get("variables") + "#" + variableName; // Append } if (context.get("values") === undefined) { context.set("values", msg.payload.toString()); values=msg.payload.toString(); } else { values = context.get("values") + "#" + msg.payload.toString(); // Append }
names = variables.split("#"); vals = values.split("#");
console.log("Names:" + JSON.stringify(names)); console.log("Vals :" + JSON.stringify(vals)); var newmsg = {}; newmsg.payload = {}; newmsg.payload.variables = names; newmsg.payload.values = vals;
if (names.length == 2) { return newmsg; }
I tested inject "readAll" twice to read them again. No problems. Do you inject anything else to client node?
My Clear node array is injected once upon deploying/restarting the flows. Then the inject nodes inject the variables once, automatically.
I didn't know if you had an internal queue, so I gave them 500 ms between injects to make sure the node can process each message before sending the next one.
My server currently is down due to power issues, but I'll share the flow when it's up again.
OK, I will check what happens with clear array if it will cause something.
Works, my flow gives error message:
I've been trying, I still have the same issue.
After a clean restart:
As you see, the first read works, but on the second it throws an error.
This is the normal output log:
Connection options:[{"securityPolicy":"1","securityMode":3,"clientCertificateManager":"2","requestedSessionTimeout":300000,"clientName":"3","endpointMustExist":false,"defaultSecureTokenLifetime":200000,"connectionStrategy":"4","keepSessionAlive":true},"http://opcfoundation.org/UA/SecurityPolicy#Basic256",{"untrustUnknownCertificate":true,"state":4,"folderPoolingInterval":5000,"_watchers":"5","_readCertificatesCalled":true,"_filenameToHash":"6","_thumbs":"7","_pending_crl_to_process":0,"queue":"8","location":"9","keySize":2048,"referenceCounter":0,"automaticallyAcceptUnknownCertificate":true},"SCHMID Preclean 1",{"maxRetry":10512000,"initialDelay":5000,"maxDelay":30000},[],{"/root/.config/node-red-opcua-nodejs/PKI/trusted/certs/[email protected][a91241125f5aaec7002578f332ea6d92fc7b681b].pem":"10","/root/.config/node-red-opcua-nodejs/PKI/trusted/certs/SchmidOpcUaServer[d04bbb7ded9be76324a2e6b8d0a8502fe42edd1a].pem":"11"},{"rejected":"12","trusted":"13","issuers":"14","crl":"15","issuersCrl":"16"},[],"/root/.config/node-red-opcua-nodejs/PKI","a91241125f5aaec7002578f332ea6d92fc7b681b","d04bbb7ded9be76324a2e6b8d0a8502fe42edd1a",{},{"a91241125f5aaec7002578f332ea6d92fc7b681b":"17","d04bbb7ded9be76324a2e6b8d0a8502fe42edd1a":"18"},{"certs":"19"},{},{},{"certificate":"20","filename":"21"},{"certificate":"22","filename":"23"},{},{"type":"24","data":"25"},"/root/.config/node-red-opcua-nodejs/PKI/trusted/certs/[email protected][a91241125f5aaec7002578f332ea6d92fc7b681b].pem",{"type":"24","data":"26"},"/root/.config/node-red-opcua-nodejs/PKI/trusted/certs/SchmidOpcUaServer[d04bbb7ded9be76324a2e6b8d0a8502fe42edd1a].pem","Buffer",[48,130,4,126,48,130,3,102,160,3,2,1,2,2,20,47,199,13,103,105,130,76,188,130,8,10,18,162,21,237,118,208,185,249,9,48,13,6,9,42,134,72,134,247,13,1,1,11,5,0,48,101,49,11,48,9,6,3,85,4,6,19,2,70,82,49,16,48,14,6,3,85,4,7,12,7,79,114,108,101,97,110,115,49,17,48,15,6,3,85,4,10,12,8,83,116,101,114,102,105,118,101,49,49,48,47,6,3,85,4,3,12,40,78,111,100,101,79,80,67,85,65,45,67,108,105,101,110,116,64,110,111,100,101,114,101,100,117,49,46,117,110,105,109,105,99,114,111,110,46,105,110,116,48,30,23,13,50,49,49,49,49,53,48,57,52,52,49,50,90,23,13,51,49,49,49,49,51,48,57,52,52,49,50,90,48,101,49,11,48,9,6,3,85,4,6,19,2,70,82,49,16,48,14,6,3,85,4,7,12,7,79,114,108,101,97,110,115,49,17,48,15,6,3,85,4,10,12,8,83,116,101,114,102,105,118,101,49,49,48,47,6,3,85,4,3,12,40,78,111,100,101,79,80,67,85,65,45,67,108,105,101,110,116,64,110,111,100,101,114,101,100,117,49,46,117,110,105,109,105,99,114,111,110,46,105,110,116,48,130,1,34,48,13,6,9,42,134,72,134,247,13,1,1,1,5,0,3,130,1,15,0,48,130,1,10,2,130,1,1,0,219,65,240,41,108,144,50,102,155,210,186,21,11,169,147,173,210,5,98,120,203,29,20,190,178,194,91,228,146,9,41,49,24,167,70,2,72,53,69,251,101,247,148,56,184,207,10,85,250,134,67,72,152,191,115,248,127,57,207,30,23,33,232,203,253,209,185,70,214,226,190,94,136,69,107,101,111,8,116,206,57,49,151,106,89,69,45,81,209,100,31,103,203,208,44,21,226,53,38,193,101,55,105,131,15,125,164,247,51,99,142,185,23,167,86,183,5,66,180,217,198,139,121,228,57,161,153,48,59,119,82,254,79,189,43,205,55,125,55,88,106,86,25,141,231,85,71,114,131,242,56,254,25,1,209,39,92,60,133,54,111,243,249,32,228,25,26,217,115,121,17,78,119,139,110,82,246,155,129,250,181,61,235,223,247,234,224,16,67,169,121,23,13,59,59,119,49,209,79,183,115,94,5,206,108,112,236,84,24,228,35,54,26,153,177,159,239,164,89,34,241,27,7,182,177,178,161,109,212,149,13,105,43,102,233,3,111,9,161,190,17,139,247,239,139,147,222,185,97,245,117,34,83,211,32,145,2,3,1,0,1,163,130,1,36,48,130,1,32,48,29,6,3,85,29,14,4,22,4,20,204,187,178,56,138,166,81,54,229,123,18,85,165,126,18,41,59,194,156,243,48,31,6,3,85,29,35,4,24,48,22,128,20,204,187,178,56,138,166,81,54,229,123,18,85,165,126,18,41,59,194,156,243,48,12,6,3,85,29,19,1,1,255,4,2,48,0,48,11,6,3,85,29,15,4,4,3,2,2,244,48,29,6,3,85,29,37,4,22,48,20,6,8,43,6,1,5,5,7,3,2,6,8,43,6,1,5,5,7,3,1,48,82,6,9,96,134,72,1,134,248,66,1,13,4,69,22,67,83,101,108,102,45,115,105,103,110,101,100,32,99,101,114,116,105,102,105,99,97,116,101,32,103,101,110,101,114,97,116,101,100,32,98,121,32,78,111,100,101,45,79,80,67,85,65,32,67,101,114,116,105,102,105,99,97,116,101,32,117,116,105,108,105,116,121,48,80,6,3,85,29,17,4,73,48,71,134,44,117,114,110,58,110,111,100,101,114,101,100,117,49,46,117,110,105,109,105,99,114,111,110,46,105,110,116,58,78,111,100,101,79,80,67,85,65,45,67,108,105,101,110,116,130,23,110,111,100,101,114,101,100,117,49,46,117,110,105,109,105,99,114,111,110,46,105,110,116,48,13,6,9,42,134,72,134,247,13,1,1,11,5,0,3,130,1,1,0,54,35,125,229,236,121,148,128,197,188,30,175,132,55,215,108,35,219,167,51,142,254,31,202,136,149,28,135,22,251,143,150,62,239,181,168,31,81,196,81,253,145,208,169,233,160,27,204,29,188,119,172,73,215,65,199,181,141,144,152,155,73,85,109,27,87,76,56,173,36,244,18,185,60,81,255,115,182,237,217,55,110,33,63,236,232,24,123,37,153,152,216,153,69,140,223,70,207,31,148,240,244,51,120,191,168,171,137,205,55,70,52,19,160,112,84,144,156,185,244,155,171,100,4,112,226,148,93,105,65,40,67,226,231,165,153,246,26,56,222,6,207,139,116,174,121,46,211,65,58,156,26,64,137,35,143,23,221,17,239,17,10,56,204,146,96,40,97,99,255,157,104,98,127,141,135,15,198,27,145,217,190,104,164,34,53,166,139,121,229,120,165,140,32,195,192,223,140,251,199,95,167,215,91,181,28,242,242,101,249,193,195,96,154,113,48,237,159,37,189,156,195,36,74,101,212,254,9,190,170,219,110,76,9,34,159,204,95,111,232,137,84,119,147,123,197,91,242,190,164,75,223,229,59,238,211],[48,130,4,150,48,130,3,126,160,3,2,1,2,2,17,0,208,36,178,19,197,14,118,71,146,182,84,124,142,52,251,8,48,13,6,9,42,134,72,134,247,13,1,1,11,5,0,48,97,49,26,48,24,6,10,9,146,38,137,147,242,44,100,1,25,22,10,78,50,53,45,55,48,55,57,55,53,49,11,48,9,6,3,85,4,6,19,2,68,69,49,26,48,24,6,3,85,4,10,12,17,71,101,98,114,46,32,83,67,72,77,73,68,32,71,109,98,72,49,26,48,24,6,3,85,4,3,12,17,83,99,104,109,105,100,79,112,99,85,97,83,101,114,118,101,114,48,30,23,13,49,57,48,52,48,50,48,55,51,52,51,49,90,23,13,50,57,48,50,48,56,48,55,51,52,51,49,90,48,97,49,26,48,24,6,10,9,146,38,137,147,242,44,100,1,25,22,10,78,50,53,45,55,48,55,57,55,53,49,11,48,9,6,3,85,4,6,19,2,68,69,49,26,48,24,6,3,85,4,10,12,17,71,101,98,114,46,32,83,67,72,77,73,68,32,71,109,98,72,49,26,48,24,6,3,85,4,3,12,17,83,99,104,109,105,100,79,112,99,85,97,83,101,114,118,101,114,48,130,1,34,48,13,6,9,42,134,72,134,247,13,1,1,1,5,0,3,130,1,15,0,48,130,1,10,2,130,1,1,0,197,30,22,234,126,47,238,75,117,13,140,89,198,163,246,231,2,231,213,20,81,223,63,140,4,166,237,124,211,152,209,110,25,243,54,103,185,248,36,167,87,92,187,193,31,146,44,230,50,236,8,208,104,250,75,181,74,187,215,41,66,252,6,53,118,131,57,159,183,29,222,54,53,150,41,51,166,242,207,161,36,112,68,183,248,227,98,144,182,139,0,170,80,29,55,182,14,96,139,116,140,39,6,48,98,15,174,18,172,184,198,89,102,14,13,171,210,133,202,189,254,113,54,12,42,61,7,12,72,223,51,129,196,42,11,222,188,71,63,92,14,215,243,106,190,50,120,182,21,184,240,204,26,169,216,242,192,243,8,221,205,197,189,38,35,238,17,138,8,0,69,2,29,202,210,254,130,237,238,120,1,74,9,139,186,93,184,188,228,93,93,132,61,38,208,248,199,121,3,243,163,65,124,208,19,246,17,84,15,161,124,250,250,64,178,70,70,189,70,41,10,67,59,101,159,97,185,166,140,224,126,135,87,205,249,92,253,68,220,240,233,235,179,120,88,130,88,107,109,7,88,144,104,63,90,211,2,3,1,0,1,163,130,1,71,48,130,1,67,48,29,6,3,85,29,14,4,22,4,20,165,173,52,56,14,34,70,69,5,214,207,191,233,186,119,193,170,172,248,194,48,129,155,6,3,85,29,35,4,129,147,48,129,144,128,20,165,173,52,56,14,34,70,69,5,214,207,191,233,186,119,193,170,172,248,194,161,101,164,99,48,97,49,26,48,24,6,10,9,146,38,137,147,242,44,100,1,25,22,10,78,50,53,45,55,48,55,57,55,53,49,11,48,9,6,3,85,4,6,19,2,68,69,49,26,48,24,6,3,85,4,10,12,17,71,101,98,114,46,32,83,67,72,77,73,68,32,71,109,98,72,49,26,48,24,6,3,85,4,3,12,17,83,99,104,109,105,100,79,112,99,85,97,83,101,114,118,101,114,130,17,0,208,36,178,19,197,14,118,71,146,182,84,124,142,52,251,8,48,18,6,3,85,29,19,1,1,255,4,8,48,6,1,1,255,2,1,0,48,14,6,3,85,29,15,1,1,255,4,4,3,2,2,244,48,32,6,3,85,29,37,1,1,255,4,22,48,20,6,8,43,6,1,5,5,7,3,1,6,8,43,6,1,5,5,7,3,2,48,62,6,3,85,29,17,4,55,48,53,134,39,117,114,110,58,110,50,53,45,55,48,55,57,55,53,58,83,99,104,109,105,100,58,83,99,104,109,105,100,79,112,99,85,97,83,101,114,118,101,114,130,10,78,50,53,45,55,48,55,57,55,53,48,13,6,9,42,134,72,134,247,13,1,1,11,5,0,3,130,1,1,0,82,42,192,57,235,140,142,143,141,212,110,239,214,155,112,175,48,75,185,48,195,248,204,5,12,96,198,195,98,42,28,29,190,189,172,107,245,14,80,202,164,226,180,230,86,140,163,152,102,33,54,39,55,171,152,50,212,16,123,85,16,58,78,252,186,153,81,11,191,13,66,175,15,46,95,128,32,9,113,75,196,232,219,253,164,193,38,218,128,165,181,87,25,149,28,251,52,70,110,82,119,141,26,56,225,4,76,124,66,33,153,130,176,82,249,47,234,91,215,208,159,56,213,125,196,171,221,175,78,196,197,92,229,199,67,163,87,195,67,128,164,60,87,86,165,98,121,208,226,221,204,246,253,14,86,237,105,24,120,253,58,106,174,39,10,114,62,67,65,43,67,119,191,4,182,93,36,82,151,249,140,76,161,153,160,86,2,81,159,177,188,70,94,232,244,22,117,25,162,205,28,221,111,139,191,4,118,73,209,101,201,85,228,186,24,245,194,149,243,23,145,122,241,183,116,75,131,16,153,34,158,145,141,29,203,175,190,110,102,73,66,144,172,171,78,22,185,137,135,155,200,218,141,183,151,242]] EndPoint: [{"id":"1","type":"2","_closeCallbacks":"3","_inputCallback":null,"_inputCallbacks":null,"wires":"4","_wireCount":0,"credentials":"5","endpoint":"6","securityPolicy":"7","securityMode":"8","login":false,"user":null,"password":null},"c280f55a.54a418","OpcUa-Endpoint",[],[],{},"opc.tcp://10.94.10.50:4840/","Basic256","SignAndEncrypt"] UserIdentity: [{"type":0}] Client status: create client Connecting to opc.tcp://10.94.10.50:4840/ Client status: connecting Exact endpointUrl: opc.tcp://10.94.10.50:4840/ hostname: noderedu1.unimicron.int Not connected, current status:connecting Not connected, current status:connecting Connected to opc.tcp://10.94.10.50:4840/ Create session ... Create session with userIdentity: [{"type":0}] session active Client status: session active Action on input:readmultiple Item from Topic: clearitems session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... clear items... Client status: clear items Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01MA01MH01#0_E_B.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01SE01MG01#0_E_B.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01SE01MH14#0_BA_B.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01SE01MN05#1_X_DW.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01SE01MN05#0_X_DW.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01SE01GH01#0_BA_Y.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01SE01GH01#0_E_B.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01SE01MS02#0_W_I.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01SE01MS02#0_OW_I.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01SE01MS02#0_OG_I.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: ns=2;s=Machine.M01SE01MY13#0_E_B.Value session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Client status: nodeId stored Action on input:readmultiple Item from Topic: readmultiple session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Reading items: [["1","2","3","4","5","6","7","8","9","10","11"],{"nodeId":"12","attributeId":13,"TimestampsToReturn":2},{"nodeId":"13","attributeId":13,"TimestampsToReturn":2},{"nodeId":"14","attributeId":13,"TimestampsToReturn":2},{"nodeId":"15","attributeId":13,"TimestampsToReturn":2},{"nodeId":"16","attributeId":13,"TimestampsToReturn":2},{"nodeId":"17","attributeId":13,"TimestampsToReturn":2},{"nodeId":"18","attributeId":13,"TimestampsToReturn":2},{"nodeId":"19","attributeId":13,"TimestampsToReturn":2},{"nodeId":"20","attributeId":13,"TimestampsToReturn":2},{"nodeId":"21","attributeId":13,"TimestampsToReturn":2},{"nodeId":"22","attributeId":13,"TimestampsToReturn":2},"ns=2;s=Machine.M01MA01MH01#0_E_B.Value","ns=2;s=Machine.M01SE01MG01#0_E_B.Value","ns=2;s=Machine.M01SE01MH14#0_BA_B.Value","ns=2;s=Machine.M01SE01MN05#1_X_DW.Value","ns=2;s=Machine.M01SE01MN05#0_X_DW.Value","ns=2;s=Machine.M01SE01GH01#0_BA_Y.Value","ns=2;s=Machine.M01SE01GH01#0_E_B.Value","ns=2;s=Machine.M01SE01MS02#0_W_I.Value","ns=2;s=Machine.M01SE01MS02#0_OW_I.Value","ns=2;s=Machine.M01SE01MS02#0_OG_I.Value","ns=2;s=Machine.M01SE01MY13#0_E_B.Value"] Client status: active multiple reading Node : readmultiple { /* DataValue */ value: Variant(Scalar<Boolean>, value: false) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-25T09:05:54.552Z $ 000.000.000 } Value : false DataType: 1 (Boolean) Status-Code:Good (0x00000) Node : readmultiple { /* DataValue */ value: Variant(Scalar<Boolean>, value: false) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-25T09:05:54.552Z $ 000.000.000 } Value : false DataType: 1 (Boolean) Status-Code:Good (0x00000) Node : readmultiple { /* DataValue */ value: Variant(Scalar<Boolean>, value: false) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-16T13:01:16.584Z $ 001.000.000 } Value : false DataType: 1 (Boolean) Status-Code:Good (0x00000) Node : readmultiple { /* DataValue */ value: Variant(Scalar<UInt32>, value: 1061181) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-25T09:00:25.780Z $ 000.000.000 } Value : 1061181 DataType: 7 (UInt32) Status-Code:Good (0x00000) Node : readmultiple { /* DataValue */ value: Variant(Scalar<UInt32>, value: 285) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-25T09:00:25.780Z $ 000.000.000 } Value : 285 DataType: 7 (UInt32) Status-Code:Good (0x00000) Node : readmultiple { /* DataValue */ value: Variant(Scalar<Byte>, value: 2) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-16T13:01:16.609Z $ 001.000.000 } Value : 2 DataType: 3 (Byte) Status-Code:Good (0x00000) Node : readmultiple { /* DataValue */ value: Variant(Scalar<Boolean>, value: false) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-25T09:05:54.552Z $ 000.000.000 } Value : false DataType: 1 (Boolean) Status-Code:Good (0x00000) Node : readmultiple { /* DataValue */ value: Variant(Scalar<Double>, value: 1.9) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-16T13:01:16.699Z $ 001.000.000 } Value : 1.9 DataType: 11 (Double) Status-Code:Good (0x00000) Node : readmultiple { /* DataValue */ value: Variant(Scalar<Double>, value: 0.2) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-16T13:01:16.699Z $ 001.000.000 } Value : 0.2 DataType: 11 (Double) Status-Code:Good (0x00000) Node : readmultiple { /* DataValue */ value: Variant(Scalar<Double>, value: 0.3) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-16T13:01:16.699Z $ 001.000.000 } Value : 0.3 DataType: 11 (Double) Status-Code:Good (0x00000) Node : readmultiple { /* DataValue */ value: Variant(Scalar<Boolean>, value: false) statusCode: Good (0x00000) serverTimestamp: 2021-11-25T09:37:45.301Z $ 000.000.000 sourceTimestamp: 2021-11-25T08:26:26.357Z $ 000.000.000 } Value : false DataType: 1 (Boolean) Status-Code:Good (0x00000) Action on input:readmultiple Item from Topic: readmultiple session Id: ns=1;g=3606B7A9-9009-49A5-A382-37055EF08509 read multiple... Reading items: [["1","2","3","4","5","6","7","8","9","10","11"],{"nodeId":"12","attributeId":13,"TimestampsToReturn":2},{"nodeId":"13","attributeId":13,"TimestampsToReturn":2},{"nodeId":"14","attributeId":13,"TimestampsToReturn":2},{"nodeId":"15","attributeId":13,"TimestampsToReturn":2},{"nodeId":"16","attributeId":13,"TimestampsToReturn":2},{"nodeId":"17","attributeId":13,"TimestampsToReturn":2},{"nodeId":"18","attributeId":13,"TimestampsToReturn":2},{"nodeId":"19","attributeId":13,"TimestampsToReturn":2},{"nodeId":"20","attributeId":13,"TimestampsToReturn":2},{"nodeId":"21","attributeId":13,"TimestampsToReturn":2},{"nodeId":"22","attributeId":13,"TimestampsToReturn":2},"machine_started","m01_full","m01_jam","machine_abs_count","machine_rel_count","machine_speed_set","machine_conv_enabled","machine_speed_actual","machine_speed_delta_warning","machine_speed_delta_alarm","machine_standby"]
And this is the error log:
SCHMID Preclean 1: Create Client: [{"securityPolicy":"1","securityMode":3,"clientCertificateManager":"2","requestedSessionTimeout":300000,"clientName":"3","endpointMustExist":false,"defaultSecureTokenLifetime":200000,"connectionStrategy":"4","keepSessionAlive":true},"http://opcfoundation.org/UA/SecurityPolicy#Basic256",{"untrustUnknownCertificate":true,"state":4,"folderPoolingInterval":5000,"_watchers":"5","_readCertificatesCalled":true,"_filenameToHash":"6","_thumbs":"7","_pending_crl_to_process":0,"queue":"8","location":"9","keySize":2048,"referenceCounter":0,"automaticallyAcceptUnknownCertificate":true},"SCHMID Preclean 1",{"maxRetry":10512000,"initialDelay":5000,"maxDelay":30000},[],{"/root/.config/node-red-opcua-nodejs/PKI/trusted/certs/[email protected][a91241125f5aaec7002578f332ea6d92fc7b681b].pem":"10","/root/.config/node-red-opcua-nodejs/PKI/trusted/certs/SchmidOpcUaServer[d04bbb7ded9be76324a2e6b8d0a8502fe42edd1a].pem":"11"},{"rejected":"12","trusted":"13","issuers":"14","crl":"15","issuersCrl":"16"},[],"/root/.config/node-red-opcua-nodejs/PKI","a91241125f5aaec7002578f332ea6d92fc7b681b","d04bbb7ded9be76324a2e6b8d0a8502fe42edd1a",{},{"a91241125f5aaec7002578f332ea6d92fc7b681b":"17","d04bbb7ded9be76324a2e6b8d0a8502fe42edd1a":"18"},{"certs":"19"},{},{},{"certificate":"20","filename":"21"},{"certificate":"22","filename":"23"},{},{"type":"24","data":"25"},"/root/.config/node-red-opcua-nodejs/PKI/trusted/certs/[email protected][a91241125f5aaec7002578f332ea6d92fc7b681b].pem",{"type":"24","data":"26"},"/root/.config/node-red-opcua-nodejs/PKI/trusted/certs/SchmidOpcUaServer[d04bbb7ded9be76324a2e6b8d0a8502fe42edd1a].pem","Buffer",[48,130,4,126,48,130,3,102,160,3,2,1,2,2,20,47,199,13,103,105,130,76,188,130,8,10,18,162,21,237,118,208,185,249,9,48,13,6,9,42,134,72,134,247,13,1,1,11,5,0,48,101,49,11,48,9,6,3,85,4,6,19,2,70,82,49,16,48,14,6,3,85,4,7,12,7,79,114,108,101,97,110,115,49,17,48,15,6,3,85,4,10,12,8,83,116,101,114,102,105,118,101,49,49,48,47,6,3,85,4,3,12,40,78,111,100,101,79,80,67,85,65,45,67,108,105,101,110,116,64,110,111,100,101,114,101,100,117,49,46,117,110,105,109,105,99,114,111,110,46,105,110,116,48,30,23,13,50,49,49,49,49,53,48,57,52,52,49,50,90,23,13,51,49,49,49,49,51,48,57,52,52,49,50,90,48,101,49,11,48,9,6,3,85,4,6,19,2,70,82,49,16,48,14,6,3,85,4,7,12,7,79,114,108,101,97,110,115,49,17,48,15,6,3,85,4,10,12,8,83,116,101,114,102,105,118,101,49,49,48,47,6,3,85,4,3,12,40,78,111,100,101,79,80,67,85,65,45,67,108,105,101,110,116,64,110,111,100,101,114,101,100,117,49,46,117,110,105,109,105,99,114,111,110,46,105,110,116,48,130,1,34,48,13,6,9,42,134,72,134,247,13,1,1,1,5,0,3,130,1,15,0,48,130,1,10,2,130,1,1,0,219,65,240,41,108,144,50,102,155,210,186,21,11,169,147,173,210,5,98,120,203,29,20,190,178,194,91,228,146,9,41,49,24,167,70,2,72,53,69,251,101,247,148,56,184,207,10,85,250,134,67,72,152,191,115,248,127,57,207,30,23,33,232,203,253,209,185,70,214,226,190,94,136,69,107,101,111,8,116,206,57,49,151,106,89,69,45,81,209,100,31,103,203,208,44,21,226,53,38,193,101,55,105,131,15,125,164,247,51,99,142,185,23,167,86,183,5,66,180,217,198,139,121,228,57,161,153,48,59,119,82,254,79,189,43,205,55,125,55,88,106,86,25,141,231,85,71,114,131,242,56,254,25,1,209,39,92,60,133,54,111,243,249,32,228,25,26,217,115,121,17,78,119,139,110,82,246,155,129,250,181,61,235,223,247,234,224,16,67,169,121,23,13,59,59,119,49,209,79,183,115,94,5,206,108,112,236,84,24,228,35,54,26,153,177,159,239,164,89,34,241,27,7,182,177,178,161,109,212,149,13,105,43,102,233,3,111,9,161,190,17,139,247,239,139,147,222,185,97,245,117,34,83,211,32,145,2,3,1,0,1,163,130,1,36,48,130,1,32,48,29,6,3,85,29,14,4,22,4,20,204,187,178,56,138,166,81,54,229,123,18,85,165,126,18,41,59,194,156,243,48,31,6,3,85,29,35,4,24,48,22,128,20,204,187,178,56,138,166,81,54,229,123,18,85,165,126,18,41,59,194,156,243,48,12,6,3,85,29,19,1,1,255,4,2,48,0,48,11,6,3,85,29,15,4,4,3,2,2,244,48,29,6,3,85,29,37,4,22,48,20,6,8,43,6,1,5,5,7,3,2,6,8,43,6,1,5,5,7,3,1,48,82,6,9,96,134,72,1,134,248,66,1,13,4,69,22,67,83,101,108,102,45,115,105,103,110,101,100,32,99,101,114,116,105,102,105,99,97,116,101,32,103,101,110,101,114,97,116,101,100,32,98,121,32,78,111,100,101,45,79,80,67,85,65,32,67,101,114,116,105,102,105,99,97,116,101,32,117,116,105,108,105,116,121,48,80,6,3,85,29,17,4,73,48,71,134,44,117,114,110,58,110,111,100,101,114,101,100,117,49,46,117,110,105,109,105,99,114,111,110,46,105,110,116,58,78,111,100,101,79,80,67,85,65,45,67,108,105,101,110,116,130,23,110,111,100,101,114,101,100,117,49,46,117,110,105,109,105,99,114,111,110,46,105,110,116,48,13,6,9,42,134,72,134,247,13,1,1,11,5,0,3,130,1,1,0,54,35,125,229,236,121,148,128,197,188,30,175,132,55,215,108,35,219,167,51,142,254,31,202,136,149,28,135,22,251,143,150,62,239,181,168,31,81,196,81,253,145,208,169,233,160,27,204,29,188,119,172,73,215,65,199,181,141,144,152,155,73,85,109,27,87,76,56,173,36,244,18,185,60,81,255,115,182,237,217,55,110,33,63,236,232,24,123,37,153,152,216,153,69,140,223,70,207,31,148,240,244,51,120,191,168,171,137,205,55,70,52,19,160,112,84,144,156,185,244,155,171,100,4,112,226,148,93,105,65,40,67,226,231,165,153,246,26,56,222,6,207,139,116,174,121,46,211,65,58,156,26,64,137,35,143,23,221,17,239,17,10,56,204,146,96,40,97,99,255,157,104,98,127,141,135,15,198,27,145,217,190,104,164,34,53,166,139,121,229,120,165,140,32,195,192,223,140,251,199,95,167,215,91,181,28,242,242,101,249,193,195,96,154,113,48,237,159,37,189,156,195,36,74,101,212,254,9,190,170,219,110,76,9,34,159,204,95,111,232,137,84,119,147,123,197,91,242,190,164,75,223,229,59,238,211],[48,130,4,150,48,130,3,126,160,3,2,1,2,2,17,0,208,36,178,19,197,14,118,71,146,182,84,124,142,52,251,8,48,13,6,9,42,134,72,134,247,13,1,1,11,5,0,48,97,49,26,48,24,6,10,9,146,38,137,147,242,44,100,1,25,22,10,78,50,53,45,55,48,55,57,55,53,49,11,48,9,6,3,85,4,6,19,2,68,69,49,26,48,24,6,3,85,4,10,12,17,71,101,98,114,46,32,83,67,72,77,73,68,32,71,109,98,72,49,26,48,24,6,3,85,4,3,12,17,83,99,104,109,105,100,79,112,99,85,97,83,101,114,118,101,114,48,30,23,13,49,57,48,52,48,50,48,55,51,52,51,49,90,23,13,50,57,48,50,48,56,48,55,51,52,51,49,90,48,97,49,26,48,24,6,10,9,146,38,137,147,242,44,100,1,25,22,10,78,50,53,45,55,48,55,57,55,53,49,11,48,9,6,3,85,4,6,19,2,68,69,49,26,48,24,6,3,85,4,10,12,17,71,101,98,114,46,32,83,67,72,77,73,68,32,71,109,98,72,49,26,48,24,6,3,85,4,3,12,17,83,99,104,109,105,100,79,112,99,85,97,83,101,114,118,101,114,48,130,1,34,48,13,6,9,42,134,72,134,247,13,1,1,1,5,0,3,130,1,15,0,48,130,1,10,2,130,1,1,0,197,30,22,234,126,47,238,75,117,13,140,89,198,163,246,231,2,231,213,20,81,223,63,140,4,166,237,124,211,152,209,110,25,243,54,103,185,248,36,167,87,92,187,193,31,146,44,230,50,236,8,208,104,250,75,181,74,187,215,41,66,252,6,53,118,131,57,159,183,29,222,54,53,150,41,51,166,242,207,161,36,112,68,183,248,227,98,144,182,139,0,170,80,29,55,182,14,96,139,116,140,39,6,48,98,15,174,18,172,184,198,89,102,14,13,171,210,133,202,189,254,113,54,12,42,61,7,12,72,223,51,129,196,42,11,222,188,71,63,92,14,215,243,106,190,50,120,182,21,184,240,204,26,169,216,242,192,243,8,221,205,197,189,38,35,238,17,138,8,0,69,2,29,202,210,254,130,237,238,120,1,74,9,139,186,93,184,188,228,93,93,132,61,38,208,248,199,121,3,243,163,65,124,208,19,246,17,84,15,161,124,250,250,64,178,70,70,189,70,41,10,67,59,101,159,97,185,166,140,224,126,135,87,205,249,92,253,68,220,240,233,235,179,120,88,130,88,107,109,7,88,144,104,63,90,211,2,3,1,0,1,163,130,1,71,48,130,1,67,48,29,6,3,85,29,14,4,22,4,20,165,173,52,56,14,34,70,69,5,214,207,191,233,186,119,193,170,172,248,194,48,129,155,6,3,85,29,35,4,129,147,48,129,144,128,20,165,173,52,56,14,34,70,69,5,214,207,191,233,186,119,193,170,172,248,194,161,101,164,99,48,97,49,26,48,24,6,10,9,146,38,137,147,242,44,100,1,25,22,10,78,50,53,45,55,48,55,57,55,53,49,11,48,9,6,3,85,4,6,19,2,68,69,49,26,48,24,6,3,85,4,10,12,17,71,101,98,114,46,32,83,67,72,77,73,68,32,71,109,98,72,49,26,48,24,6,3,85,4,3,12,17,83,99,104,109,105,100,79,112,99,85,97,83,101,114,118,101,114,130,17,0,208,36,178,19,197,14,118,71,146,182,84,124,142,52,251,8,48,18,6,3,85,29,19,1,1,255,4,8,48,6,1,1,255,2,1,0,48,14,6,3,85,29,15,1,1,255,4,4,3,2,2,244,48,32,6,3,85,29,37,1,1,255,4,22,48,20,6,8,43,6,1,5,5,7,3,1,6,8,43,6,1,5,5,7,3,2,48,62,6,3,85,29,17,4,55,48,53,134,39,117,114,110,58,110,50,53,45,55,48,55,57,55,53,58,83,99,104,109,105,100,58,83,99,104,109,105,100,79,112,99,85,97,83,101,114,118,101,114,130,10,78,50,53,45,55,48,55,57,55,53,48,13,6,9,42,134,72,134,247,13,1,1,11,5,0,3,130,1,1,0,82,42,192,57,235,140,142,143,141,212,110,239,214,155,112,175,48,75,185,48,195,248,204,5,12,96,198,195,98,42,28,29,190,189,172,107,245,14,80,202,164,226,180,230,86,140,163,152,102,33,54,39,55,171,152,50,212,16,123,85,16,58,78,252,186,153,81,11,191,13,66,175,15,46,95,128,32,9,113,75,196,232,219,253,164,193,38,218,128,165,181,87,25,149,28,251,52,70,110,82,119,141,26,56,225,4,76,124,66,33,153,130,176,82,249,47,234,91,215,208,159,56,213,125,196,171,221,175,78,196,197,92,229,199,67,163,87,195,67,128,164,60,87,86,165,98,121,208,226,221,204,246,253,14,86,237,105,24,120,253,58,106,174,39,10,114,62,67,65,43,67,119,191,4,182,93,36,82,151,249,140,76,161,153,160,86,2,81,159,177,188,70,94,232,244,22,117,25,162,205,28,221,111,139,191,4,118,73,209,101,201,85,228,186,24,245,194,149,243,23,145,122,241,183,116,75,131,16,153,34,158,145,141,29,203,175,190,110,102,73,66,144,172,171,78,22,185,137,135,155,200,218,141,183,151,242]] ConnectionError: Connection is closed. at Request._query (/root/.node-red/node_modules/mssql/lib/base/request.js:495:37) at Request._query (/root/.node-red/node_modules/mssql/lib/tedious/request.js:367:11) at /root/.node-red/node_modules/mssql/lib/base/request.js:459:12 at new Promise (<anonymous>) at Request.query (/root/.node-red/node_modules/mssql/lib/base/request.js:458:12) at connection.node.execSql (/root/.node-red/node_modules/node-red-contrib-mssql-plus/src/mssql.js:423:40) at doSQL (/root/.node-red/node_modules/node-red-contrib-mssql-plus/src/mssql.js:779:25) at /root/.node-red/node_modules/node-red-contrib-mssql-plus/src/mssql.js:765:17 at runMicrotasks (<anonymous>) at runNextTicks (internal/process/task_queues.js:60:5) at processImmediate (internal/timers.js:437:9) { code: 'ECONNCLOSED' } ConnectionError: Connection is closed. at Request._query (/root/.node-red/node_modules/mssql/lib/base/request.js:495:37) at Request._query (/root/.node-red/node_modules/mssql/lib/tedious/request.js:367:11) at /root/.node-red/node_modules/mssql/lib/base/request.js:459:12 at new Promise (<anonymous>) at Request.query (/root/.node-red/node_modules/mssql/lib/base/request.js:458:12) at connection.node.execSql (/root/.node-red/node_modules/node-red-contrib-mssql-plus/src/mssql.js:423:40) at doSQL (/root/.node-red/node_modules/node-red-contrib-mssql-plus/src/mssql.js:779:25) at /root/.node-red/node_modules/node-red-contrib-mssql-plus/src/mssql.js:765:17 at runMicrotasks (<anonymous>) at runNextTicks (internal/process/task_queues.js:60:5) at processImmediate (internal/timers.js:437:9) { code: 'ECONNCLOSED' } ConnectionError: Connection is closed. at Request._query (/root/.node-red/node_modules/mssql/lib/base/request.js:495:37) at Request._query (/root/.node-red/node_modules/mssql/lib/tedious/request.js:367:11) at /root/.node-red/node_modules/mssql/lib/base/request.js:459:12 at new Promise (<anonymous>) at Request.query (/root/.node-red/node_modules/mssql/lib/base/request.js:458:12) at connection.node.execSql (/root/.node-red/node_modules/node-red-contrib-mssql-plus/src/mssql.js:423:40) at doSQL (/root/.node-red/node_modules/node-red-contrib-mssql-plus/src/mssql.js:779:25) at /root/.node-red/node_modules/node-red-contrib-mssql-plus/src/mssql.js:765:17 at runMicrotasks (<anonymous>) at runNextTicks (internal/process/task_queues.js:60:5) at processImmediate (internal/timers.js:437:9) { code: 'ECONNCLOSED' } (node:6248) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 acquire listeners added to [Pool]. Use emitter.setMaxListeners() to increase limit
If I clean the reading queue everytime, add all the nodes, and trigger the multiple read, it works. Otherwise, it doesn't.
But error seems to be in the mssql interface?
ConnectionError: Connection is closed. at Request._query (/root/.node-red/node_modules/mssql/lib/base/request.js:495:37) at Request._query (/root/.node-red/node_modules/mssql/lib/tedious/request.js:367:11) at /root/.node-red/node_modules/mssql/lib/base/request.js:459:12 at new Promise (
My OPC-UA flow is completely unrelated to the mssql interface, it is not connected to it and it does not depend on it.
If there is a problem with the MSSQL, it is from another group of machines, that supplier made a mess with their DB. In any case, I still can read it.
The problem I have now is that I do not have an efficient way of reading multiple variables from the OPC-UA interface for these other production lines. In order to do so, I still have to clear and initialize the variables every single time.
I mean, after my second inject with "readmultiple", my catch error node focused on the OPCUA client node generates an output where the error message is:
Error: String cannot be coerced to a nodeId : machine_started at coerceNodeId (/root/.node-red/node_modules/node-opcua-nodeid/dist/nodeid.js:250:19) at resolveNodeId (/root/.node-red/node_modules/node-opcua-nodeid/dist/nodeid.js:343:18) at ClientSessionImpl.read (/root/.node-red/node_modules/node-opcua-client/dist/private/client_session_impl.js:542:65) at ClientSessionImpl.read (/root/.node-red/node_modules/thenify/index.js:65:46) at ClientSessionImpl.read (/root/.node-red/node_modules/node-opcua-client/dist/private/client_session_impl.js:515:25) at ClientSessionImpl.read (/root/.node-red/node_modules/thenify/index.js:65:46) at readmultiple_action_input (/root/.node-red/node_modules/node-red-contrib-opcua/opcua/102-opcuaclient.js:730:22) at OpcUaClientNode.processInputMsg [as _inputCallback] (/root/.node-red/node_modules/node-red-contrib-opcua/opcua/102-opcuaclient.js:538:11) at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/...
Hmm cannot check code line as you have now older version running (102-opcuaclient.js: 730).
Input msg.topic should be nodeId
String machine_started is not valid nodeId as it doesn´t have ns=1;s=
Can you install latest version to check code and rerun to get correct code line into the error message?
machine_started is the name of the node where the error occurs:
It is also the first variable in the list. I already updated to the last version and same thing happens. This is the output of the catch error node in node-red:
{"_msgid":"59beee0d36730a37","payload":"","topic":"readmultiple","error":{"message":"Error: String cannot be coerced to a nodeId : machine_started","source":{"id":"95c94d51.0c6be","type":"OpcUa-Client","name":"SCHMID Preclean 1","count":1},"stack":"Error: String cannot be coerced to a nodeId : machine_started\n at coerceNodeId (/root/.node-red/node_modules/node-opcua-nodeid/dist/nodeid.js:257:19)\n at resolveNodeId (/root/.node-red/node_modules/node-opcua-nodeid/dist/nodeid.js:350:18)\n at ClientSessionImpl.read (/root/.node-red/node_modules/node-opcua-client/dist/private/client_session_impl.js:542:65)\n at ClientSessionImpl.read (/root/.node-red/node_modules/thenify/index.js:65:46)\n at ClientSessionImpl.read (/root/.node-red/node_modules/node-opcua-client/dist/private/client_session_impl.js:515:25)\n at ClientSessionImpl.read (/root/.node-red/node_modules/thenify/index.js:65:46)\n at readmultiple_action_input (/root/.node-red/node_modules/node-red-contrib-opcua/opcua/102-opcuaclient.js:818:22)\n at OpcUaClientNode.processInputMsg [as _inputCallback] (/root/.node-red/node_modules/node-red-contrib-opcua/opcua/102-opcuaclient.js:541:11)\n at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/..."}}
Stands to reason that if I had configured the OPC-UA node tag in the wrong way, it would never be able to read the values. As it is now, it works just ONCE after adding the variables. If I then clear the list and add the variables again, I can read them another time, but only once.
So in order to work, my flow should be like this:
- Clear the nodeID array
- Add all the nodeIDs that I want
- send the readmultiple command
- OR -
- Forget about reading multiple items, and just send n single reads to OPC-UA, which probably is worse, performance-wise.
Looks for me that flow mixes msg.topic and msg.name can you check your flow?
Again, this is my flow:
This is the full message I inject to add the first nodeID (the one named machine_started):
The rest of the nodeIDs are the same, just changing the nodeID string.
This is what I inject to read the multiple values:
After I get the messages, I replace each nodeID by the variable name using the String node, then I join all the messages, and I get the following output:
If then I inject the same "readmultiple" message as I did, I get the error again. See the debug output:
In this msg topic is correct:
Here is the wrong one (before msg.topic readmultiple):
Can you add node that will filter out other topics than readmultiple/clearitems and those with msg.topic,substring(0,2) === "ns"
And if you inject topic = "readmultiple" and payload = "ALL" you will get all values in one msg.
Here is the wrong one (before msg.topic readmultiple):
That is the processed output from the first readmultiple command. In the detailed explanation you can see the output timestamp.
Can you add to flow debug all that is injected into the client node? Just to check that msg topic is always nodeId.
As action readmultiple will store all msg with topic into the array calling actual session.read(items) will crash if there is any other than valid nodeId stored into the items.
I can add there extra check to validate each msg.topic that it is valid nodeId. I will do this later today with other fix.
Okay, now I have no idea what was wrong.
I simplified the flow, just getting the raw output of the OPC-UA node, and now it's working.
Since I am injecting exactly the same as before, I have no idea what was wrong in it. I also tested the "ALL" option as you suggested, and it gives me the array of values and the array of items.
Now I have to figure out how to replace the strings by human-readable variable names. Maybe in a future update, you could add a variable name to the OPC-Item node, that allows the user to specify a string name that can be used later to create a key/value pair?
I'm going to write a function node to get an output like the one I refer to, then another one to combine key/pairs into an object, for a tidier handling. If you're interested, I can share it. I know it's nothing to write home, but the work will be done anyways.
Ack good that you found it. I have Digital Twin under work. I will do just needed fixes to node-red-contrib-opcua.
Hi, have you considered including the possibility to add several items from one node, a bit like the S7 node does?
You configure each endpoint with the variables you want to read from it, it looks like this:
Alternatively, there is the option to import/export the endpoints as a csv file, like this one:
DB13,X20.4;downstream_ready DB13,X22.0;conv1_in DB13,X22.1;conv1_slow DB13,X22.2;conv1_stop DB13,X22.3;conv1_out DB13,X22.4;conv1_occupied DB13,X58.0;conv2_in DB13,X58.1;conv2_slow DB13,X58.2;conv2_stop DB13,X58.3;conv2_out DB13,X58.4;conv2_occupied DB13,X94.0;bridge_down_CP DB13,X94.1;bridge_down_MT DB13,X94.2;conv3_in DB13,X94.3;conv3_slow DB13,X94.4;conv3_stop DB13,X94.5;conv3_out DB13,X94.6;conv3_occupied DB13,X96.0;bridge_REQ_CP DB13,X96.1;bridge_REQ_MT DB13,X114.0;bridge_cyl1_locked DB13,X114.1;bridge_cyl1_unlocked DB13,X114.2;bridge_cyl2_locked DB13,X114.3;bridge_cyl2_unlocked DB207,X4.3;homing DB207,X4.4;cyclestop DB207,INT10;opmode DB231,X0.1;ready DB2303,X36.3;bridge_open
I was thinking that it could be either this, or a JSON string with each variable (whatever format you prefer, but that it was easier to edit). Allowing to assign variable names to the OPC-UA nodes would save us from having to add them like this:
And then filter the nodes like this:
At the moment I have one of the machines that requires more than 1000 lines of code only for the if (){}else if ()... to filter all the variables.
Again, if you have an idea on how to do it and you think you could use some help, I don't consider myself a specially good programmer, but collaborating in something like this would also save me some work down the road, so whatever I can do, I will.
OK, I will take a look to that node if I could add similar node to handle read/write multiple.
Question: Which S7 package contains "Variable list" feature?
Question: Which S7 package contains "Variable list" feature?
node-red-contrib-s7
p.s. thanks for your work <3