@winm/opc-client
v0.0.3
Published
An easy-to-use utils of node-opcua-client for developers
Downloads
4
Readme
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'
- Connect to the server
- Click the one of Nodes in 'Address Space'
- 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)
})