Skip to content
Open
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
Every telemetry and attribute parameter comes with built-in `get` and `set` RPC methods, so you don’t need to configure them manually.

Additionally, you can use the reserved RPC methods to access any node on the OPC-UA server-even if it doesn’t belong to a specific device. This is especially useful when management or control nodes are located outside the device’s node tree.
We will set the device node to `Root\.Objects\.DemoDevice`, but we will access the `TextMessage` node located at `Root\.Objects\.DemoDeviceInfo\.TextMessage`, which is outside the device node tree.
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:

![image](/images/gateway/opc-ua-connector/examples/opc-ua-server-structure-overview-4.png)

We’re interested in the "**TextMessage**" which has the "**[Path](/docs/iot-gateway/config/opc-ua/#absolute-path)**" - `Root\.Objects\.DemoDeviceInfo\.TextMessage`,
and does not belong to the device node tree. We added this node as a telemetry parameter
with the key `textmessage`, so it would be easy to verify later whether the value changed after calling the reserved `set` RPC method.

```json
"timeseries": [
{
"key": "textmessage",
"type": "path",
"path": "${Root\\.Objects\\.DemoDeviceInfo\\.TextMessage}"
}
]
```
{: .copy-code}

Let's check the value of the textmessage node using the reserved `get` method. To get the current value of textmessage node,
run the query in RPC debug terminal:

```bash
get Root\\.Objects\\.DemoDeviceInfo\\.TextMessage;
```
{: .copy-code}

Response:

```json
{"result":{"value":"HI"}}
```
{: .copy-code}

![image](/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-1.png)

So, the `get` method returns the current value of the textmessage node, and we can see that the textmessage is `HI`.

{% capture difference %}
The RPC Debug Terminal is used only for example purpose, so you can use any other widget that supports RPC calls.
{% endcapture %}
{% include templates/info-banner.md content=difference %}

To set the value of the textmessage node and change its value, run the query:

```bash
set Root\\.Objects\\.DemoDeviceInfo\\.TextMessage; New Message
```
{: .copy-code}

Response:

```json
{"result":{"value":"New Message"}}
```
{: .copy-code}

And as you can see, from the screenshot below, the textmessage telemetry value has changed to `New Message`:

![image](/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-set-foreign-nodes-result-1.png)

Also, let's check the value of the textmessage telemetry again:

```bash
get Root\\.Objects\\.DemoDeviceInfo\\.TextMessage;
```
{: .copy-code}

Response:

```json
{"result":{"value":"New Message"}}
```
{: .copy-code}

![image](/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-2.png)

Full configuration for OPC-UA connector for the examples above will look like this:

