OPC UA Client
This function block establishes and maintains a connection to an OPC UA server so other communication blocks can read from or write to that server. It provides simple fields for server address and optional credentials, monitors connection health, and attempts reconnection automatically when needed.
π₯ Inputs
(none)
This block does not require inputs to run. It acts as a communication provider for other blocks.
π€ Outputs
Client Provides the connected OPC UA client object that other communication blocks can use to perform read/write operations.
πΉοΈ Controls
Username Enter the user name if the OPC UA server requires authentication. Leave empty for anonymous access.
Password Enter the password associated with the username. This field hides the input for privacy.
Server Address Type the server address as an IP and port (for example 192.168.1.10:4840) or as a full OPC UA URL (for example opc.tcp://host:port). The block will use this value to connect to the server.
π¨ Features
Automatic connection management: the block connects when the address is set and will try to reconnect if the connection is lost or the address changes.
Authentication support: optional username and password fields for secured servers.
Connection health monitoring: warns or logs when the client cannot reach the server.
Clean disconnect: releases the connection when the block is removed from the workspace to free resources.
βοΈ Running mechanism
When the scenario runs, this block uses the provided Server Address (and optional Username/Password) to open a connection to the OPC UA server. It continuously checks connection status and attempts to reconnect automatically if there is a failure or if the address is changed. The active connection is exposed through the Client output so other blocks can perform operations against the server. When the block is removed, the connection is cleanly closed.
π‘ Tips and Tricks
OPC UA Read
Connect this block to the Client output to read values from the server at runtime.
OPC UA Write
Use this block together with the Client output to write values back to the server.
CSV Export
Log read values by piping outputs into this block to save time-series data for later analysis.
SQL-DB Client Connect + SQL-DB Operations
Store historical values in a database by combining the OPC UA client with a database connection and write/query blocks.
MQTT Publish / MQTT Subscribe
Bridge OPC UA data to/from cloud systems by publishing readings to MQTT or subscribing to control topics to trigger writes.
REST API - Post / REST API - Get
Forward critical data or alerts to web services by sending HTTP requests containing OPC data.
Send Mail
Trigger email alerts (for example on connection loss or threshold breaches) by feeding condition outputs into the mail block.
Debug Input
Use this block to inspect values coming from the server during setup and troubleshooting.
π Quick usage
Enter the server address into
Server Address(IP:Port or full OPC UA URL).If the server requires authentication, fill
UsernameandPassword.Run the scenario β the block will connect and provide the
Clientoutput for other communication blocks to use.To stop and free resources, remove the block or clear the address; the block will close the connection.
π οΈ Troubleshooting
Connection fails or times out
Verify the server address and port are correct and reachable from the machine running the scenario.
Check firewall or network rules that may block OPC UA ports.
If the server uses a secure endpoint, confirm credentials and server security settings.
Authentication errors
Ensure
UsernameandPasswordare correct and that the server permits the chosen authentication method.
Unexpected disconnects or unstable connection
Use the block together with
Debug Inputto log values and identify when disconnections occur.Consider routing important read results to
CSV Exportor a database (SQL-DB Operations) for persistence.
If problems persist, consult your OPC UA server documentation and network administrator to confirm server endpoints, ports, and security requirements.
Last updated
Was this helpful?