Skip to content

Add Monitored Items in the OPC-UA Device Service

The following Monitored Items can be added:

  • Changes to data of Variable Value attributes
  • Object events

Data Change Monitored Items

Subscriptions are created by auto events and provide the ability to monitor variable and event nodes. When the monitored item's value is updated on the server, the device service will receive a notification and will post the updated value. The server will poll this monitored item at a configurable interval rate.

Define an Data Change Monitored Item in the Device properties

To set up an OPC-UA monitored item in the device properties, those properties listed below are required.

Property Name Description Valid Values
resources A list of monitored item names. String
interval The interval at which the server will poll the monitored resource in milliseconds. UInt32

This following json payload showcases how to integrate Prosys OPC-UA Simulation Server with Edge Xpert, illustrating the declaration of two Data Change Monitored Items in device properties:

{
    "apiVersion": "v2",
     "device": {
       "name" :"OPC-UA-Device",
       "description":"This device is ...",
       "serviceName": "device-opc-ua",
       "profileName": "opc-ua-profile",
       "protocols":{
          "OPC-UA":{
             "Address": "172.17.0.1:53530/OPCUA/SimulationServer",
             "Security": "None",
             "ApplicationUri": "",
             "SecurityMode": "None"
          }
       },
       "properties": {
        "opc-ua-subscriptions":[
           {
             "resources": ["SimuCounter", "SimuRandom"],
             "interval" : 3000
           }
        ]
       },
       "adminState":"UNLOCKED",
       "operatingState":"UP"
    }
}
To change the interval at which the server will poll the monitored resource, set the Interval property to your desired polling rate.

Note

The polling rate is ultimately decided by the server, meaning that it can ignore this value when creating a new subscription to the monitored resource.

Resource Subscription Methods

In addition to subscribing to resources individually as demonstrated above, there are two additional flexible methods available that leverage regular expressions for efficient pattern matching.

  • Prefix with Regex: When resources share a common prefix and require subscription, a regex pattern that includes the prefix can be used for matching.
    For example, to subscribe to all resources that start with "Simu": "resources": ["Simu*"]
  • Global Subscription: For scenarios where there's a need to monitor every available resource, a global subscription pattern is a convenient solution.
    This approach eliminates the necessity to specify each resource: "resources": [".*"]

Define an Data Change Monitored Item in the Device Profile (Deprecated)

Note

The Data Change Monitored Item support in Device Profile will be deprecated in Edge Xpert v3.0, since it is more intuitive to define them as Device properties, see the previous section for full details.

To set up an OPC-UA monitored item in the device profile, those attriutes listed below are required.

Attribute Name Description Valid Values
monitored A flag to specify whether this resource need to be monitored. Boolean
publishInterval The interval at which the server will poll the monitored resource in milliseconds. UInt32

For example, the following extract shows the declaration of an Data Change Monitored Item in a device profile:

deviceResources:
  - description: A Simulated Counter
    name: SimuCounter
    isHidden: false
    properties:
      valueType: Int32
      readWrite: R
      units: String
      defaultValue: "0"
    attributes:
      dataTypeId:
        identifier: 6
        identifierType: NUMERIC
        namespaceIndex: 0
      nodeAttribute: value
      nodeId:
        identifier: 1002
        identifierType: NUMERIC
        namespaceIndex: 3
      monitored: true
      publishInterval: 3000
  - description: The Simulated Random
    name: SimuRandom
    isHidden: false
    properties:
      valueType: Float64
      readWrite: R
      units: Double
      defaultValue: "0"
    attributes:
      dataTypeId:
        identifier: 11
        identifierType: NUMERIC
        namespaceIndex: 0
      nodeAttribute: value
      nodeId:
        identifier: 1003
        identifierType: NUMERIC
        namespaceIndex: 3
      monitored: true
      publishInterval: 3000

Event Monitored Items

Event Monitored Items provide notifications about events that have been triggered on the remote server. When an Event Type is created on a server, representing an event that might be triggered, that Event Type is assigned to an origin node. To subscribe to an Event Type, the client must subscribe to the origin node for the event. When the event is triggered, the server notifies all clients that are subscribed to the origin node of the event.

To define an Event Monitored Item, which is very similar like the way we define the Data Change Monitored Item described above.

Define an Event Monitored Item in the Device properties

For example, the following json payload shows the declaration of an Event Monitored Item in device properties:

{
    "apiVersion": "v2",
     "device": {
       "name" :"OPC-UA-Device",
       "description":"This device is ...",
       "serviceName": "device-opc-ua",
       "profileName": "opc-ua-profile",
       "protocols":{
          "OPC-UA":{
             "Address": "172.17.0.1:49947",
             "Security": "None",
             "ApplicationUri": "",
             "SecurityMode": "None"
          }
       },
       "properties": {
        "opc-ua-subscriptions":[
           {
             "resources": ["i=2253:event"],
             "interval" : 3000
           }
        ]
     },
       "adminState":"UNLOCKED",
       "operatingState":"UP"
    }
}

Define an Event Monitored Item in the Device Profile (Deprecated)

Note

The Event Monitored Item support in Device Profile will be deprecated in Edge Xpert v3.0, since it is more intuitive to define them as Device properties, see the previous section for full details.

The following extract shows the declaration of an Event Monitored Item in a device profile (deprecated):

deviceResources:
- description: Event
   name: i=2253:event
   isHidden: false
   properties:
     valueType: Object
     readWrite: R
    attributes:
      nodeAttribute: event
      nodeId:
        identifier: 2253
        identifierType: NUMERIC
        namespaceIndex: 0
      monitored: true
      publishInterval: 3000