```json
{
"server": {
"url": "opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer",
"timeoutInMillis": 5000,
"scanPeriodInMillis": 3600000,
"enableSubscriptions": true,
"subCheckPeriodInMillis": 100,
"showMap": false,
"security": "Basic128Rsa15",
"identity": {
"type": "anonymous"
},
"pollPeriodInMillis": 5000
},
"mapping": [
{
"deviceNodePattern": "Root\\.Objects\\.DemoDevice",
"deviceNodeSource": "path",
"deviceInfo": {
"deviceNameExpression": "Demo Device",
"deviceNameExpressionSource": "constant",
"deviceProfileExpression": "default",
"deviceProfileExpressionSource": "constant"
},
"attributes": [],
"attributes_updates": [],
"timeseries": [
{
"key": "textmessage",
"type": "path",
"value": "${Root\\.Objects\\.DemoDeviceInfo\\.TextMessage}"
}
],
"rpc_methods": []
}
]
}
```
{: .copy-code}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
Attributes and time series data can be accessed using [relative paths](/docs/iot-gateway/config/opc-ua/#relative-path)
in the OPC UA Connector. This allows you to retrieve data without needing to specify the full path to the node.
Additionally, we may use [identifiers](/docs/iot-gateway/config/opc-ua/#identifier-types) for "**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:

![image](/images/gateway/opc-ua-connector/examples/opc-ua-server-structure-overview-2.png)


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, using [relative paths](/docs/iot-gateway/config/opc-ua/#relative-path).
For this purpose, follow these steps:

{% assign attributesAndTimeSeriesRelativePathIdentifierDeviceNode = '
===
image: /images/gateway/opc-ua-connector/examples/device-name-and-profile-absolute-path-1.png,
title: Go to "**Entities**" → "**Gateways**" in the left sidebar and select your gateway.
===
image: /images/gateway/opc-ua-connector/examples/device-name-and-profile-absolute-path-2.png,
title: Click on the "**Connectors configuration**" button on the right side menu.
===
image: /images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-1.png,
title: 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](/docs/iot-gateway/getting-started/?connectorsCreation=opcua){:target="_blank"} guide or [Data mapping](/docs/iot-gateway/config/opc-ua/#data-mapping) section of this guide with respective examples).
===
image: /images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-2.png,
title: In the opened data mapping windows, click on the "**pencil**" icon next to the "**Time series**" or "**Attributes**" section.
===
image: /images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-3.png,
title: Click on the "**Add time series**" button. Fill in the "**Key**" field with `Humidity`, also select "**[Path](/docs/iot-gateway/config/opc-ua/#relative-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.
===
image: /images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-3.png,
title: Remember to save your changes by clicking the "**Apply**" button.
'
%}

{% include images-gallery.liquid showListImageTitles="true" imageCollection=attributesAndTimeSeriesRelativePathIdentifierDeviceNode %}

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:

![image](/images/gateway/opc-ua-connector/examples/result-device-overview-relative-path-device-identifier.png)

If you are using advanced configuration mode and want to set the humidity data using a relative path, you can
use the following configuration:

```json
{
"name": "OPCUA",
"server": {
"url": "opc.tcp://0.0.0.0:53530/OPCUA/SimulationServer",
"timeoutInMillis": 5000,
"scanPeriodInMillis": 3600000,
"pollPeriodInMillis": 5000,
"enableSubscriptions": false,
"subCheckPeriodInMillis": 100,
"showMap": false,
"security": "Basic128Rsa15",
"identity": {
"type": "anonymous"
}
},
"mapping": [
{
"deviceNodeSource": "identifier",
"deviceNodePattern": "ns=3;i=1008",
"deviceInfo": {
"deviceNameExpression": "Demo Device",
"deviceNameExpressionSource": "constant",
"deviceProfileExpressionSource": "constant",
"deviceProfileExpression": "default"
},
"attributes": [],
"timeseries": [
{
"key": "Humidity",
"type": "path",
"value": "${Humidity}"
}
],
"rpc_methods": [],
"attributes_updates": []
}
]
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Let's configure the humidity data in the OPC-UA connector. For this purpose, fol
{% assign attributesAndTimeSeriesIdentifierPath = '
===
image: /images/gateway/opc-ua-connector/examples/device-name-and-profile-absolute-path-1.png,
title: Go to "**Entities**" → "**Gateways**" in the right sidebar and select your gateway.
title: Go to "**Entities**" → "**Gateways**" in the left sidebar and select your gateway.
===
image: /images/gateway/opc-ua-connector/examples/device-name-and-profile-absolute-path-2.png,
title: Click on the "**Connectors configuration**" button on the right side menu.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,6 @@ We are interested in node "**Humidity**". We will use this node to retrieve the

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](/docs/iot-gateway/getting-started/?connectorsCreation=opcua){:target="_blank"} guide
or [Data mapping](/docs/iot-gateway/config/opc-ua/#subsection-attributes-and-time-series) 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](/docs/iot-gateway/config/opc-ua/#relative-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.

{% assign attributesAndTimeSeriesRelativePath = '
===
image: /images/gateway/opc-ua-connector/examples/device-name-and-profile-absolute-path-1.png,
Expand All @@ -40,7 +25,7 @@ Let's configure the humidity data in the OPC-UA connector. For this purpose, fol
title: In the opened data mapping windows, click on the "**pencil**" icon next to the "**Time series**" or "**Attributes**" section.
===
image: /images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-3.png,
title: Click on the "**Add time series**" button. Fill in the "**Key**" field with `Humidity`, also select "**[Path](/docs/iot-gateway/config/opc-ua/#absolute-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.
title: Click on the "**Add time series**" button. Fill in the "**Key**" field with `Humidity`, also select "**[Path](/docs/iot-gateway/config/opc-ua/#relative-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.
===
image: /images/gateway/opc-ua-connector/examples/attributes-time-series-absolute-path-4.png,
title: Remember to save your changes by clicking the "**Apply**" button.
Expand Down
2 changes: 2 additions & 0 deletions docs/iot-gateway/config/opc-ua.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Device name/profile with Absolute Path<small></small>%,%devicenameandprofileabso
Device name/profile with Relative Path<small></small>%,%devicenameandprofilerelativepath%,%templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/device-name-and-profile-relative-path.md%br%
Device name/profile with Identifier<small></small>%,%devicenameandprofileidentifier%,%templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/device-name-and-profile-identifier.md%br%
Attributes/Time series with Relative Path<small></small>%,%attributestimeseriesrelativepath%,%templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-relative-path.md%br%
Attributes/Time series with Relative Path and Identifier device node<small></small>%,%attributestimeseriesrelativepathdevicenode%,%templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-identifier-device-node.md%br%
Attributes/Time series with Absolute Path<small></small>%,%attributestimeseriesabsolutepath%,%templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-absolute-path.md%br%
Attributes/Time series with Identifier<small></small>%,%attributestimeseriesidentifier%,%templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-identifier.md{% endcapture %}
{% include content-toggle.liquid content-toggle-id="opcua-attributes-timeseries-examples" toggle-spec=opcua-attributes-timeseries-examples %}
Expand Down Expand Up @@ -236,6 +237,7 @@ Attribute Updates<small>with Absolute Path</small>%,%sharedabsolute%,%templates/
Attribute Updates<small>with Identifier</small>%,%sharedidentifier%,%templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/shared-attributes-with-identifier.md%br%
RPC to Device<small></small>%,%rpctodevice%,%templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/rpc-to-device.md%br%
Reserved RPCs<small></small>%,%reservedrpc%,%templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/reserved-rpc.md%br%
Reserved RPCs to foreign nodes<small></small>%,%reservedrpctoforeignnodes%,%templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/reserved-rpc-foreign-node.md%br%
RPC to Connector<small></small>%,%rpctoconnector%,%templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/rpc-to-connector.md{% endcapture %}
{% include content-toggle.liquid content-toggle-id="opcua-shared-attributes-rpc-examples" toggle-spec=opcua-shared-attributes-rpc-examples %}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.