OPC UA Connector

Learn how to connect to an OPC UA server using the Heisenware OPC UA integration.

Depending on your setup, you may first need to create an OPC UA Client Agent to connect to a local OPC UA Server. For the default cloud-based setup, it is needed. If you are self-hosting Heisenware and OPC UA server as well as your Heisenware instance are running in the same network, you may skip this step.

Video tutorial

Watch the video to learn how to connect to an OPC UA Server and read, record and visualize OPC UA data from that server within Heisenware.

Creating an OPC UA instance

The create function constructs an OPC UA client instance. Creating an instance is necessary to connect to an OPC UA server. If you are using an agent, this must be done inside the agent.

Parameter
Type
Default
Description

securityMode

'None'

One from 'unauthorized', 'None', 'Sign' or 'SignAndEncrypt'.

securityPolicy

'None'

One from 'Aes128_Sha256_RsaOaep', 'Basic128', 'Basic192', 'Basic192Rsa15', 'Basic256Sha256', 'Basic256Rsa15', 'Basic256Rsa15', 'unauthorized', 'None', 'PubSub_Aes128_CTR' or 'PubSub_Aes256_CTR'.

certificateFile

String

privateKeyFile

String

OPC UA functions

connect

Connects to an OPC UA server. Enter the endpointUrl into the first input box and optionally more parameters into the second input box.

Parameter
Type
Description

endpointUrl

String

username

String

password

String

userCertificate

String

userCertificate

PrivateKey

String

This example shows how to configure the connect function if you are using an OPC UA server with username and password.

Configuring username and password

isConnected

Checks if the client is connected to the server.

disconnect

Disconnects from the server.

browseObjects

Detailed browsing of the OPC UA objects given a path (non-recursive).

A browseObject function with a sample input path

browseTypes

Detailed browsing of OPC UA Types given a path (non-recursive).

browseViews

Detailed browsing of OPC UA Views given a path (non-recursive).

browse

Generic browsing of the OPC UA server (non-recursive).

You can use the parameter address to navigate to the desired folder. The function shows the contents of the root folder as default. You can also specify the session with sessionId.

listenToEvents

Reports about relevant events. You can use the listener box to connect a function to run on events.

readNode

Reads a variable.

Use parameter address for the node ID or a valid browse path. You can also specify the session with sessionId.

readVariable

Reads the value of a variable.

Use parameter address for the node ID or a valid browse path.

monitorNode

Starts monitoring an item.

Parameter
Type
Default
Description

address

String

Node ID or a valid browse path.

listener

Function

The connected function is automatically called upon time change.

samplingInterval

Integer

1000

The sampling interval in milliseconds.

queueSize

Integer

100

The maximum queue size.

discardOldest

Boolean

true

Sets the policy for when the queue is full. Decides whether to discard the oldest or newest entries. Default discards the oldest entries.

subscriptionId

String

monitorValue

Starts monitoring an item value.

Parameter
Type
Default
Description

address

String

Node ID or a valid browse path.

listener

Function

The connected function is automatically called upon time change.

samplingInterval

Integer

1000

The sampling interval in milliseconds.

queueSize

Integer

100

The maximum queue size.

discardOldest

Boolean

true

Sets the policy for when the queue is full. Decides whether to discard the oldest or newest entries. Default discards the oldest entries.

subscriptionId

String

stopMonitor

Stops monitoring an item. Use the parameter nodeId to specify what to stop monitoring.

writeVariable

Sets a variable's value. Input the nodeId or browse path in the address input box, and the new variable value in the value box.

callMethod

Calls an OPC UA method using inferred data types from the server's method metadata.

browseDirectory

Browses a file directory.

readFile

Reads a file made available through the remote OPC UA server.

writeFile

Creates a new file on the server in the specified folder and uploads local content to it.

Last updated