Device: Connect Trigger Node
The Device: Connect Trigger will fire a workflow whenever one or more devices connect to the WEGnology Platform, via the MQTT broker or the REST API.
Node Properties
Application Workflows
The Device: Connect Trigger can be configured with one or more specific devices, or a selection of tags (or both). When a device that matches anything in the selection connects to WEGnology, the workflow will trigger. See the device query documentation for more info about how ID and tag matching works.
In the above example, the workflow will be triggered whenever any device that has a location
tag connects to WEGnology.
Edge Workflows
For Edge Workflows, you cannot use device queries. Instead, it will trigger when the Edge Compute Device running the Edge Workflow connects to WEGnology.
Payload
Application Workflow Payload
The payload will have an empty object on the standard data field, since there is no useful data to report other than the fact the device connected. In the general case, a device connect workflow payload will look like the following:
{
"time": <time of the connection>,
"data": {
},
"applicationId": <id of the current application>,
"applicationName": <name of the current application>,
"triggerId": <id of the triggering device>,
"triggerType": "deviceIdConnect",
"deviceTags": {<any tags for the device>},
"deviceName": <the device name>,
"flowId": <id of the current workflow>,
"flowName": <name of the current workflow>,
"globals": <object of workflow globals>
}
For the example workflow above, a specific payload for a triggered workflow might look like this:
{
"time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
"data": {
},
"applicationId": "568beedeb436ab01007be53d",
"applicationName": "Embree",
"triggerId": "56c8967bb8df0f0100d629120",
"triggerType": "deviceIdConnect",
"deviceTags": {
"floor": ["2"],
"location": ["warehouse1"]
},
"deviceName": "My Factory Device",
"flowId": "56c74add04d0b50100043381",
"flowName": "Connection Info",
"globals": {}
}
Edge Workflow Payload
The payload will contain the data of the last time the edge device disconnected from the MQTT broker, if this is the first time this device connected then this field will be null. In the general case, a device connect workflow payload will look like the following:
{
"time": <time of the connection>,
"data": {
"lastDisconnectTime": <time of last disconnect>
},
"applicationId": <id of the current application>,
"applicationName": <name of the current application>,
"triggerId": <id of the triggering device>,
"triggerType": "onConnect",
"deviceTags": {<any tags for the device>},
"deviceName": <the device name>,
"flowId": <id of the current workflow>,
"flowName": <name of the current workflow>,
"globals": <object of workflow globals>
}
For the example workflow above, a specific payload for a triggered workflow might look like this:
{
"time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
"data": {
"lastDisconnectTime": null
},
"applicationId": "568beedeb436ab01007be53d",
"applicationName": "Embree",
"triggerId": "56c8967bb8df0f0100d629120",
"triggerType": "onConnect",
"deviceTags": {
"floor": ["2"],
"location": ["warehouse1"]
},
"deviceName": "My Factory Device",
"flowId": "56c74add04d0b50100043381",
"flowName": "Connection Info",
"globals": {}
}