Device: Disconnect Trigger Node
The Device: Disconnect Trigger will trigger a workflow whenever one or more devices disconnect from the WEGnology Platform, via the MQTT broker or the REST API.
Node Properties
Application Workflows
The Device: Disconnect 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 disconnects from 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 disconnects from WEGnology.
Edge Workflows
For Edge Workflows, you cannot use device queries. Instead, it will trigger when the Edge Compute device running the edge workflow disconnects from WEGnology.
Payload
Application Workflow Payload
The payload will have various information on the data field about the connection that was terminated. In the general case, a device disconnect workflow payload will look like the following:
{
"time": <time of disconnect>,
"data": {
"disconnectReason": <a reason for the disconnection>,
"messagesFromDevice": <count of messages sent from device while connected>,
"messagesToDevice": <count of messages sent to device while connected>,
"connectedAt": <time when connection was originally established>
},
"applicationId": <id of the current application>,
"applicationName": <name of the current application>,
"triggerId": <id of the triggering device>,
"triggerType": "deviceIdDisconnect",
"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": {
"disconnectReason": "Connection Lost",
"messagesFromDevice": 1385,
"messagesToDevice": 0,
"connectedAt": Fri Feb 19 2016 16:25:00 GMT-0500 (EST)
},
"applicationId": "568beedeb436ab01007be53d",
"applicationName": "Embree",
"triggerId": "56c8967bb8df0f0100d629120",
"triggerType": "deviceIdDisconnect",
"deviceTags": {
"floor": ["2"],
"location": ["warehouse1"]
},
"deviceName": "My Factory Device",
"flowId": "56c74add04d0b50100043381",
"flowName": "Connection Info",
"globals": {}
}
Edge Workflow Payload
The payload will have various information on the data field about the connection that was terminated. In the general case, a device disconnect workflow payload will look like the following:
{
"time": <time of disconnect>,
"data": {
"lastConnectTime": <time when the edge device last connected>,
"reason": <a reason for the disconnection>
},
"applicationId": <id of the current application>,
"applicationName": <name of the current application>,
"triggerId": <id of the triggering device>,
"triggerType": "onDisconnect",
"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": {
"reason": "Connection Lost",
"lastConnectTime": Fri Feb 19 2016 16:25:00 GMT-0500 (EST)
},
"applicationId": "568beedeb436ab01007be53d",
"applicationName": "Embree",
"triggerId": "56c8967bb8df0f0100d629120",
"triggerType": "onDisconnect",
"deviceTags": {
"floor": ["2"],
"location": ["warehouse1"]
},
"deviceName": "My Factory Device",
"flowId": "56c74add04d0b50100043381",
"flowName": "Connection Info",
"globals": {}
}