This documentation will help you set up the OPC-UA connector for the ThingsBoard IoT Gateway. We’ll explain the configuration
parameters in simple terms to make it easy for you to understand and follow. The OPC-UA (Open Platform Communications
Unified Architecture) is a machine-to-machine communication protocol for industrial automation, and this connector
allows seamless integration with the ThingsBoard platform. Use
general configuration to enable this connector.
Also, if you are new to ThingsBoard IoT Gateway, we recommend you to read the Getting Started
guide to understand the basic concepts of ThingsBoard IoT Gateway and how it works with OPC-UA protocol.
The connector can be configured via the user interface form, which helps you set up a connection to the OPC-UA server,
collect data and write data to nodes. Let’s look at all the available settings and explain each one clearly.
This will help you understand how everything works.
Please note: To access the actual UI for the gateway - you need to a have connected gateway before adding a connector. Otherwise, you will see the old UI.
Configuration modes
The OPC-UA connector can be configured in two modes: Basic and Advanced.
Basic mode is designed for users who are new to ThingsBoard IoT Gateway and want to quickly set up the connector with minimal configuration. It provides a simplified interface with essential settings.
Advanced mode is intended for experienced users who need more control over the configuration. It offers additional options and flexibility for advanced use cases.
Please note: If you are new to IoT Gateway, use the “Basic” configuration mode. If you are familiar with configuring IoT Gateway, you can use the “Advanced” configuration mode.
You can switch between these modes using the toggle button at the top of the configuration page:
General settings
This configuration section contains general connector settings, such as:
Name - connector name used for logs and saving to persistent devices;
Logs configuration - settings for local and remote logging:
Enable remote logging - enables remote logging for the connector;
Logging level - logging level for local and remote logs: NONE, ERROR, CRITICAL, WARNING, INFO, DEBUG, TRACE;
Report strategy - strategy for sending data to ThingsBoard:
Report period - period for sending data to ThingsBoard in milliseconds;
Type - type of the report strategy:
On report period - sends data to ThingsBoard after the report period;
On value change - sends data to ThingsBoard when the value changes;
On value change or report period - sends data to ThingsBoard when the value changes or after the report period;
On received - sends data to ThingsBoard after receiving data from the device (default strategy).
Additional information about the report strategy can be found here.
The General tab in settings is the same for both the basic and advanced configurations.
Connection settings
Connection settings define how the OPC-UA connector establishes and maintains communication with the OPC-UA
server. These settings cover the basic connection parameters, server discovery behavior, security configuration, and
authentication modes.
Server
This subsection specifies the target OPC-UA server and how the gateway interacts with it. It includes the server’s
URL, timeout settings, scan intervals, and the option to use either subscriptions or polling to monitor
data nodes.
This configuration section contains settings of the OPC-UA server connection, such as:
Server endpoint url - hostname or ip address of OPC-UA server;
Timeout in milliseconds - timeout in milliseconds for connecting to OPC-UA server;
Scan period in milliseconds - period in milliseconds to rescan the server;
Poll period - period in milliseconds to poll the server;
Subscription check period in milliseconds - period to check the subscriptions in the OPC-UA server;
Enable subscription - if true - the gateway will subscribe to interesting nodes and wait for data update and if false - the gateway will rescan OPC-UA server every scanPeriodInMillis;
Show map - show nodes on scanning true or false.
All configuration parameters list, and their detailed description can be found in the Advanced configuration section.
Security
OPC-UA server connections offer three distinct security types:
Anonymous - the simplest option of identity;
Basic - using this option, you can provide the username and password to connect to the OPC-UA server;
Certificates - the safest option of identity. Using this option, you can also provide path on machine with the gateway to certificate, private key and CA certificate. Optionally, you can provide the username/password pair.
Anonymous - the simplest option of identity;
Basic - using this option, you can provide the username and password to connect to the OPC-UA server;
Certificates - the safest option of identity. Using this option, you can also provide path on machine with the gateway to certificate, private key and CA certificate. Optionally, you can provide the username/password pair.
Data mapping
Data mapping is a section that allows you to configure which node from the OPC-UA server will be assigned to which
device in ThingsBoard.
You can also use this section to configure which data will be sent as device attributes or telemetry.
Data mapping contains all the necessary settings for flexible device and data management.
The following parameters are used to configure the base node of the device, its name and profile, as well as for
report strategy:
Device node - the base node for the device. Paths to the device name, profile, attributes, and telemetry can be specified relative to this node.
Device name - the name of the device in ThingsBoard. It can be specified as a path or identifier to the node or as a static value (more information about types can be found in the Additional information section).
Device profile - the profile of the device in ThingsBoard. It can be specified as a path or identifier to the node or as a static value (more information about types can be found in the Additional information section).
Report strategy - strategy for sending data to ThingsBoard:
Report period - period for sending data to ThingsBoard in milliseconds;
Type - type of the report strategy:
On report period - sends data to ThingsBoard after the report period;
On value change - sends data to ThingsBoard when the value changes;
On value change or report period - sends data to ThingsBoard when the value changes or after the report
period;
On received - sends data to ThingsBoard after receiving data from the device (default strategy).
To add a new device, use the following steps:
Click the + Add mapping button.
Provide the following fields in the opened model window: Device node, Device name and Profile name (all of them can be path or identifier).
Click the + Add mapping button.
Provide the following fields in the opened model window: Device node, Device name and Profile name (all of them can be path or identifier).
Additional information about the report strategy can be found here.
All configuration parameters list, and their detailed description can be found in the Advanced configuration section.
More usage examples can be found in the Usage examples section.
Subsection “Attributes” and “Time series”
The configuration in this subsection provides settings for processing data from the OPC-UA node. These settings will be
interpreted in ThingsBoard platform instance as attributes/time series of the device.
The following parameters are used to configure device attributes and time series:
Key - the key of the attribute/time series in ThingsBoard. It can be specified as a static value.
Type - the type of expression in the Value field (more information about types can be found in the Additional information section):
Path - can be absolute or relative path to the node in the OPC-UA server. The value will be taken from the node with the specified path.
Identifier - can be numeric, string, byte string or GUID identifier of the node in the OPC-UA server. The value will be taken from the node with the specified identifier.
Constant - a static value that will be sent to the device as an attribute/time series key.
Value - the value of the attribute/time series that will be sent to the platform device. It should be specified depending on the selected type (Path, Identifier or Constant).
All configuration parameters list, and their detailed description can be found in the Advanced configuration section.
More usage examples can be found in the Usage examples section.
To add new time series or attribute key, follow these steps:
Click the “pencil” icon in the “Attributes” section to add new attribute key;
Click on “Add attribute” in the opened window;
Enter the “Key” field, select the “Type” (can be path, identifier or constant), enter “Value” and click “Apply” button;
Now click on the “pencil” icon in the “Time series” section to add new time series key;
Click on “Add time series” in the opened window;
Enter the “Key” field, select the “Type” (can be path, identifier or constant), enter “Value” and click “Apply” button.
Click the “pencil” icon in the “Attributes” section to add new attribute key;
Click on “Add attribute” in the opened window;
Enter the “Key” field, select the “Type” (can be path, identifier or constant), enter “Value” and click “Apply” button;
Now click on the “pencil” icon in the “Time series” section to add new time series key;
Click on “Add time series” in the opened window;
Enter the “Key” field, select the “Type” (can be path, identifier or constant), enter “Value” and click “Apply” button.
You can enable a specific report strategy for each time series or attribute. This strategy defines how often
data is sent to the ThingsBoard server. The following strategies are available:
On report period - sends data to ThingsBoard after the report period;
On value change - sends data to ThingsBoard when the value changes;
On value change or report period - sends data to ThingsBoard when the value changes or after the report period;
On received - sends data to ThingsBoard after receiving data from the device (default strategy).
Additional information about the report strategy can be found here.
The device name and profile can be set dynamically using node values. In this example, we will use an
absolute path to specify the device name and profile.
As an example, we will use Prosys OPC-UA Simulation Server, which is available at
opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer. The server has the following structure:
We are interested in nodes: “DeviceModelName” and “DeviceSeries”. We will use these nodes to set the device name
and profile, respectively.
Let’s configure the device name and profile in the OPC-UA connector. For this purpose, follow these steps:
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Firstly, we need to configure parent (or device) node. Click on the “+ Add mapping” button.
In the opened window, fill in “Device node” field with Root\.Objects\.DemoDevice, also select “Path” in “Source” field. This is an absolute path to the parent node of the device we want to create.
In the “Name” field, enter ${Root\.Objects\.DemoDeviceInfo\.DeviceModelName}, also select “Path” in “Source” field. This is an absolute path to the node that contains the device name.
In the “Profile name” field, enter ${Root\.Objects\.DemoDeviceInfo\.DeviceSeries}, also select “Path” in “Source” field. This is an absolute path to the node that contains the device profile.
Also, we need to add one attribute/time series because the connector will not add a device without any data to read (you can use any pre-installed Prosys OPC-UA Simulation Server node). Click on the “pencil” icon next to the “Attributes” section.
In the opened window, click on the “Add attribute” button and fill the fields as on the corresponding image.
Remember to save your changes by clicking the “Save” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Firstly, we need to configure parent (or device) node. Click on the “+ Add mapping” button.
In the opened window, fill in “Device node” field with Root\.Objects\.DemoDevice, also select “Path” in “Source” field. This is an absolute path to the parent node of the device we want to create.
In the “Name” field, enter ${Root\.Objects\.DemoDeviceInfo\.DeviceModelName}, also select “Path” in “Source” field. This is an absolute path to the node that contains the device name.
In the “Profile name” field, enter ${Root\.Objects\.DemoDeviceInfo\.DeviceSeries}, also select “Path” in “Source” field. This is an absolute path to the node that contains the device profile.
Also, we need to add one attribute/time series because the connector will not add a device without any data to read (you can use any pre-installed Prosys OPC-UA Simulation Server node). Click on the “pencil” icon next to the “Attributes” section.
In the opened window, click on the “Add attribute” button and fill the fields as on the corresponding image.
Remember to save your changes by clicking the “Save” button.
Now we can check if the device name and profile are set correctly. Go to “Entities” > “Devices” and as you can see, the device
name is set to Demo Device and the profile is set to Demo Series.
If you are using advanced configuration mode and want to set the device name and profile using an absolute path, you can
use the following configuration:
The device name and profile can be set dynamically using node values. In this example, we will use a
relative path to specify the device name and profile.
As an example, we will use Prosys OPC-UA Simulation Server, which is available at
opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer. The server has the following structure:
We are interested in nodes: “DeviceModelName” and “DeviceSeries”. We will use these nodes to set the device name
and profile, respectively.
Let’s configure the device name and profile in the OPC-UA connector. For this purpose, follow these steps:
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Firstly, we need to configure parent (or device) node. Click on the “+ Add mapping” button.
In the opened window, fill in “Device node” field with Root\.Objects\.DemoDevice, also select “Path” in “Source” field. This is an absolute path to the parent node of the device we want to create.
In the “Name” field, enter ${DeviceModelName}, also select “Path” in “Source” field. This is a relative path to the node that contains the device name.
In the “Profile name” field, enter ${DeviceSeries}, also select “Path” in “Source” field. This is a relative path to the node that contains the device profile.
Also, we need to add one attribute/time series because the connector will not add a device without any data to read (you can use any pre-installed Prosys OPC-UA Simulation Server node). Click on the “pencil” icon next to the “Attributes” section.
In the opened window, click on the “Add attribute” button and fill the fields as on the corresponding image.
Remember to save your changes by clicking the “Save” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Firstly, we need to configure parent (or device) node. Click on the “+ Add mapping” button.
In the opened window, fill in “Device node” field with Root\.Objects\.DemoDevice, also select “Path” in “Source” field. This is an absolute path to the parent node of the device we want to create.
In the “Name” field, enter ${DeviceModelName}, also select “Path” in “Source” field. This is a relative path to the node that contains the device name.
In the “Profile name” field, enter ${DeviceSeries}, also select “Path” in “Source” field. This is a relative path to the node that contains the device profile.
Also, we need to add one attribute/time series because the connector will not add a device without any data to read (you can use any pre-installed Prosys OPC-UA Simulation Server node). Click on the “pencil” icon next to the “Attributes” section.
In the opened window, click on the “Add attribute” button and fill the fields as on the corresponding image.
Remember to save your changes by clicking the “Save” button.
Now we can check if the device name and profile are set correctly. Go to “Entities” > “Devices” and as you can see, the device
name is set to Demo Device and the profile is set to Demo Series.
If you are using advanced configuration mode and want to set the device name and profile using a relative path, you can
use the following configuration:
The device name and profile can be set dynamically using node values. In this example, we will use identifier to
specify the device name and profile. Identifier can be numeric,
string, byte string or GUID identifier of the node in the OPC-UA server.
As an example, we will use Prosys OPC-UA Simulation Server, which is available at
opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer. The server has the following structure:
We are interested in nodes: “DeviceModelName” that have ns=3;i=1014 identifier and “DeviceSeries” that
have ns=3;i=1015 identifier. We will use these nodes to set the device name and profile, respectively.
Let’s configure the device name and profile in the OPC-UA connector. For this purpose, follow these steps:
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Firstly, we need to configure parent (or device) node. Click on the “+ Add mapping” button.
In the opened window, fill in “Device node” field with Root\.Objects\.DemoDevice, also select “Path” in “Source” field. This is an absolute path to the parent node of the device we want to create.
In the “Name” field, enter ${ns=3;i=1014}, also select “Identifier” in “Source” field.
In the “Profile name” field, enter ${ns=3;i=1015}, also select “Identifier” in “Source” field. This is an absolute path to the node that contains the device profile.
Also, we need to add one attribute/time series because the connector will not add a device without any data to read (you can use any pre-installed Prosys OPC-UA Simulation Server node). Click on the “pencil” icon next to the “Attributes” section.
In the opened window, click on the “Add attribute” button and fill the fields as on the corresponding image.
Remember to save your changes by clicking the “Save” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Firstly, we need to configure parent (or device) node. Click on the “+ Add mapping” button.
In the opened window, fill in “Device node” field with Root\.Objects\.DemoDevice, also select “Path” in “Source” field. This is an absolute path to the parent node of the device we want to create.
In the “Name” field, enter ${ns=3;i=1014}, also select “Identifier” in “Source” field.
In the “Profile name” field, enter ${ns=3;i=1015}, also select “Identifier” in “Source” field. This is an absolute path to the node that contains the device profile.
Also, we need to add one attribute/time series because the connector will not add a device without any data to read (you can use any pre-installed Prosys OPC-UA Simulation Server node). Click on the “pencil” icon next to the “Attributes” section.
In the opened window, click on the “Add attribute” button and fill the fields as on the corresponding image.
Remember to save your changes by clicking the “Save” button.
Now we can check if the device name and profile are set correctly. Go to “Entities” > “Devices” and as you can see, the device
name is set to Demo Device and the profile is set to Demo Series.
If you are using advanced configuration mode and want to set the device name and profile using an identifier, you can
use the following configuration:
Attributes and time series data can be accessed using relative paths
in the OPC UA Connector. This allows you to retrieve data without needing to specify the full path to the node.
As an example, we will use Prosys OPC-UA Simulation Server, which is available at
opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer. The server has the following structure:
We are interested in node “Humidity”. We will use this node to retrieve the humidity data.
Let’s configure the humidity data in the OPC-UA connector. For this purpose, follow these steps:
Go to “Entities” → “Gateways” in the right sidebar.
Select your gateway.
Click on the “Connectors” tab.
Select the OPC-UA connector and click on the “Data mapping” tab.
Select data mapping with device to which you want to add time series data (if you don’t know how to add a new device,
see the Getting Started guide
or Data mapping section of this guide with
respective examples).
In the opened data mapping windows, click on the “pencil” icon next to the “Time series” or “Attributes”
section.
Click on the “Add time series” button. Fill in the “Key” field with Humidity, also select
“Path” in “Type” field, and fill in the “Value” field
with ${Humidity}. This is a relative path to the node that contains the humidity data.
Remember to save your changes by clicking the “Apply” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the OPC-UA connector, click on the “Data mapping” tab. Select data mapping with device to which you want to add time series data (if you do not know how to add a new device, see the Getting Started guide or Data mapping section of this guide with respective examples).
In the opened data mapping windows, click on the “pencil” icon next to the “Time series” or “Attributes” section.
Click on the “Add time series” button. Fill in the “Key” field with Humidity, also select “Path” in “Type” field, and fill in the “Value” field with ${Root\.Objects\.DemoDevice\.Humidity}. This is an absolute path to the node that contains the humidity data.
Remember to save your changes by clicking the “Apply” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the OPC-UA connector, click on the “Data mapping” tab. Select data mapping with device to which you want to add time series data (if you do not know how to add a new device, see the Getting Started guide or Data mapping section of this guide with respective examples).
In the opened data mapping windows, click on the “pencil” icon next to the “Time series” or “Attributes” section.
Click on the “Add time series” button. Fill in the “Key” field with Humidity, also select “Path” in “Type” field, and fill in the “Value” field with ${Root\.Objects\.DemoDevice\.Humidity}. This is an absolute path to the node that contains the humidity data.
Remember to save your changes by clicking the “Apply” button.
Now we can check if the humidity data is sending correctly. Go to “Entities” > “Devices”, select a created device and as you
can see, the humidity data is available in the “Time series” section:
If you are using advanced configuration mode and want to set the humidity data using a relative path, you can
use the following configuration:
Attributes and time series data can be accessed using absolute paths
in the OPC UA Connector. This will allow you to get data from a node that does not refer to the parent (device) node.
As an example, we will use Prosys OPC-UA Simulation Server, which is available at
opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer. The server has the following structure:
We are interested in node “Humidity”. We will use this node to retrieve the humidity data.
Let’s configure the humidity data in the OPC-UA connector. For this purpose, follow these steps:
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the OPC-UA connector, click on the “Data mapping” tab. Select data mapping with device to which you want to add time series data (if you do not know how to add a new device, see the Getting Started guide or Data mapping section of this guide with respective examples).
In the opened data mapping windows, click on the “pencil” icon next to the “Time series” or “Attributes” section.
Click on the “Add time series” button. Fill in the “Key” field with Humidity, also select “Path” in “Type” field, and fill in the “Value” field with ${Root\.Objects\.DemoDevice\.Humidity}. This is an absolute path to the node that contains the humidity data.
Remember to save your changes by clicking the “Apply” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the OPC-UA connector, click on the “Data mapping” tab. Select data mapping with device to which you want to add time series data (if you do not know how to add a new device, see the Getting Started guide or Data mapping section of this guide with respective examples).
In the opened data mapping windows, click on the “pencil” icon next to the “Time series” or “Attributes” section.
Click on the “Add time series” button. Fill in the “Key” field with Humidity, also select “Path” in “Type” field, and fill in the “Value” field with ${Root\.Objects\.DemoDevice\.Humidity}. This is an absolute path to the node that contains the humidity data.
Remember to save your changes by clicking the “Apply” button.
Now we can check if the humidity data is sending correctly. Go to “Entities” > “Devices”, select a created
device and as you can see, the humidity data is available in the “Time series” section:
If you are using advanced configuration mode and want to set the humidity data using an absolute path, you can
use the following configuration:
Attributes and time series data can be accessed using identifiers
in the OPC UA Connector. This will allow you to get data from a node that does not refer to the parent (device) node
by identifier.
As an example, we will use Prosys OPC-UA Simulation Server, which is available at
opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer. The server has the following structure:
We are interested in node “Humidity” that have ns=3;i=1011 identifier. We will use this node to retrieve the
humidity data.
Let’s configure the humidity data in the OPC-UA connector. For this purpose, follow these steps:
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the OPC-UA connector, click on the “Data mapping” tab. Select data mapping with device to which you want to add time series data (if you do not know how to add a new device, see the Getting Started guide or Data mapping section of this guide with respective examples).
In the opened data mapping windows, click on the “pencil” icon next to the “Time series” or “Attributes” section.
Click on the “Add time series” button. Fill in the “Key” field with Humidity, also select “Identifier” in “Type” field, and fill in the “Value” field with ${ns=3;i=1011}. This is a relative path to the node that contains the humidity data.
Remember to save your changes by clicking the “Apply” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the OPC-UA connector, click on the “Data mapping” tab. Select data mapping with device to which you want to add time series data (if you do not know how to add a new device, see the Getting Started guide or Data mapping section of this guide with respective examples).
In the opened data mapping windows, click on the “pencil” icon next to the “Time series” or “Attributes” section.
Click on the “Add time series” button. Fill in the “Key” field with Humidity, also select “Identifier” in “Type” field, and fill in the “Value” field with ${ns=3;i=1011}. This is a relative path to the node that contains the humidity data.
Remember to save your changes by clicking the “Apply” button.
Now we can check if the humidity data is sending correctly. Go to “Entities” > “Devices”, select a created device and as you
can see, the humidity data is available in the “Time series” section:
If you are using advanced configuration mode and want to set the humidity data using an identifier, you can
use the following configuration:
The Requests mapping section allows you to configure how the ThingsBoard platform instance will interact with the
devices. That is, how the platform will request data from the devices, how it will update device attributes, and how
it will send RPC commands to the devices.
OPC-UA connector supports the following requests mapping:
RPC methods - allows sending RPC commands to devices. Using RPC methods, you can get or set values of the OPC-UA nodes.
OPC-UA connector supports different types of RPC methods, such as:
Reserved GET/SET methods - these methods are automatically created for each attribute and time series parameter.
You can use them to get or set values of the OPC-UA nodes.
RPC method to connector - this method allows you to send a command to the connector from the ThingsBoard IoT Gateway UI.
The command will be processed by the connector, and the result will be sent back to the ThingsBoard platform instance.
Configurable RPC methods to device - these methods allow you to configure custom RPC commands in connector configuration that can be sent to the devices.
Subsection “Attribute updates”
This subsection contains configuration for attribute updates request from ThingsBoard platform instance.
ThingsBoard allows the provisioning of device attributes and fetches some of them from
the device application. You can treat this as a remote configuration for devices, enabling them to request
shared attributes from ThingsBoard. See user guide for more details.
The following parameters are used to configure attribute updates:
Key - the key of the shared attribute in ThingsBoard. It can be specified as a static value.
Type - the type of expression in the Value field (more information about types can be found in the Additional information section):
Path - can be absolute or relative path to the node in the OPC-UA server. The value will be taken from the node with the specified path.
Identifier - can be numeric, string, byte string or GUID identifier of the node in the OPC-UA server. The value will be taken from the node with the specified identifier.
Constant - a static value that will be sent to the device.
Value - the node in which the shared attribute value will be written. It should be specified depending on the selected type (Path, Identifier or Constant).
All configuration parameters list, and their detailed description can be found in the Advanced configuration section.
More usage examples can be found in the Usage examples section.
In order to add new attribute update, follow these steps:
Click the “pencil” icon in the “Attribute updates” section to add new attribute update;
Click on “Add attribute update” in the opened window;
Enter the “Key” field, select the “Type” (can be path, identifier or constant), enter “Value” and click “Apply” button.
Click the “pencil” icon in the “Attribute updates” section to add new attribute update;
Click on “Add attribute update” in the opened window;
Enter the “Key” field, select the “Type” (can be path, identifier or constant), enter “Value” and click “Apply” button.
Subsection “RPC methods”
ThingsBoard allows sending RPC commands to devices connected directly to ThingsBoard or via Gateway.
The following parameters are used to configure RPC methods:
Method name - the name of the method on OPC-UA server.
Arguments - list of arguments that will pass to OPC-UA server method.
All configuration parameters list, and their detailed description can be found in the Advanced configuration section.
More usage examples can be found in the Usage examples section.
In order to add new RPC method, follow these steps:
Click the “pencil” icon in the “RPC methods” section to add new RPC method;
Click on “Add method” in the opened window;
Fill in “Method name” field. If the method has arguments, click on “Add argument” button and select the type of argument. Fill in the “Value” field and click “Apply” button.
Click the “pencil” icon in the “RPC methods” section to add new RPC method;
Click on “Add method” in the opened window;
Fill in “Method name” field. If the method has arguments, click on “Add argument” button and select the type of argument. Fill in the “Value” field and click “Apply” button.
Also, every telemetry and attribute parameter has built-in GET and SET RPC methods out of the box, so you don’t need to configure it manually. See the guide.
Attribute updates allow you to update node values in the OPC-UA server.
You can add new attribute updates in the “Attribute updates” section of the device configuration page.
As an example, we will use Prosys OPC-UA Simulation Server, which is available at opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer.
The server has the following structure:
Example: Relay Controlling (Relative Path)
We are interested in node “Relay”, we added this node as a telemetry parameter with the key relay. We used
telemetry so that later it would be convenient for us to see if the value we changed using the attribute update
has changed. You, also, can add this telemetry datapoint to the device configuration or use the reserved get RPC
method to check the value of the node.
Let’s add an attribute update to our configuration. For this purpose, follow these steps:
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Make sure you have configured and connected device (if you do not know how to do it, see Getting Started guide or Connection settings and Data mapping sections of this guide). Click on the “Pencil” icon on a device you want to configure attribute updates for.
Scroll down to the “Attribute updates” section and click on the “Pencil” icon to edit the attribute updates.
Click on the “Add attribute update” button. In our case, we will add relay attribute update, so the “Key” field, enter relay, select the “Type” as Path, and in the “Value” field enter ${Relay}. This is a relative path to the device node we want to update.
Remember to save your changes by clicking the “Apply” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Make sure you have configured and connected device (if you do not know how to do it, see Getting Started guide or Connection settings and Data mapping sections of this guide). Click on the “Pencil” icon on a device you want to configure attribute updates for.
Scroll down to the “Attribute updates” section and click on the “Pencil” icon to edit the attribute updates.
Click on the “Add attribute update” button. In our case, we will add relay attribute update, so the “Key” field, enter relay, select the “Type” as Path, and in the “Value” field enter ${Relay}. This is a relative path to the device node we want to update.
Remember to save your changes by clicking the “Apply” button.
Now we can check if the attribute update works. Go to “Entities” → “Devices” → select a created device → “Attributes” tab →
select “Shared attributes” → click on the “+” icon and add relay attribute with type “Boolean” set it
to “True”.
Now, let’s check the value of the relay node. In the selected device, go to the “Last telemetry” tab and check the
value of the relay telemetry. It should be true since we set the shared attribute to true.
Try to change the value of the relay shared attribute to false. After a few seconds, you should see that the
relay telemetry value has changed to false, which means that the attribute update worked correctly.
Full configuration for OPC-UA connector for the examples above will look like this:
Attribute updates allow you to update node values in the OPC-UA server.
You can add new attribute updates in the “Attribute updates” section of the device configuration page.
As an example, we will use Prosys OPC-UA Simulation Server, which is available at opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer.
The server has the following structure:
Example: Fan Speed (Absolute Path)
We are interested in node “FanSpeed”, we added this node as a telemetry parameter with the key fan_speed. We used
telemetry so that later it would be convenient for us to see if the value we changed using the attribute update
has changed. You, also, can add this telemetry datapoint to the device configuration or use the reserved get method
to check the value of the node.
Let’s add an attribute update to our configuration. For this purpose, follow these steps:
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Make sure you have configured and connected device (if you do not know how to do it, see Getting Started guide or Connection settings and Data mapping sections of this guide). Click on the “Pencil” icon on a device you want to configure attribute updates for.
Scroll down to the “Attribute updates” section and click on the “Pencil” icon to edit the attribute updates.
Click on the “Add attribute update” button. In our case, we will add fan_speed attribute update, so the “Key” field, enter fan_speed, select the “Type” as Path, and in the “Value” field enter ${Root\.Objects\.DemoDeviceInfo\.FanSpeed}. This is an absolute path to the OPC-UA server node we want to update.
Remember to save your changes by clicking the “Apply” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Make sure you have configured and connected device (if you do not know how to do it, see Getting Started guide or Connection settings and Data mapping sections of this guide). Click on the “Pencil” icon on a device you want to configure attribute updates for.
Scroll down to the “Attribute updates” section and click on the “Pencil” icon to edit the attribute updates.
Click on the “Add attribute update” button. In our case, we will add fan_speed attribute update, so the “Key” field, enter fan_speed, select the “Type” as Path, and in the “Value” field enter ${Root\.Objects\.DemoDeviceInfo\.FanSpeed}. This is an absolute path to the OPC-UA server node we want to update.
Remember to save your changes by clicking the “Apply” button.
Now we can check if the attribute update works. Go to “Devices” → select a created device → “Attributes” tab →
select “Shared attributes” → click on the “+” icon and add fan_speed attribute with type “Integer” set it
to “90”.
Now, let’s check the value of the fan speed node. In the selected device, go to the “Last telemetry” tab and check the
value of the fan_speed telemetry. It should be 90 since we set the shared attribute to 90.
Try to change the value of the fan_speed shared attribute to 30. After a few seconds, you should see that the
fan_speed telemetry value has changed to 30, which means that the attribute update worked correctly.
Full configuration for OPC-UA connector for the examples above will look like this:
Attribute updates allow you to update node values in the OPC-UA server.
You can add new attribute updates in the “Attribute updates” section of the device configuration page.
As an example, we will use Prosys OPC-UA Simulation Server, which is available at opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer.
The server has the following structure:
Example: Text Message Editing (Identifier)
We are interested in node “TextMessage”, we added this node as a telemetry parameter with the key text_message.
We used telemetry so that later it would be convenient for us to see if the value we changed using the attribute update
has changed. You, also, can add this telemetry datapoint to the device configuration or use the reserved get method
to check the value of the node.
Let’s add an attribute update to our configuration. For this purpose, follow these steps:
Go to “Entities” → “Gateways” in the right sidebar.
Select your gateway.
Click on the “Connectors” tab.
Select the OPC-UA connector and click on the “Data mapping” tab.
Make sure you have configured and connected device (if you don’t know how to do it, see Getting Started guide or
Connection settings and Data mapping sections of this guide). Click on the “Pencil” icon on a device you want to
configure attribute updates for.
Scroll down to the “Attribute updates” section and click on the “Pencil” icon to edit the attribute updates.
Click on the “Add attribute update” button. In our case, we will add text_message attribute update, so the “Key”
field, enter text_message, select the “Type” as Identifier, and in the “Value” field enter
${ns=2;i=1005}. This is an identifier of the OPC-UA server node we want to update.
Remember to save your changes by clicking the “Apply” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Make sure you have configured and connected device (if you do not know how to do it, see Getting Started guide or Connection settings and Data mapping sections of this guide). Click on the “Pencil” icon on a device you want to configure attribute updates for.
Scroll down to the “Attribute updates” section and click on the “Pencil” icon to edit the attribute updates.
Click on the “Add attribute update” button. In our case, we will add text_message attribute update, so the “Key” field, enter text_message, select the “Type” as Identifier, and in the “Value” field enter ${ns=2;i=1005}. This is an identifier of the OPC-UA server node we want to update.
Remember to save your changes by clicking the “Apply” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Make sure you have configured and connected device (if you do not know how to do it, see Getting Started guide or Connection settings and Data mapping sections of this guide). Click on the “Pencil” icon on a device you want to configure attribute updates for.
Scroll down to the “Attribute updates” section and click on the “Pencil” icon to edit the attribute updates.
Click on the “Add attribute update” button. In our case, we will add text_message attribute update, so the “Key” field, enter text_message, select the “Type” as Identifier, and in the “Value” field enter ${ns=2;i=1005}. This is an identifier of the OPC-UA server node we want to update.
Remember to save your changes by clicking the “Apply” button.
Now we can check if the attribute update works. Go to “Devices” → select a created device → “Attributes” tab →
select “Shared attributes” → click on the “+” icon and add text_message attribute with type “String” set
it to “Hello from Gateway!”.
Now, let’s check the value of the text message node. In the selected device, go to the “Last telemetry” tab and check the
value of the text_message telemetry. It should be Hello from Gateway! since we set the shared attribute to Hello from Gateway!.
Try to change the value of the text_message shared attribute to Hello from <your_name>!. After a few seconds,
you should see that the text_message telemetry value has changed to Hello from <your_name>!, which means that the
attribute update worked correctly.
Full configuration for OPC-UA connector for the examples above will look like this:
RPC to Device allows you to execute an OPC-UA server method on a specific device.
It is important to note that the method you are calling must be defined on the OPC-UA server.
As an example, we will use ThingsBoard OPC-UA Demo Server, which can be run using Docker and the following command:
1
docker run -it-p 4840:4840 thingsboard/tb-gw-opcua-server:latest
The server has the following endpoint URL: opc.tcp://0.0.0.0:4840/freeopcua/server/.
Example: Multiplying Numbers
We are interested in “multiply” method node which will multiply two numbers that we will pass as arguments.
To call this method, first we need to configure the OPC-UA connector to support RPC calls. For this purpose, follow
these steps:
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Make sure you have configured and connected device (if you do not know how to do it, see Getting Started guide or Connection settings and Data mapping sections of this guide). Click on the “Pencil” icon on a device you want to configure RPC method for.
Scroll down to the “RPC methods” section and click on the “Pencil” icon to edit the RPC methods.
Click on the “Add method” button. In our case, we will add the multiply method, so fill in the “Method” field with multiply and in the “Arguments” field, enter the arguments that the method accepts, in our case it is two numbers, feel free to enter any numbers.
Remember to save your changes by clicking the “Apply” button.
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “Data mapping” tab. Make sure you have configured and connected device (if you do not know how to do it, see Getting Started guide or Connection settings and Data mapping sections of this guide). Click on the “Pencil” icon on a device you want to configure RPC method for.
Scroll down to the “RPC methods” section and click on the “Pencil” icon to edit the RPC methods.
Click on the “Add method” button. In our case, we will add the multiply method, so fill in the “Method” field with multiply and in the “Arguments” field, enter the arguments that the method accepts, in our case it is two numbers, feel free to enter any numbers.
Remember to save your changes by clicking the “Apply” button.
We are done with configuration, so let’s check how to call the method. In the RPC Debug Terminal widget, run the
following command:
1
multiply
In this case, the method will be called with the arguments that we specified in the configuration (default arguments).
As you remember, in our case, we enter 5 and 4, so the result is:
Also, we can pass arguments to the method directly from the RPC Debug Terminal widget using the following command:
1
multiply [3,4]
Response:
Full configuration for OPC-UA connector for the example above will look like this:
Every telemetry and attribute parameter has GET and SET RPC methods out of the box, so you don’t need to configure
them manually.
As an example, we will use Prosys OPC-UA Simulation Server, which is
available at opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer. The server has the following structure:
We are interested in node “Relay” that have ns=3;i=1012 identifier, we added this node as a telemetry parameter
with the key relay and as a path we used the node identifier ${ns=3;i=1012}, so the configuration for this
telemetry will look like this:
RPC To Connector allows you to send a command to the connector from the ThingsBoard IoT Gateway UI.
It is important to note that the method you are calling must be defined on the OPC-UA server.
Please note: The RPC To Connector will execute the method on every device that has the OPC-UA connector configured.
As an example, we will use ThingsBoard OPC-UA Demo Server, which can be run using Docker and the following command:
1
docker run -it-p 4840:4840 thingsboard/tb-gw-opcua-server:latest
The server has the following endpoint URL: opc.tcp://0.0.0.0:4840/freeopcua/server/.
Example: Relay Controlling
Let’s see a practical example of using RPC To Connector. On our OPC-UA server, we have “set_relay” method that
turns on or off the relay. The method accepts a boolean argument, where true turns on the relay and false turns
it off. To call this method, use the following steps:
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “RPC” icon. Make sure you have configured and connected device (if you do not know how to do it, see Getting Started guide or Connection settings and Data mapping sections of this guide).
Go to “Entities” → “Gateways” in the right sidebar and select your gateway.
Click on the “Connectors configuration” button on the right side menu.
Select the created OPC-UA connector, click on the “RPC” icon. Make sure you have configured and connected device (if you do not know how to do it, see Getting Started guide or Connection settings and Data mapping sections of this guide).
Let’s first turn on the relay. To do this, fill in the “Method” field with set_relay and in the “Arguments” field
enter true, then click on the “Send” button.
As you can see, the response contains true, which means that the method was executed successfully and the relay is
now on:
And finally, let’s turn off the relay. To do this, fill in the “Method” field with set_relay and in the
“Arguments” field enter false, then click on the “Send” button:
Result:
Full configuration for OPC-UA connector for the example above will look like this:
The advanced configuration section provides a detailed overview of all available parameters for the OPC-UA connector.
Server
The server object specifies the target OPC-UA server and how the gateway interacts with it.
Parameter
Default value
Description
server
The server object specifies the target OPC-UA server and how the gateway interacts with it.
server.url
Hostname or ip address of OPC-UA server.
server.timeoutInMillis (in ms)
5000
Timeout in seconds for connecting to OPC-UA server.
server.scanPeriodInMillis (in ms)
3600000
Period in milliseconds for scanning the OPC-UA server for changes. If your OPC-UA server structure doesn’t change often, you can set a big period for gateway resource saving.
server.pollPeriodInMillis (in ms)
5000
Period in milliseconds to poll the server. If enableSubscriptions is set to true, pollPeriodInMillis does not affect data reading.
server.enableSubscriptions
true
If true - the gateway will subscribe to interesting nodes and wait for data update and if false - the gateway will rescan OPC-UA server every scanPeriodInMillis.
server.subCheckPeriodInMillis (in ms)
100
Period to check the subscriptions in the OPC-UA server.
server.subDataMaxBatchSize
1000
Maximum number of data items in a single subscription update. This is useful for performance optimization.
server.subDataMinBatchCreationTimeMs (in ms)
200
Minimum time in milliseconds to wait before creating a new batch of data items in a subscription update. This helps to reduce the number of updates sent to ThingsBoard.
server.subscriptionProcessBatchSize
2000
Maximum number of data items to process in a single batch when handling subscription updates. This is useful for performance optimization.
server.sessionTimeoutInMillis (in ms)
120000
Session timeout in milliseconds. This is the maximum time the session can be inactive before it is closed by the server.
server.showMap
false
If true - the gateway will show a map of OPC-UA server nodes in the terminal. This is useful for debugging and understanding the structure of the OPC-UA server.
The identity object specifies the authentication method used to connect to the OPC-UA server. It can be one of the
following: anonymous, basic, certificates.
The Mapping list is used to configure how the OPC-UA connector will map data from the OPC-UA server to
ThingsBoard devices. It allows you to specify which nodes from the OPC-UA server will be used as device names,
device profiles, device attributes, and telemetry data.
Device mapping
Parameter
Description
mapping[].deviceNodeSource
Source of the device node, can be: path, identifier or constant.
mapping[].deviceNodePattern
Absolute or relative path, or identifier, which is used for looking up the node for a current device. Paths to the device name, profile, attributes, and telemetry can be specified relative to this node.
mapping[].deviceInfo
Device info object using for configuring device name and profile.
mapping[].deviceInfo.deviceNameExpressionSource
Source of the device name (can be path, identifier or constant).
mapping[].deviceInfo.deviceNameExpression
Path to a variable with device name, which is used for looking up the device name in a variable.
mapping[].deviceInfo.deviceProfileSource
Source of the device profile (can be path, identifier or constant).
mapping[].deviceInfo.deviceProfileExpression
Path to a variable with device profile, is used for looking the device profile in some variable.
mapping[].reportStrategy
Report strategy object using for configuring report strategy for device.
Example of the device mapping configuration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"mapping":[{"deviceNodeSource":"path","deviceNodePattern":"Root\\.Objects\\.MyObject","deviceInfo":{"deviceNameExpression":"OPCUA New Advanced Device","deviceNameExpressionSource":"path","deviceProfileExpression":"some other default 1","deviceProfileExpressionSource":"constant"},"attributes":[],"timeseries":[],"attributes_updates":[],"rpc_methods":[],},]
Device attributes and time series
Parameter
Description
mapping[].attributes[]
List of attributes that will be sent to the ThingsBoard platform instance.
mapping[].attributes[].key
Key name of the attribute in ThingsBoard. It can be specified as a static value.
mapping[].attributes[].type
Type of the expression in the value field (can be path, identifier or constant).
mapping[].attributes[].value
Value of the attribute that will be sent to the platform. It should be specified depending on the selected type (path, identifier or constant).
mapping[].attributes[].reportStrategy
(Optional) Report strategy for the attributes data. If not specified, the device report strategy will be used.
mapping[].timeseries[]
List of telemetry data that will be sent to the ThingsBoard platform instance.
mapping[].timeseries[].key
Key name of the telemetry data in ThingsBoard. It can be specified as a static value.
mapping[].timeseries[].type
Type of the expression in the value field (can be path, identifier or constant).
mapping[].timeseries[].value
Value of the telemetry data that will be sent to the platform. It should be specified depending on the selected type (path, identifier or constant).
mapping[].timeseries[].timestampLocation
(Optional) Location of the timestamp for the attribute. If not specified, the current time will be used. Can be: sourcetimestamp, servertimestamp
mapping[].timeseries[].reportStrategy
(Optional) Report strategy for the time series data. If not specified, the device report strategy will be used.
Example of the attributes and telemetry configuration:
A Path type refers to the hierarchical address within the OPC-UA server’s namespace. It is used to navigate to specific
nodes in the server.
The path for the attribute value can be absolute or relative.
Absolute path
An absolute path specifies the full hierarchical address from the root of the OPC-UA server’s namespace to the
target node.
Example:
Gateway expects the node to exist and the value of “Root.Objects.TempSensor.Temperature” to be 23.54.
Expression:
${Root\\.Objects\\.TempSensor\\.Temperature}
Converted data:
23.54
Relative path
A relative path specifies the address relative to a predefined starting point in the OPC-UA server’s namespace.
Example:
Gateway expects the node to exist and the value of “Root.Objects.TempSensor.Temperature” to be 23.56.
Device Node Expression:
Root\\.Objects\\.TempSensor
Expression:
${Temperature}
Converted data:
23.56
Identifier types
An Identifier type is a unique ID assigned to a node within the OPC-UA server. It is used to directly reference
specific nodes without navigating through the namespace hierarchy.
The Identifier type in the OPC-UA connector configuration can take various forms to uniquely reference nodes
in the OPC-UA server’s address space. Identifiers can be of different types, such as numeric (i), string (s),
byte string (b), and GUID (g). Below is an explanation of each identifier type with examples.
Numeric Identifier (i)
A numeric identifier uses an integer value to uniquely reference a node in the OPC-UA server.
Expression:
${ns=2;i=1235}
Converted data:
21.34
String Identifier (s)
A string identifier uses a string value to uniquely reference a node in the OPC-UA server.
Expression:
${ns=3;s=TemperatureSensor}
Converted data:
21.34
Byte String Identifier (b)
A byte string identifier uses a byte string to uniquely reference a node in the OPC-UA server. This is useful for binary data that can be converted to a byte string.
Expression:
${ns=3;b=Q2xpZW50RGF0YQ==}
Converted data:
21.34
GUID Identifier (g)
A GUID identifier uses a globally unique identifier (GUID) to uniquely reference a node in the OPC-UA server.
Expression:
${ns=3;g=550e8400-e29b-41d4-a716-446655440000}
Converted data:
21.34
Next steps
Explore guides related to main ThingsBoard features: