OPC UA list of variables in NodeRed
Hello all,
We would like to connect PLCNext to a (Rest)API of our customer. The connection is going to be used to achieve trend data to display in a graph. I've attached the flow we've come up with. We could make a connection by wiring all variables manually. But I like to make things "Smart", so I was wondering if there is a way to retrieve every variabel in NodeRed of the OPC UA server and create the link dynamically? In MQTT this is called a wildcard.
This way I don't need to change the NodeRed configuration when we want to add a trendvalue.
I'm also open for any other solution to create trenddata from the PLCNext variabel to the (Rest) API. Thanks in advance!
We would like to connect PLCNext to a (Rest)API of our customer. The connection is going to be used to achieve trend data to display in a graph. I've attached the flow we've come up with. We could make a connection by wiring all variables manually. But I like to make things "Smart", so I was wondering if there is a way to retrieve every variabel in NodeRed of the OPC UA server and create the link dynamically? In MQTT this is called a wildcard.
This way I don't need to change the NodeRed configuration when we want to add a trendvalue.
I'm also open for any other solution to create trenddata from the PLCNext variabel to the (Rest) API. Thanks in advance!
Comments
I'm not realy familar with Node.Red, but depending on the features of the UA Client package it should be possible to just browse the items.
I've spent a few minutes on google and found this tutorial @Youtube, maybe this already does it...
Otherwise there is also an interesting alternative using the PLCnext REST API. You can query all available variables with datatypes with the following calls:
will return:
and
will return:
So, with those two calls you can create a quite dynamic application.
--> We're currently working on an update of the REST chapter, those two calls will be part of it.
BR,
Frank
I cannot upload the json file for some reason, so here is the plain code:
[{"id":"76fbcb09.74594c","type":"tab","label":"Flow 1"},{"id":"c8b446ba.bfa058","type":"OpcUa-Browser","z":"76fbcb09.74594c","endpoint":"14afceca.6386f1","item":"","datatype":"","topic":"","items":[],"name":"","x":470,"y":40,"wires":[["47c865b3.8d2aac"]]},{"id":"481f49fe.55a3a8","type":"inject","z":"76fbcb09.74594c","name":"Browse","props":[{"p":"payload","v":"","vt":"str"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"str","x":78.5,"y":35.79999542236328,"wires":"3eb58696.791f7a"},{"id":"3eb58696.791f7a","type":"function","z":"76fbcb09.74594c","name":"Set browse address","func":"msg.topic='ns=5;s=Arp.Plc.Eclr/INST_LevelControl1';\nmsg.actiontype='browse';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":251.50001525878906,"y":36,"wires":"c8b446ba.bfa058"},{"id":"47c865b3.8d2aac","type":"debug","z":"76fbcb09.74594c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":40,"wires":[]},{"id":"14afceca.6386f1","type":"OpcUa-Endpoint","endpoint":"opc.tcp://192.168.178.10:4840","secpol":"None","secmode":"None","login":false}]