Skip to content

OPC-UA General Example

This example usage of the OPC-UA Device Service demonstrates the onboarding of the Prosys OPC-UA Simulation Server to Edge Xpert over an insecure connection. Find an example of using a secure connection under the OPC-UA Security Example page.

A guide on configuring the OPC-UA Device Service to run with the Prosys OPC-UA Simulation Server can be found here.

Start the OPC-UA Device Service

To start the OPC-UA Device Service, enter the following command:

edgexpert up device-opc-ua

Device Onboarding

Once the OPC-UA Device Service has been started, OPC-UA devices can be onboarded to Edge Xpert using either the Edge Xpert Manager UI or through Edge Xpert REST API commands. Instructions on how to use both methods can be found below.

Please confirm the nsIndex, nodeID, and IDType attributes of the resources defined in the example device profile match the NamespaceIndex, NodeId, and IdentifierType values defined for Objects in the Prosys Simulation Server. See Using the Prosys Simulator.

Device Onboarding with the Edge Xpert Manager UI


Please refer to the Edge Xpert Manager UI Device Management capability for full details.

  1. Ensure the Edge Xpert Manager UI is started, for example:

    edgexpert up xpert-manager

  2. Open a browser and go to localhost:9090. The default username and password is admin

  3. Using the device profile upload capability, upload the provided OPC-UA example device profile at /usr/share/edgexpert/examples/device-services/opc-ua/prosys-opc-ua-simulation-server-profile.yaml

  4. Onboard the device using the device onboarding capability. The following values can be used to provision the OPC-UA Simulation device:

    Field Example Value Description Required
    Name Prosys-OPC-UA-Simulation-Server The unique name used to identify the device Required
    Description Simulated OPC-UA server Any additional information to help identify the device Optional
    Label OPC-UA Any additional information to help identify the device Optional
    Protocol OPC-UA The name of the protocol Required
    Host The OPC-UA endpoint. The provided example is the address for Prosys OPC-UA Simulation Server Required
    Security Policy None The security policy used to connect to the OPC-UA server Required
    Username The username to use when connecting to an endpoint. Default is an empty string Optional
    Password The base64 encoded password to use when connecting to an endpoint. Default is an empty string Optional
    Browse Depth 0 The maximum depth of the server tree browse for the device. If set to 0, no browse or browsePath translations take place for this device Optional
    Root Node The nodeId representing the starting point for the TranslateBrowsePathsToNodeIds Service and the full server tree browse functionality. If not specified, neither the TranslateBrowsePathsToNodeIds service nor the browse functionality are enabled for the device Optional
    Requested Session Timeout 1200000 The suggested timeout for sessions created between the Device Service and an OPC-UA server endpoint in milliseconds

    Note: Whether this value is accepted is up to the discretion of the server to which the Device Service connects. The actual value used can vary depending on the server vendor and its associated minimum and maximum supported values. Default is 1200000
    Device Profile Prosys-OPC-UA-Simulation-Server-Profile The name of the device profile uploaded above Required
    Device Service device-opc-ua The name of the appropriate device service Required
    Auto Events Interval: 5s
    OnChange: false
    ResourceName: Counter1
    Automated events to retrieve the data at specific frequencies

    Note: If OnChange is set to true, values will only be pushed if a change in value has occurred during the specified interval. If set to false, values will be sent on the specified regardless of if there has been a change.

Device Onboarding using the Edge Xpert REST API

  1. Upload the provided OPC-UA example device profile:

    curl http://localhost:59881/api/v2/deviceprofile/uploadfile -F "file=@/usr/share/edgexpert/examples/device-services/opc-ua/prosys-opc-ua-simulation-server-profile.yaml"

  2. Onboard the device using similar values as with the Edge Xpert Manager UI:

    curl -X 'POST' \
      'http://localhost:59881/api/v2/device' \
      -H 'Content-Type: application/json' \
      -d '[
        "apiVersion": "v2",
        "device": {
          "name": "Prosys-OPC-UA-Simulation-Server",
          "description": "Example OPCUA Server",
          "adminState": "UNLOCKED",
          "operatingState": "UP",
          "labels": [
          "serviceName": "device-opc-ua",
          "profileName": "Prosys-OPC-UA-Simulation-Server-Profile",
          "protocolName": "opc-ua",
          "autoEvents": [
              "interval": "5s",
              "onChange": false,
              "sourceName": "Counter1"
          "protocols": {
            "OPC-UA": {
              "BrowseDepth": "0",
              "RequestedSessionTimeout": "1200000",
              "Security": "None"

Device Data Flow

Once the device is onboarded to Edge Xpert, data flow between the Device Service and the connected device can be verified in a number of ways.

The Edge Xpert Manager UI supports Read and Write functionality for each device. Readings can also be viewed and queried within the Edge Xpert Manager UI Data Center.

Alternatively, you can read and write data with cURL commands or through REST API applications, such as Postman.

Both the GET and PUT commands can be made to the following address:

Using the example above, this could be:

For more information on the GET and PUT commands, see the Core Command Microservice.


59953 is the default port for the OPC-UA device service

Any data collected by the Device Service can then be treated like all other Edge Xpert sensor data. The data readings can be exported for data processing in a number of other applications and services. See the Supporting Services and Application Services documentation for more details.

Back to top