diff --git a/_includes/templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/reserved-rpc-foreign-node.md b/_includes/templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/reserved-rpc-foreign-node.md new file mode 100644 index 0000000000..c97aeabedb --- /dev/null +++ b/_includes/templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/reserved-rpc-foreign-node.md @@ -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} diff --git a/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-identifier-device-node.md b/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-identifier-device-node.md new file mode 100644 index 0000000000..889c74900b --- /dev/null +++ b/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-identifier-device-node.md @@ -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": [] + } + ] +} +``` \ No newline at end of file diff --git a/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-identifier.md b/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-identifier.md index 11b6df4ab1..541037b0bb 100644 --- a/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-identifier.md +++ b/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-identifier.md @@ -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. diff --git a/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-relative-path.md b/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-relative-path.md index 7c27eca79f..0b70242e5f 100644 --- a/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-relative-path.md +++ b/_includes/templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-relative-path.md @@ -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, @@ -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. diff --git a/docs/iot-gateway/config/opc-ua.md b/docs/iot-gateway/config/opc-ua.md index 8ef805706b..47e4c21e7e 100644 --- a/docs/iot-gateway/config/opc-ua.md +++ b/docs/iot-gateway/config/opc-ua.md @@ -154,6 +154,7 @@ Device name/profile with Absolute Path%,%devicenameandprofileabso Device name/profile with Relative Path%,%devicenameandprofilerelativepath%,%templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/device-name-and-profile-relative-path.md%br% Device name/profile with Identifier%,%devicenameandprofileidentifier%,%templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/device-name-and-profile-identifier.md%br% Attributes/Time series with Relative Path%,%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%,%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%,%attributestimeseriesabsolutepath%,%templates/iot-gateway/opcua-connector/examples/time-series-and-attributes/attributes-time-series-absolute-path.md%br% Attributes/Time series with Identifier%,%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 %} @@ -236,6 +237,7 @@ Attribute Updateswith Absolute Path%,%sharedabsolute%,%templates/ Attribute Updateswith Identifier%,%sharedidentifier%,%templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/shared-attributes-with-identifier.md%br% RPC to Device%,%rpctodevice%,%templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/rpc-to-device.md%br% Reserved RPCs%,%reservedrpc%,%templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/reserved-rpc.md%br% +Reserved RPCs to foreign nodes%,%reservedrpctoforeignnodes%,%templates/iot-gateway/opcua-connector/examples/shared-attributes-rpc/reserved-rpc-foreign-node.md%br% RPC to Connector%,%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 %} diff --git a/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-1-preview.png b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-1-preview.png new file mode 100644 index 0000000000..e4271e75df Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-1-preview.png differ diff --git a/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-1.png b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-1.png new file mode 100644 index 0000000000..e4271e75df Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-1.png differ diff --git a/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-2-preview.png b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-2-preview.png new file mode 100644 index 0000000000..28c8cb669a Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-2-preview.png differ diff --git a/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-2.png b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-2.png new file mode 100644 index 0000000000..28c8cb669a Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-2.png differ diff --git a/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-3-preview.png b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-3-preview.png new file mode 100644 index 0000000000..5d4b4129da Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-3-preview.png differ diff --git a/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-3.png b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-3.png new file mode 100644 index 0000000000..5d4b4129da Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/attributes-time-series-relative-path-device-identifier-3.png differ diff --git a/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-1.png b/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-1.png new file mode 100644 index 0000000000..52d334ec19 Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-1.png differ diff --git a/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-2.png b/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-2.png new file mode 100644 index 0000000000..18c4d5dbe5 Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-2.png differ diff --git a/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-3.png b/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-3.png new file mode 100644 index 0000000000..179d991f93 Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-get-foreign-nodes-result-3.png differ diff --git a/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-set-foreign-nodes-result-1.png b/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-set-foreign-nodes-result-1.png new file mode 100644 index 0000000000..db1f0a715d Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/opc-ua-reserved-rpc-set-foreign-nodes-result-1.png differ diff --git a/images/gateway/opc-ua-connector/examples/result-device-overview-relative-path-device-identifier.png b/images/gateway/opc-ua-connector/examples/result-device-overview-relative-path-device-identifier.png new file mode 100644 index 0000000000..1b077ea0b7 Binary files /dev/null and b/images/gateway/opc-ua-connector/examples/result-device-overview-relative-path-device-identifier.png differ