Device: Inactive Trigger

The Device: Inactive Trigger fires a workflow whenever one or more devices do not report state for the configured period of time.

Device Inactive Trigger

Node Properties

There are two configurable properties for the Device: Inactive Trigger …

Device IDs/Tags

First, enter a device query targeting the devices you would like to fire this trigger for. You must choose at least one specific device or one device tag, but you may also enter a mix of the two.

Inactivity Time

Next, enter the length of time that must pass without a matching device reporting state before the trigger fires.

  • The inactivity time can be configured in seconds, minutes, hours, or days.

  • The value can be as short as 1 second or as long as 1 year.

  • Like the Device: Connect, Device: Disconnect, and Device: State Triggers, this trigger fires individually per device matching its query. In other words, if the trigger is configured to fire for devices matching the tag type=Smoke Detector, and there are 10 devices with such a tag, each one of those devices will cause the trigger to fire when the inactivity timer expires.

Payload

The trigger’s initial payload includes information about the device that caused the workflow to fire. Additionally, it includes a data object with the following properties:

  • inactivitySeconds: The length of time (in seconds) that elapsed without a state report, causing the trigger to fire. This value should match the value entered in the Inactivity Time configuration property.
  • lastActivity: A Date object representing the last time that the triggering device reported state.
{
  "applicationId": "555555555555eeeeeeeeeeee",
  "applicationName": "My Great Application",
  "data": {
    "inactivitySeconds": 10,
    "lastActivity": Fri Feb 19 2016 17:26:00 GMT-0500 (EST)
  },
  "device": {
    "_etag": "\"567-SY26IHrVRzUBMUwxnY59Fn6vOvo\"",
    "applicationId": "555555555555eeeeeeeeeeee",
    "attributes": {
      "exampleNumber": {
        "attributeTags": {
          "attrTagKey": "tagValue1"
        },
        "dataType": "number",
        "description": "",
        "name": "exampleNumber"
      },
      "exampleString": {
        "attributeTags": {
          "attrTagKey": "tagValue2"
        },
        "dataType": "string",
        "description": "",
        "name": "exampleString"
      }
    },
    "creationDate": "2018-03-16T18:19:03.376Z",
    "description": "",
    "deviceClass": "standalone",
    "deviceId": "222222222222bbbbbbbbbbbb",
    "id": "222222222222bbbbbbbbbbbb",
    "lastUpdated": "2020-08-26T13:09:11.814Z",
    "name": "My Great Device",
    "tags": {
      "aTagKey": [
        "exampleTagValue"
      ],
      "tagWithMultipleValues": [
        "tagValue",
        "anotherTagValue"
      ]
    }
  },
  "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"
  },
  "relayId": "inactivity-<ID of the inactive device>-<inactivity length in seconds>",
  "relayType": "timer",
  "time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
  "triggerId": "<ID of the inactive device>",
  "triggerType": "deviceIdInactivity"
}

Notes

The following is important to note about the behavior of the Device: Inactive Trigger …

  • Like the Device: Connect, Device: Disconnect, and Device: State Triggers, this trigger fires individually per device matching its query. In other words, if the trigger is configured to fire for devices matching the tag type=Smoke Detector, then it will fire whenever one of those matching devices surpasses the state Inactivity Time, with a payload specific to that device. If multiple devices matching the query surpass their inactivity timer at the same instant, then the Device: Inactivity Trigger will fire once for each inactive device at that instant.
  • The Device: Inactivity Trigger fires only once per period of inactivity per device, and the period resets when the device reports state again. For example, if the trigger is configured to fire after 10 seconds of inactivity, a device matching the trigger’s device query will cause the workflow to fire after it has not reported state for 10 seconds. However, if another 10 seconds passes without a state report for that device, the trigger will not fire again. Only after the device reports state will the 10-second timer begin anew.
  • Only state reports affect the inactivity timer. Devices connecting to or disconnecting from WEGnology’s MQTT broker; sending commands to the device; or devices publishing messages on custom MQTT topics have no effect on the trigger.
  • Every received state report resets the inactivity timer. If the trigger fires after 10 seconds of inactivity, and a device consistently reports state every 8 seconds, the trigger will never fire for that device.
  • The Device: Inactivity Trigger is not retroactive; in other words, inactivity timers do not begin until …
    1. The trigger is added to a workflow.
    2. A matching device reports state after the workflow is saved. (The trigger will never fire for a device that does not report state after the trigger is configured.)
    3. The trigger’s inactivity period is then exceeded.
  • Similarly, whenever the trigger’s Inactivity Time changes (i.e. the workflow is saved with updates to the Device: Inactivity Trigger’s configuration), all in-process timers are discarded and, in regards to the trigger’s behavior, it is as if the old trigger was deleted and a new one was added to the workflow (with triggering behavior as described above).
  • Inactivity is determined by the time at which a state report arrives, and not any state report’s data timestamp.

Was this page helpful?


Still looking for help? You can also search the WEGnology Forums or submit your question there.