Add OPC-UA Connection - How To
You can add an OPC-UA connection through the Kelvin UI, Kelvin SDK and Kelvin API.
Connections was formerly called Bridges. You will find the Kelvin SDK and Kelvin API commands still refer to Connections as Bridges.
Kelvin UI
You can watch this short demo video or read the full step-by step written tutorial below.
To start click on the Connections menu option from the left side bar menu.
click on the Create Connection button.
Step 1
Select the OPC UA option and click Next.
Step 2
Type in a memorable name in the Connection Display Name text input. You can use any letters, numbers and special characters.
The Connection Name text input will be automatically converted and filled in as you type in the Connection Display Name section. The conversion ensures the Connection Name only contains lowercase alphanumeric characters and ., _ or - characters.
Then select which Cluster to deploy the new Connector to.
It is important that the asset is reachable from the selected Cluster.
Step 3
Configure the OPC-UA connection to the asset. There are a number of optional and mandatory parameters to fill in.
For the optional parameters, if you do not fill in any values, the default values will be used.
| Parameter | Options | Description | Default | Mandatory |
|---|---|---|---|---|
| Read Timeout | Numeric value (in milliseconds) | Specifies the maximum time to wait for a response when reading data from an OPC UA server. | No | |
| Write Timeout | Numeric value (in milliseconds) | Specifies the maximum time to wait for a response when writing data to an OPC UA server. | No | |
| Watchdog Timeout | Numeric value (in milliseconds) | Defines the timeout for the watchdog mechanism, which monitors the health of the connection to the OPC UA server. | No | |
| Session Name | String | A custom name for the session, used for identification and logging purposes. | No | |
| Endpoint URL | String (opc.tcp://localhost:48010) | The URL of the OPC UA server endpoint to connect to. | Yes | |
| Verify SSL | Boolean (True/False) | Determines whether SSL certificates are verified when connecting to an OPC UA server over a secure channel. | Yes | |
| Security Policy | String (specifying security type) | Specifies the security policy for the connection, such as None, Basic256Sha256, etc. This defines the level of security like encryption and data integrity. |
Yes | |
| Message Security | String (specifying security mode) | Determines the security mode of the messages, such as None, Sign, or SignAndEncrypt. |
None | Yes |
| Authentication Method | String (specifying method) | Specifies the method of authentication used when connecting to the OPC UA server, such as Credentials or Certificate. |
None | Yes |
| Username | String | The username used for authentication if the Credentials option is chosen in Authentication Method. |
Depends | |
| Password | String | The password corresponding to the username if the Credentials option is chosen in Authentication Method. |
Depends | |
| Certificates | File path or certificate object | The path to the certificate file(s) or the certificate object itself if the Certificate option is chosen in Authentication Method. |
Depends | |
| Key Password | String | The password for the private key associated with the client's certificate if the Certificate option is chosen in Authentication Method. |
Depends |
Step 4
Download, complete, and upload the available template to define the mapping connections between the OPC UA address and the Asset/Data Stream.
You can only upload one file. Multiple file uploads is not allowed and only the latest selected file will be used.
Do not modify the header in the downloaded template file. In the next step the header will be checked to ensure the csv structure is correct. Start adding your data from row 2 onwards.
| Header | Description | Example | Mandatory |
|---|---|---|---|
| DataStream Name | The Kelvin Data Stream name (must be lowercase alphanumeric with no spaces) | water-flow | Yes |
| Asset Name | The Kelvin Asset name (must be lowercase alphanumeric with no spaces) | well-01 | Yes |
| DataStream Type | The type of data (boolean, number, object and string) | number | No |
| Access | Read/Write (RW) or Read Only (RO) | RO | Yes |
| Storage | Location of the storage; "none", "node", "node-and-cloud" | node-and-cloud | No |
| Node ID | OPC UA data address | ns=4;i=1002 | Yes |
| Polling Rate (in seconds) | How often to pull the data from the asset | 30 | Yes |
Step 5
The file will now be validated before you can initiate the connection with the following checks;
- Structure
- All required columns are present
- Columns naming is correct
- File has content below the header
- Content
- Required Fields (Data Stream Name, Asset Name and Access fields are properly filled)
- Content Matches the patterns and is valid content
- No duplicate content has been detected
- System
- All Assets exist on the system
- All Data Stream exist on the system
If there are any errors, you can view the details by clicking on the Show Errors button.
After looking at the error list, you will need to correct your csv file and then return to Step 4 to re-upload. The new file will then be checked and validated again.
When everything is validated, then you can click on Connect button to deploy the Connector to the Cluster. It will start automatically, connect to the asset and start collecting data.
Then in Kelvin UI under Connections you will see your Connection deployed and running.
If you have any issues in the deployment and the Add Connection fails to run, then you can check its logs.
Kelvin SDK
You can add a new OPC-UA Connection using the following command;
Make sure you are logged into your Kelvin before running.
$ kelvin bridge deploy --help
Usage: kelvin bridge deploy [OPTIONS]
Deploy a bridge with specified parameters. e.g. kelvin bridge deploy
--bridge-name "test-bridge" --cluster-name "my-node" --protocol "opc-ua"
--bridge-config "/path/to/app.yaml"
Options:
--cluster-name TEXT The name of the cluster (or node) to deploy the bridge
to. [required]
--bridge-name TEXT The friendly name of the bridge. [required]
--protocol TEXT The protocol to be used by the bridge. May be one of:
[opc-ua, mqtt, modbus, roc] [required]
--bridge-title TEXT The title of the bridge.
--bridge-config PATH The configuration file (e.g. app.yaml) to be used by
the bridge. [required]
-v, --verbose Display all executed steps to the screen.
--help Show this message and exit.
| Option | Description |
|---|---|
| cluster-name | This is the name of the Kelvin Cluster where you want to deploy the Connection. (Note: This is not the Title but the name which can not include spaced). |
| bridge-name | This is the name for the Connection. It must be all lowercase and cannot include spaces and any special characters except "-" and "_". It also must start with a alphabet letter. |
| protocol | This will be opc-ua |
| bridge-title | This is a friendly name for the Connection. It can include special characters and spaces. If using spaces, make sure to wrap your title with quotation marks. |
| bridge-config | This is a file with all the Kelvin Asset / Kelvin Data Stream information and their links to the asset addresses. |
Create a yaml file called opcua.yaml and put the following information inside;
app:
bridge:
configuration:
authentication:
type: none
connection:
endpoint_url: opc.tcp://uademo.prosysopc.com:53530/OPCUA/SimulationServer
message_security: none
security_policy: none
verify_ssl: false
language:
cpp:
dso: kelvin_bridge_opcua_client/kelvin_bridge_opcua_client.so
type: cpp
logging_level: INFO
metrics_map:
- access: RO
asset_name: docs-demo-bridge
configuration:
node: ns=4;i=1002
polling_rate: 30
scale_multiplier:
data_type: raw.float64
name: docs-demo-bridge-opc-ua
protocol: OPCUA
system_packages:
- libxml2
- libcurl3-gnutls
type: bridge
info:
description: Kelvin Bridge OPCUA Client
name: kelvin-bridge-opcua-client
title: Kelvin Bridge OPCUA Client
version: 3.3.3
spec_version: 4.10.0
Then run the command in the terminal;
kelvin bridge deploy --cluster-name docs-demo-cluster-k3s --bridge-name docs-demo-bridge-opc-ua --protocol opc-ua --bridge-title "Docs Demo Bridge OPC-UA" --bridge-config opcua.yaml --verbose
You should see a response similar to this;
[kelvin.sdk][2023-12-07 15:42:46][R]
Bridge "docs-demo-bridge-opc-ua" successfully deployed.
Then you can check the status with kelvin bridge list command.
It will only show here when it is running on the edge. If it is pending deploy, it will not show here. You can see the actual status of the Connections in the Kelvin UI.
[kelvin.sdk][2023-12-07 20:08:26][I] Retrieving bridges..
[kelvin.sdk][2023-12-07 20:08:28][I] *************************** Bridges ***************************
+-------------------------------+-------------------------------------+------------------------+-------------------------------+------------+----------------------------------+----------------------------------+
| Name | Title | Node name | Workload name | Protocol | Created | Updated |
|-------------------------------+-------------------------------------+------------------------+-------------------------------+------------+----------------------------------+----------------------------------|
| docs-demo-bridge-opc-ua | Docs Demo Bridge OPC-UA | docs-demo-cluster-k3s | docs-demo-bridge-opc-ua | opc-ua | 2023-12-07 12:38:39.045767+00:00 | 2023-12-07 12:38:39.045767+00:00 |
+-------------------------------+-------------------------------------+------------------------+-------------------------------+------------+----------------------------------+----------------------------------+
Or in Kelvin UI under Connections you will see your Connection deployed and running.
If you have any issues in the deployment and the kelvin bridge deploy fails to run, then you can check its logs.
Kelvin API
The API request POST for adding a new OPC-UA Connection can be done with the /bridge/deploy request POST.
You can easily make a new OPC-UA Connection by using the Request Body like this;
{
"name": "docs-demo-bridge-opc-ua",
"title": "Docs Demo Bridge OPC-UA",
"cluster_name": "docs-demo-cluster-k3s",
"workload_name": "docs-demo-bridge-opc-ua",
"protocol": "opc-ua",
"payload": {
"configuration": {
"authentication": {
"type": "none"
},
"connection": {
"endpoint_url": "opc.tcp://uademo.prosysopc.com:53530/OPCUA/SimulationServer",
"message_security": "none",
"security_policy": "none",
"verify_ssl": false
}
},
"logging_level": "INFO",
"metrics_map": [
{
"access": "RO",
"asset_name": "docs-demo-bridge",
"configuration": {
"node": "ns=4;i=1002",
"polling_rate": 30,
"scale_multiplier": null
},
"data_type": "raw.float64",
"name": "docs-demo-bridge-opc-ua"
}
]
}
}
Then in Kelvin UI under Connections you will see your Connection deployed and running.
If you have any issues in the deployment and the kelvin bridge deploy fails to run, then you can check its logs.










