OPC UA Client all variables in a single message

Hi, I'm using the library node-red-contrib-opcua to read more data from an OPC UA server.
But all the variables read are sent from the node OPC UA Client once for time. There is a way to have all the variables in a message like:

msg.vatiables{variable1, variable2, variable3}

If possible, receive only the modified variables and not all as the Subscription action

Look readMultiple action, folder examples and file OPCUA-TEST-NODES.json

hi mikakaraila,
thanks for your reply, this is the example?
This is a really a big flow what should I see in this example?

As @mikakaraila said, you have to use the READ MULTIPLE option in the OPC-UA client node.

This is the structure of my current OPC-UA flows:

You'll see that when I start the flows, I'll inject a Clear NodeId array message, and a bit later, I'll inject another msg to add all the items. That msg triggers a subflow that will add every NodeId one by one, because the OPC-UA client node can't import NodeId lists by itself (yet). It can be tricky to do when you have to read 250+ NodeId from one machine (and you have several of those, each one with different nodeIDs).

Onbe you have made sure the array is clear and have readded all the NodeIDs, you can send ReadMultiple messages to receive an array of objects (an object for each NodeId).

Then you will have to process the array, extracting the values by NodeId, and you'll be able to put them in a single JSON, or just leave them in the array. What I do in my Data subflow is to create human-readable key/value pairs and add them to a single nested JSON for each machine (arranged by the machine's own modules).

From there, the data is easy to handle, and you can render or store it on a DB (or both).

If you take a look at the example you were referred to, you can see more or less all those steps (not the last part, but up to getting the data array).

Give it a try, and let me know if you need any additional help.

Why you don't use the subscribe function that sends values only on change?

Because I want to get the whole object together, for processing and logging purposes, and it's easier when you get everything.

In general, I get a message every few seconds. I am monitoring chemical processes, with numerous but slow gradual changes, so in the end, I might as well get the whole thing instead of having to set up a context, updating the variables that changed each time, and log it once every few minutes, or if the settings have changed.

hello, can you send me your flow specialy "Read multiple items" , "clear nodeId array" and " preclean- add items", i am also seraching for a solution to collect all data with one opc ua client session, thank very much !

The first two nodes you mention are exactly as the ones in the example supplied by the node creator.

The third one is specific to my machine, and in essence it also follows the supplied example. The difference is that I just grouped all the items in a subflow to keep things neat, instead of putting all the 200+ nodes in the main flow.

For your particular case, the most important thing is to identify the specific nodeIDs you need, and for that, a browser like UAExpert can help you a lot.

Just try to follow the documentation, try it, and ask specific questions if you get stuck on a specific situation.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.