OPC UA Trigger
The OPC UA Trigger will trigger a workflow whenever an Edge Compute Device receives a change message on the configured OPC UA monitored node.
Node Properties
The OPC UA Trigger’s configuration is broken up across the following sections …
Configuration
Select what the source of the configuration for the trigger should be. The two options are:
- Individual Fields (Default): Fields are individually set within the node properties.
- Agent Config File: Pull a named configuration from your Gateway Edge Agent’s config file. This options is only available in Gateway Edge Agent Version 1.40.0 and higher.
When Agent Config File is chosen, you must provide the name of a configuration from your config file. That named configuration in your config file must contain the required connection configuration fields as well as at least one monitored item. The type opcua
and a unique name field are also required.
Example (including all field names):
[[triggers]]
name = 'myTriggerName'
type = 'opcua'
uri = 'opc.tcp://localhost:4335/UA/Server'
username = 'me'
password = 'pass'
securityPolicy = 'Basic256' # e.g. Basic124, ...
securityMode = 'SIGNANDENCRYPT' # or SIGN
cert = '-----BEGIN CERTIFICATE----- ...'
privateKey = '-----BEGIN RSA KEY----- ...'
samplingInterval = '60' # ms
eventFilter = ['Values']
[[triggers.monitoredItems]]
nameSpace = 1
identifier = 'i=2254'
[[triggers.monitoredItems]]
identifier = 's=myNode'
Connection Configuration
Connection Configuration contains:
- OPC UA URI: (Required) A string template for the OPC UA server URI.
- Username: (Optional) A string template for login username.
- Password: (Optional) A string template for login password.
Security Settings
You can optionally select a SSL/TLS “Security Policy” for the connection to the OPC UA server through the dropdown selector. Security Policy options include:
- None
- Basic-128
- Basic-128 RSA-15
- Basic-192
- Basic-192 RSA-15
- Basic-256
- Basic-256 SHA-256
If a Security Policy is selected, you will have the option to select between “Sign” or “Sign and Encrypt” security modes. You’ll then be required to provide a valid SSL/TLS client certificate and private key.
Monitor Instructions
You are required to monitor a single OPC UA node for the OPC UA: Trigger. Each instruction has the following fields:
- Sampling Interval (Required): A positive integer of time between samples measured in milliseconds.
- Namespace Index (ns) (Required): A positive integer.
- Identifier (Required): A string for the node identifier. The identifier string should begin with one of the following types:
- i=: for unsigned integer (UINT).
- s=: for string.
- g=: for global unique identifier (GUID).
- b=: for byte string.
Event Filters
Optionally, you can filter multiple OPC UA events and alarms to trigger and display in the payload. You can include custom event/alarm types or select from common OPC UA events. If no event filter is selected, a value change on a node object will be the only event triggered and displayed in the payload.
Note: OPC UA “Extension Objects” returned on an event are not currently supported.
Example Payload
Depending on the trigger’s configuration and the GEA version, the data
object on the initial payload can take many different shapes.
Event Filters Provided
Regardless of whether the trigger configuration is defined inline or as a named configuration, if event filters are provided, then the data
field is an object with the node’s namespace
, identifier
, and keys for each event filter provided in the configuration:
{
"agentEnvironment": {
"EXAMPLE": "Environment Variable"
},
"agentVersion": "1.31.0",
"applicationId": "555555555555eeeeeeeeeeee",
"applicationName": "My Great Application",
"data": {
"Message": "Condition value is 0.7286692235894777 and state is High",
"HighLimit": 0.9,
"AckedState": "Unacknowledged",
"namespace": "0",
"identifier": "i=9341"
},
"device": {
"applicationId": "555555555555eeeeeeeeeeee",
"attributes": {
"exampleNumber": {
"attributeTags": {
"attrTagKey": "tagValue1"
},
"dataType": "number",
"name": "exampleNumber"
},
"exampleString": {
"attributeTags": {
"attrTagKey": "tagValue2"
},
"dataType": "string",
"name": "exampleString"
}
},
"creationDate": "2018-03-16T18:19:03.376Z",
"deviceClass": "edgeCompute",
"deviceId": "222222222222bbbbbbbbbbbb",
"id": "222222222222bbbbbbbbbbbb",
"name": "My Great Device",
"tags": {
"aTagKey": [
"exampleTagValue"
],
"tagWithMultipleValues": [
"tagValue",
"anotherTagValue"
]
}
},
"deviceId": "222222222222bbbbbbbbbbbb",
"deviceName": "My Great Device",
"deviceTags": {
"aTagKey": [
"exampleTagValue"
],
"tagWithMultipleValues": [
"tagValue",
"anotherTagValue"
]
},
"flowId": "333333333333cccccccccccc",
"flowName": "My Great Workflow",
"flowVersion": "myFlowVersion",
"globals": {
"aJsonGlobal": {
"key": "value"
},
"aNumberGlobal": 42,
"aStringGlobal": "My value"
},
"isConnectedToLosant": true,
"time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
"triggerId": "<trigger key>",
"triggerType": "opcua"
}
Inline Configuration
If connection configuration is defined in the trigger, and there are no event filters provided, then the data
field’s value is simply the monitored item’s new value:
{
"agentEnvironment": {
"EXAMPLE": "Environment Variable"
},
"agentVersion": "1.31.0",
"applicationId": "555555555555eeeeeeeeeeee",
"applicationName": "My Great Application",
"data": "new OPC node value",
"device": {
"applicationId": "555555555555eeeeeeeeeeee",
"attributes": {
"exampleNumber": {
"attributeTags": {
"attrTagKey": "tagValue1"
},
"dataType": "number",
"name": "exampleNumber"
},
"exampleString": {
"attributeTags": {
"attrTagKey": "tagValue2"
},
"dataType": "string",
"name": "exampleString"
}
},
"creationDate": "2018-03-16T18:19:03.376Z",
"deviceClass": "edgeCompute",
"deviceId": "222222222222bbbbbbbbbbbb",
"id": "222222222222bbbbbbbbbbbb",
"name": "My Great Device",
"tags": {
"aTagKey": [
"exampleTagValue"
],
"tagWithMultipleValues": [
"tagValue",
"anotherTagValue"
]
}
},
"deviceId": "222222222222bbbbbbbbbbbb",
"deviceName": "My Great Device",
"deviceTags": {
"aTagKey": [
"exampleTagValue"
],
"tagWithMultipleValues": [
"tagValue",
"anotherTagValue"
]
},
"flowId": "333333333333cccccccccccc",
"flowName": "My Great Workflow",
"flowVersion": "myFlowVersion",
"globals": {
"aJsonGlobal": {
"key": "value"
},
"aNumberGlobal": 42,
"aStringGlobal": "My value"
},
"isConnectedToLosant": true,
"time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
"triggerId": "<trigger key>",
"triggerType": "opcua"
}
Named Trigger Configuration
If the trigger uses a named configuration, and there are no event filters in the configuration, the data
field will be an object containing properties describing the monitored item that caused the workflow to trigger, including the item’s new value:
{
"agentEnvironment": {
"EXAMPLE": "Environment Variable"
},
"agentVersion": "1.31.0",
"applicationId": "555555555555eeeeeeeeeeee",
"applicationName": "My Great Application",
"data": {
"dataType": "Int32",
"identifier": "i=1001",
"namespace": "3",
"sourceTimestamp": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
"value": 42
},
"device": {
"applicationId": "555555555555eeeeeeeeeeee",
"attributes": {
"exampleNumber": {
"attributeTags": {
"attrTagKey": "tagValue1"
},
"dataType": "number",
"name": "exampleNumber"
},
"exampleString": {
"attributeTags": {
"attrTagKey": "tagValue2"
},
"dataType": "string",
"name": "exampleString"
}
},
"creationDate": "2018-03-16T18:19:03.376Z",
"deviceClass": "edgeCompute",
"deviceId": "222222222222bbbbbbbbbbbb",
"id": "222222222222bbbbbbbbbbbb",
"name": "My Great Device",
"tags": {
"aTagKey": [
"exampleTagValue"
],
"tagWithMultipleValues": [
"tagValue",
"anotherTagValue"
]
}
},
"deviceId": "222222222222bbbbbbbbbbbb",
"deviceName": "My Great Device",
"deviceTags": {
"aTagKey": [
"exampleTagValue"
],
"tagWithMultipleValues": [
"tagValue",
"anotherTagValue"
]
},
"flowId": "333333333333cccccccccccc",
"flowName": "My Great Workflow",
"flowVersion": "myFlowVersion",
"globals": {
"aJsonGlobal": {
"key": "value"
},
"aNumberGlobal": 42,
"aStringGlobal": "My value"
},
"isConnectedToLosant": true,
"time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
"triggerId": "<trigger key>",
"triggerType": "opcua"
}
Notes:
- The
sourceTimestamp
property is only available starting in GEA v1.43.3, and only then if it is provided by the underlying OPC UA service. Its value is a JavaScript Date object corresponding to the timestamp provided with the value change. - The
dataType
property is only available starting in GEA v1.44.0. Its value corresponds to the OPC UA data type of the value that caused the workflow execution.
Related Nodes
Was this page helpful?
Still looking for help? You can also search the Losant Forums or submit your question there.