OPCUA Trigger Node Read multiple OPCUA Tags

I am trying to read the below configured OPC UA tags in the work flow using the OPCUA trigger node. When I configure the trigger node as Individual Items, I can get data changes via workflow. If I use the agent conf file, it does not react to any changes.

Also, how multiple tags be added to this trigger configuration?

[[triggers]]
name = ‘opcuaTrig1’
type = ‘opcua’
uri = ‘opc.tcp://10.33.4.83:49320’
samplingInterval = ‘5’
eventFilter = [‘Message’, ‘Value’]

[[triggers.monitoredItems]]
nameSpace = ‘2’
identifier = ‘s=Line1.Machine2.Global_IOT.U_iot_RunData.Speed’

Hey @Sasikumar_Rajendran,

The first place I recommend looking is the GEA’s log file. If the trigger is failing due to some error, the error should be logged. You can read the logs using the following command on the gateway:

docker logs CONTAINER_ID

Trigger errors will usually be logged shortly after the GEA launches.

Information on that command can be found here:

Also, how multiple tags be added to this trigger configuration?

You can add another [[triggers.monitoredItems]] section like so:

[[triggers]]
name = ‘opcuaTrig1’
type = ‘opcua’
uri = ‘opc.tcp://10.33.4.83:49320’
samplingInterval = ‘5’
eventFilter = [‘Message’, ‘Value’]

[[triggers.monitoredItems]]
nameSpace = ‘2’
identifier = ‘s=Line1.Machine2.Global_IOT.U_iot_RunData.Speed’

[[triggers.monitoredItems]]
nameSpace = ‘2’
identifier = ‘s=My.Other.Identifier’

For instance, if I need to get data for 500 tags from OPC, does it require 500 lines to be added to the config file ? Is there a calling function available where the set of 500 tags can be maintained and called to check its status ?

losant_log.zip (1.6 KB)
PFA of logfile

For instance, if I need to get data for 500 tags from OPC, does it require 500 lines to be added to the config file ?

Yes, you would need to add a [[triggers.monitoredItems]] entry for each identifier you want to monitor.

Is there a calling function available where the set of 500 tags can be maintained and called to check its status ?

You can use the Agent Config: Get Node to view the GEA’s current configuration. Any values that are defined in the TOML file (i.e. not as command line flags or environment variables) can also be changed using the Agent Config: Set Node. Invoking the node will cause the GEA process to restart with the new config applied.

I am trying to push the OPCUA trigger configuration using Agent Config: Set Node with Payload Path Option. The below image shows a description of the configuration passed via a virtual button. This requires more naming and formatting to be done. Is there any option to configure monitored items without naming or formatting conventions such as triggers.[0].monitoredItems.[0] etc.

Entirely objective is to automate the opcua trigger tag addition process.

You can pass the updated configuration in JSON form through a payload path or a JSON template. Whatever is handed to the Config: Set Node will deep-merge with the existing configuration (which is why you must pass a null item to delete a trigger config object).

For example, given the following triggers configuration retrieved from the Agent Config: Get Node …

{
  "triggers": [
    {
      "opcuaId": "0",
      "uri": "opc.tcp://dylans-mbp.lan:53530/OPCUA/SimulationServer",
      "securityPolicy": "None",
      "securityMode": "None",
      "samplingInterval": "100",
      "eventFilter": [],
      "name": "opcuaSimServer",
      "type": "opcua",
      "monitoredItems": [
        {
          "nameSpace": "3",
          "identifier": "i=1002"
        }
      ]
    },
    {
      "opcuaId": "0",
      "uri": "opc.tcp://dylans-mbp.lan:53530/OPCUA/SimulationServer",
      "securityPolicy": "None",
      "securityMode": "None",
      "samplingInterval": "100",
      "eventFilter": [],
      "name": "opcuaSimServer2",
      "type": "opcua",
      "monitoredItems": [
        {
          "nameSpace": "4",
          "identifier": "i=1005"
        }
      ]
    }
  ]
}

… changing the triggers property using the Config: Set Node and providing the following value …

{
  "triggers": [
    {}, // no changes to the first config
    {
      "name": "aDifferentName", // change the configName
      "monitoredItems": [
        { "nameSpace": "3" }, // change only the nameSpace of the first monitoredItem
        {"identifier": "i=1002", "nameSpace": "2"} // add another monitoredItem
      ]
    }
  ] 
}

… results in the following deep-merged triggers value …

{
  "triggers": [
    {
      "opcuaId": "0",
      "uri": "opc.tcp://dylans-mbp.lan:53530/OPCUA/SimulationServer",
      "securityPolicy": "None",
      "securityMode": "None",
      "samplingInterval": "100",
      "eventFilter": [],
      "name": "opcuaSimServer",
      "type": "opcua",
      "monitoredItems": [
        {
          "nameSpace": "3",
          "identifier": "i=1002"
        }
      ]
    },
    {
      "opcuaId": "0",
      "uri": "opc.tcp://dylans-mbp.lan:53530/OPCUA/SimulationServer",
      "securityPolicy": "None",
      "securityMode": "None",
      "samplingInterval": "100",
      "eventFilter": [],
      "name": "aDifferentName",
      "type": "opcua",
      "monitoredItems": [
        {
          "nameSpace": "3",
          "identifier": "i=1005"
        },
        {
          "nameSpace": "2",
          "identifier": "i=1002"
        }
      ]
    }
  ]
}

Thanks for the reply. This example is applicable to changing or replacing multiple triggers. Here, I would only want to make changes to the monitored item tags (add tags or remove tags from the monitored items list), and the rest of the trigger configuration remains the same. Either using a payload path or JSON template.

The deep-merging I mentioned before would work for that as well; just select the Payload Path option in the Config: Set Node and pass it a path to an object with the changes you want to make. (Or select the JSON Template option and construct the object inline.) The object would look like the example updates from my previous reply.

It works. Thanks for the support.