OPC Unified Architecture (OPC UA) is a manufacturer-independent communication protocol for industrial automation applications. It is based on the client-server principle and allows transparent communication, from sensors and actuators to ERP systems or the cloud. The protocol is platform-independent and includes built-in security mechanisms. Flexible and completely independent, OPC UA is considered the ideal communication protocol for the implementation of Industry 4.0.
The Weble universal gateway OPC UA driver supports both client and server roles:
A typical use case is to use the Weble gateway as a protocol aggregator: multiple OPC UA clients connect to various field devices (PLCs, sensors, meters), and the gateway re-exposes all aggregated data as a single OPC UA server for SCADA, BMS, or ERP systems.
This section walks through a basic setup with an OPC UA server on one gateway and an OPC UA client on another (or on the same device for testing purposes).
Create a new gateway and select the OPC UA driver. Set the Mode to server. The key parameters to configure are:
26543).Once the gateway is started, the OPC UA server generates a self-signed TLS certificate automatically. You can then insert addresses that will be exposed as OPC UA variables.
In server mode, addresses are manually created. Each address requires:
%opc:Temperatures/Room1).Float, Boolean, String).ns=1;g=A1B2C3D4-...), but can be customized.Addresses can be organized hierarchically using / in the name, and folder nodes (datatype FolderType) can be created to structure the address space. Right-click on a FolderType address to insert child addresses directly into that folder.
A server address holds the last value written to it. To publish data coming from another protocol, create a route from the source address to the %opc: address.
%opc: address does not exist yet, it is created on the first write, together with its parent folders. Its datatype is guessed from the value: Boolean for true/false, DateTime for an ISO date, Float for any number, String otherwise. Create the address yourself beforehand when you need another datatype (for example Int32).Boolean values are reported as 1 / 0 on the gateway side.Create another gateway with the OPC UA driver. Set the Mode to client and configure:
192.168.1.50 or 127.0.0.1 for local testing).26543).The first time a client gateway connects, while it has no address yet, it browses one level below the Objects folder (or below the /Root/Objects/ path) and imports the nodes it finds. Imported variables get COV enabled and Polling set to 0.
This automatic import only happens while the gateway has no address. To discover more of the server, use:
A browse never deletes addresses and keeps the COV and polling settings you changed: it only adds the new nodes and refreshes the datatype and NodeId of the existing ones. Delete the addresses you do not need yourself. A recursive browse of a large server can create thousands of addresses.
Addresses created by a one-level browse are named with the namespace prefix of the node (for example %opc:2:Temperature); addresses created by a recursive browse are not (%opc:Temperature).
For addresses where real-time updates are needed, enable the COV (Change of Value) parameter. The client will create a monitored item subscription on the OPC UA server for that variable. Whenever the value changes on the server side, the update is pushed to the client immediately — no polling needed.
For addresses where COV is not suitable (e.g. the server doesn't support subscriptions for that node), use the Polling parameter to periodically read the value at a defined interval in milliseconds.
| Label | JSON Key | Description |
|---|---|---|
| Name | name | A descriptive name for this OPC UA gateway instance. |
| Cluster ID | cluster | Cluster identifier (integer). Use 0 for single-gateway setups. |
| Description | description | Optional description for this gateway. |
| Mode | type | Operating mode: client (connects to an OPC UA server) or server (exposes an OPC UA server). |
| Port | port | TCP port. For server: the listening port (default: 26543). For client: the remote server port. |
| /Root/Objects/ | objectsRoot | Optional path prefix under the OPC UA Objects folder. In server mode, all addresses are published under this path. In client mode, the browse starts from this path. |
These parameters are only visible when the Mode is set to client.
| Label | JSON Key | Description |
|---|---|---|
| Host | host | IP address or hostname of the remote OPC UA server. Default: 127.0.0.1. |
| Security mode | securityMode | Transport security mode: None, Sign (messages are signed), or SignAndEncrypt (messages are signed and encrypted). Must match the server configuration. |
| Security policy | securityPolicy | The security algorithm used: None, Basic128, Basic128Rsa15, Basic192, Basic192Rsa15, Basic256, Basic256Rsa15, Basic256Sha256, Aes128_Sha256_RsaOaep, PubSub_Aes128_CTR, PubSub_Aes256_CTR. Must match the server configuration. |
| Application name | applicationName | The application name used to identify this client to the server. Default: WebleOPCUA. |
| Username | name | Username for user authentication on the OPC UA server. Leave empty for anonymous connections. |
| Password | password | Password for user authentication. |
These parameters are only visible when the Mode is set to server.
| Label | JSON Key | Description |
|---|---|---|
| Max sessions | maxAllowedSessionNumber | Maximum number of concurrent OPC UA client sessions. Default: 500. |
| Max subscriptions | maxAllowedSubscriptionNumber | Maximum number of concurrent subscriptions across all clients. Default: 50. |
| User list | users | List of username/password pairs authorized to connect to the server. Each entry has a username and password field. |
| Allow anonymous | allowAnonymous | If enabled, clients can connect without providing credentials. |
| Description Browse | descriptionBrowse | If enabled, the OPC UA browse name of each variable is set to the address description field instead of the address name. Useful for providing human-readable names to OPC UA clients. |
| Register method | registerServerMethod | How the server announces itself: MDNS (multicast DNS) or LDS (registration with a Local Discovery Server). HIDDEN, the default value, behaves like MDNS: the server is still announced on the local network. |
| Discovery server | discoveryServer | Enable a built-in OPC UA discovery server alongside the main server. |
| Discovery server port | discoveryServerPort | Port for the discovery server. Default: 4840 (OPC UA standard discovery port). Only visible when discovery server is enabled. |
| Security modes | serverSecurityModes | Message security modes offered by the server: None, Sign, SignAndEncrypt (several can be selected). Empty = all three. To enforce encryption, select SignAndEncrypt only. |
| Security policies | serverSecurityPolicies | Security policies offered: None, Basic128Rsa15, Basic256, Basic256Sha256, Aes128_Sha256_RsaOaep, Aes256_Sha256_RsaPss. Empty = library defaults, which include deprecated policies. |
| Application URI | serverApplicationUri | applicationUri announced by the server. It must be identical to the URI of the server certificate. Empty = URI of the CA-issued certificate when one is installed, otherwise an automatic URN. |
| Application name | serverApplicationName | Application name announced by the server. Empty = NodeOPCUA. |
| Endpoint host names | alternateHostnames | Additional host names or IP addresses published in the endpoints, comma separated (for example the DNS name used in the certificate). |
| Trusted clients only | trustedClientsOnly | If enabled, only clients whose certificate is signed by one of the CA certificates below, or is listed in the trusted client certificates, are accepted. If disabled (default), any client certificate is accepted automatically. |
| CRL required | requireCrl | Refuse a client when no revocation list of its CA has been imported. Only shown with Trusted clients only. |
| CA certificates (PEM) | caCertificates | Root and intermediate CA certificates whose clients are accepted. Only shown with Trusted clients only. |
| CRLs (PEM) | crls | Revocation lists of these CAs. Only shown with Trusted clients only. |
| Trusted client certificates (PEM) | trustedClientCertificates | Client certificates trusted individually (the Trust button of the refused clients list adds them here). Only shown with Trusted clients only. |
| Keep NodeId namespace index | keepNamespaceIndex | Keep the namespace index written in the NodeId of each address (for example ns=4) instead of rewriting it to ns=1. Missing namespaces are created up to the requested index. Applies to variables only: folders stay in the server's own namespace. |
Client mode:
{
"type": "client",
"host": "192.168.1.50",
"port": 26543,
"securityMode": "None",
"securityPolicy": "None",
"applicationName": "WebleOPCUA",
"name": "",
"password": "",
"objectsRoot": ""
}
Client with authentication and encryption:
{
"type": "client",
"host": "10.0.0.100",
"port": 4840,
"securityMode": "SignAndEncrypt",
"securityPolicy": "Basic256Sha256",
"applicationName": "WebleGateway",
"name": "operator",
"password": "securePassword123",
"objectsRoot": "/BuildingA/Floor1"
}
Server mode:
{
"type": "server",
"port": 26543,
"allowAnonymous": false,
"descriptionBrowse": false,
"registerServerMethod": "HIDDEN",
"discoveryServer": false,
"discoveryServerPort": 4840,
"maxAllowedSessionNumber": 500,
"maxAllowedSubscriptionNumber": 50,
"objectsRoot": "",
"users": [
{ "username": "admin", "password": "adminPass" },
{ "username": "reader", "password": "readOnly" }
]
}
OPC UA addresses use the prefix %opc: followed by a hierarchical path:
%opc:Temperature — a top-level variable%opc:HVAC/AHU1/SupplyTemp — a variable nested in folders%opc:Sensors/Room1/CO2 — organized by locationIn server mode, the path structure defines how variables appear in the OPC UA address space. Using / creates folder nodes (FolderType), allowing OPC UA clients to browse the data in a structured tree.
In client mode, the address names are automatically generated from the server's browse path during the crawl.
Every OPC UA variable has a unique NodeId that identifies it within the address space. The NodeId format is:
ns=<namespace>;<type>=<identifier>
Where:
1 for the variables of the gateway server, unless Keep NodeId namespace index is enabled).i — Numeric (UInteger), e.g. ns=1;i=1001s — String, e.g. ns=1;s=SupplyTemperatureg — GUID, e.g. ns=1;g=A1B2C3D4-E5F6-7890-ABCD-EF1234567890b — Opaque (ByteString)By default, new addresses in server mode are assigned a GUID-based NodeId (e.g. ns=1;g=...). The NodeId can be customized when inserting an address.
The OPC UA driver supports the following standard OPC UA datatypes:
| Datatype | Description | Value range |
|---|---|---|
Boolean |
True/False | 0 or 1 |
SByte |
Signed 8-bit integer | -128 to 127 |
Byte |
Unsigned 8-bit integer | 0 to 255 |
Int16 |
Signed 16-bit integer | -32768 to 32767 |
UInt16 |
Unsigned 16-bit integer | 0 to 65535 |
Int32 |
Signed 32-bit integer | -2147483648 to 2147483647 |
UInt32 |
Unsigned 32-bit integer | 0 to 4294967295 |
Int64 |
Signed 64-bit integer | Exact up to ±2^53 (9 007 199 254 740 992); larger values lose precision |
UInt64 |
Unsigned 64-bit integer | Exact up to 2^53 (9 007 199 254 740 992); larger values lose precision |
Float |
32-bit floating point | IEEE 754 |
Double |
64-bit floating point | IEEE 754 |
String |
UTF-8 text string | — |
DateTime |
Date and time | ISO 8601 |
Guid |
Globally unique identifier | UUID format |
ByteString |
Raw byte array | Array of integers 0-255 |
XmlElement |
XML fragment | — |
NodeId |
OPC UA node reference | ns=x;t=value format |
ExpandedNodeId |
Extended node reference | Includes namespace URI |
StatusCode |
OPC UA status code | e.g. Good, Bad |
QualifiedName |
Namespace-qualified name | ns:name format |
LocalizedText |
Localized text string | locale=xx text=... |
FolderType |
Folder node (no value) | — |
The FolderType is a special type used to create organizational folders in the address space. Folder nodes do not hold values and are not routable or loggable.
| Label | JSON Key | Description |
|---|---|---|
| COV | cov | Enable Change of Value monitoring. When enabled, the OPC UA server pushes value updates to the client whenever the value changes. This is the most efficient method for real-time data. |
| Polling | polling | Polling interval in milliseconds. The client periodically reads the OPC UA variable at this interval. Use this as an alternative to COV when subscriptions are not supported by the server. Minimum effective interval: 100 ms. |
| Description | description | Optional description. |
| Log | log | Logging mode: never, on update, always, or a duration in ms. |
| Label | JSON Key | Description |
|---|---|---|
| Datatype | datatype | The OPC UA datatype for this variable (see section 3.3). Determines how the value is encoded and validated. |
| Access level | accessLevel | Defines what operations OPC UA clients can perform on this variable: CurrentRead (read current value), CurrentWrite (write value), HistoryRead (read historical values). Multiple levels are combined with | (space, vertical bar, space), for example CurrentRead | CurrentWrite | HistoryRead. Default: CurrentRead | CurrentWrite. |
| NodeId | nodeId | The OPC UA NodeId for this variable. Auto-generated as a GUID by default. Can be customized to use numeric, string, or GUID identifiers. |
| Store value | remanent | Value persistence: never (value lost on restart), always (persisted to disk), or a minimum interval between two saves. |
| Description | description | Optional description. When Description Browse is enabled on the gateway, this field is used as the OPC UA browse name. |
| Log | log | Logging mode: never, on update, always, or a duration in ms. |
Server address (Float variable, read/write, default access level):
{
"datatype": "Float",
"accessLevel": "CurrentRead | CurrentWrite",
"nodeId": "ns=1;g=A1B2C3D4-E5F6-7890-ABCD-EF1234567890",
"remanent": false
}
Server address (FolderType):
{
"datatype": "FolderType",
"nodeId": "ns=1;g=11111111-2222-3333-4444-555555555555"
}
Client address (COV subscription):
{
"datatype": "Double",
"nodeId": "ns=2;s=SupplyAirTemperature",
"cov": true,
"polling": 0
}
Client address (polling every 5 seconds):
{
"datatype": "Int32",
"nodeId": "ns=2;i=1001",
"cov": false,
"polling": 5000
}
In server mode, the OPC UA driver automatically generates and manages a self-signed TLS certificate. The certificate is stored in the gateway configuration and is automatically renewed when it approaches expiration (checked every hour, renewed if less than 1.5 hours remain).
When connecting a client to the server, the client retrieves the server certificate during the initial handshake and uses it for subsequent secured connections.
The combination of Security mode and Security policy determines the level of transport security:
| Security mode | Description |
|---|---|
None |
No security. Messages are sent in plain text. Suitable for isolated networks or testing. |
Sign |
Messages are digitally signed to ensure integrity. Data is not encrypted. |
SignAndEncrypt |
Messages are both signed and encrypted. Recommended for production environments. |
The security policy defines the cryptographic algorithm used. Basic256Sha256 and Aes128_Sha256_RsaOaep are recommended for modern deployments.
In server mode, two settings control who can open a session:
Warning: while the User list is empty, the server accepts any username and password. Disabling Allow anonymous is therefore not enough: add at least one user to restrict access.
The passwords of the user list are stored in clear text in the gateway configuration.
In client mode, Username and Password are sent when the session is created. Both must be filled in; otherwise the client connects anonymously.
The step-by-step procedure (encryption imposed, named users, CA-signed certificate, trusted clients) is in Securing the OPC UA server.
By default the server offers every security mode, including None, and accepts any client certificate. For a production server:
SignAndEncrypt and Security policies to Basic256Sha256 (and/or Aes128_Sha256_RsaOaep).If none of the selected modes or policies is supported by the OPC UA library installed on the device, the server does not start and the reason is written in the gateway log. CA and CRL validation needs a recent OPC UA library: the Server certificate window shows whether it is available; otherwise only individually trusted client certificates are accepted.
The Certificates menu of the address panel manages the server certificate:
To go back to the automatic self-signed certificate, open Server certificate and click Revert to an automatic self-signed certificate.
When the access level of a server address contains HistoryRead, the OPC UA server keeps a history of the values of that variable, so that OPC UA clients can use the HistoryRead service. This history is recorded by the OPC UA server itself, from the moment the gateway starts; it is independent from the Log setting of the address and from the logs stored on the device.
Addresses created in the interface get CurrentRead | CurrentWrite (no history): add HistoryRead to the access level to enable it (e.g. CurrentRead | CurrentWrite | HistoryRead). An address whose access level is empty is published with CurrentRead | CurrentWrite | HistoryRead.
| Property | Client mode | Server mode |
|---|---|---|
| Readable (read on demand) | Yes | No |
| Writable | Yes | Yes |
| Routable | Yes (except FolderType) | Yes (except FolderType) |
| Loggable | Yes (except FolderType) | Yes (except FolderType) |
| COV subscription | Yes | N/A (server pushes to clients) |
| Polling | Yes | N/A |
| Historical data | N/A | Yes (when HistoryRead access level) |
The OPC UA driver requires the Driver OPC licence (or a Full or Driver Sauter Full licence). Without it the gateway stops at start-up with missing license in its log.
| Symptom | Cause / action |
|---|---|
| The client gateway keeps restarting | The server is unreachable or refused the session: check host, port, security mode/policy and credentials. The driver restarts whenever the connection is lost. |
Address status BadNodeIdUnknown, BadNoCommunication, ... |
Status returned by the server for this node (node removed, device behind the server offline). |
| A value never updates | Neither COV nor Polling is set: the address is read only once after the connection. |
A write returns busy |
8 writes are already in progress and no slot was freed within 45 s. |
| Clients ask to trust the server certificate again | The self-signed certificate is valid for one year and is regenerated automatically (the driver restarts). Install a CA-issued certificate to avoid this (see 4.5). |