OPC UA Client
OPC UA|
Browsing, Reading or Writing OPC UA nodes is easy!
Create an OPC UA integration task in InDriver with just a few lines of JavaScript code. Explore an example using a KepServerEX connection.
Call:
OPCUAClientApi.connect("KepServer", {
"EndpointUrl": "opc.tcp://127.0.0.1:49320",
"Timeout": 5000,
"UserTokenPolicy": {
"Name": "user1",
"Password": "pass1"
}
});
Here is onStartup script:

InDriver.import('OPCUAClientApi');
InDriver.installHook(10000);
OPCUAClientApi.connect("KepServer", { "EndpointUrl":"opc.tcp://127.0.0.1:49320","Timeout":5000,"UserTokenPolicy":{"Name":"user1","Password":"pass1"}});
InDriver.debug(OPCUAClientApi.browse("KepServer",'','',1000),"",false);
To read items every 10 seconds, call:
OPCUAClientApi.readMultipleNodes("KepServer", [
{ "NodeId": "ns=2;s=Channel2.Device1.sine" }
]);
In this example, the Channel2.Device1.sine node is being read.
Here is onHook script:

let ts= InDriver.hookTs();
InDriver.debug(OPCUAClientApi.readMultipleNodes('KepServer',[{"NodeId":"ns=2;s=Channel2.Device1.sine"}]));