top of page
Search

🚀 OPC UA Integration in just One JavaScript Line with InDriver Platform🌐

Writer: Andrzej JaroszAndrzej Jarosz


We’re excited to announce that OPC UA integration is now easier than ever with InDriver! 🎉


Whether you’re working with SCADA, PLCs, or industrial automation systems, InDriver makes browsing, reading, and writing OPC UA nodes effortless. All you need is just a few lines of JavaScript code to get started.



🔗 Quick Start with KepServerEX Integration


Here’s how simple it is to establish a connection with an OPC UA server like KepServerEX:


OPCUAClientApi.connect("KepServer", {
   "EndpointUrl": "opc.tcp://127.0.0.1:49320",
   "Timeout": 5000,
   "UserTokenPolicy": {
       "Name": "user1",
       "Password": "pass1"
   }
});

⚡ Automate with InDriver Scripts


To make it even smoother, here’s an example of how to integrate OPC UA into your InDriver tasks:


onStartup Script:



InDriver.import('OPCUAClientApi');
InDriver.installHook(10000);  // Hook runs every 10 seconds

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);

This script establishes a connection and browses OPC UA nodes in real-time.


Reading Data Every 10 Seconds:

OPCUAClientApi.readMultipleNodes("KepServer", [
   { "NodeId": "ns=2;s=Channel2.Device1.sine" }
]);

Here, the node Channel2.Device1.sine is read every 10 seconds, providing continuous real-time data.


onHook Script:



let ts = InDriver.hookTs();

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

📊 Result of readMultipleNodes

When reading data, the result is returned in a JSON format (array) like this:

[ 
      { "NodeId": "ns=2;s=Channel2.Device1.sine", "Value": 0 }
]

This simple structure makes it easy to process real-time data from your OPC UA server within InDriver.


💡 Why It’s Exciting?


  • Fast and Easy Integration with minimal code

  • Real-Time Data Processing for smart decision-making

  • Flexible Automation for industrial environments


Would you be ready to transform your industrial data operations? Visit inanalytics.io to learn more about InDriver! 🚀

 
 
 

Comments


bottom of page