@winm/opc-client
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

OPC Client

NodeJS OPC Client For KepServer EX6.x Use node-opcua-client

install

pnpm add @winm/opc-client

usage

create client object

const client = new OPCClient({
  url: 'opc.tcp://127.0.0.1:49320', // The opc server endpoint url
  nodePrefix: 'ns=2;s=Demo.Device.', // The NodeId Prefix(NamespaceIndex, Identifier)
})

NodeId prefix can view in UaExpert 'Attributes'

  1. Connect to the server
  2. Click the one of Nodes in 'Address Space'
  3. You can see the 'NodeId' in 'Attributes'(RightTop of the window)

Read the node value

If you want to read the value of ns=2;s=Demo.Device.DemoNodeId

const val = await client.readValue('DemoNodeId')

Subscribe Node value changes

client.subscribe('Ready', val => {
  console.log('The subscribed value changed, new values is', val)
})

Readme

Keywords

Package Sidebar

Install

npm i @winm/opc-client

Weekly Downloads

0

Version

0.0.3

License

Apache-2.0

Unpacked Size

19.9 kB

Total Files

6

Last publish

Collaborators

  • ziho