The SensorDataDBIfZero component outputs the input payload as the output payload if no rows are retrieved; if any rows are found, it outputs nothing and omits the Action and all subsequent components. If no rows are found, the Action flow continues.
With the content specified in the property, it searches the sensor DB and executes a filter expression for each matched record. The matched records can be referenced by the “Value” variable. If the result of executing the expression is true, it passes, but there is no output payload, because it corresponds to a single record in the DB, and there is no output payload. Outputs the input payload even if the execution result is all false.
The SensorDataDBIFZero component is useful for “keep alive” signals or to trigger an action if something “has NOT happened” rather than “has happened”.
Output Payload | Description |
---|---|
cv.Payload |
Output payload as the output payload if no lines are retrieved. |
Output Example
{"AreaId":"..", "LayerId":"", "KindId":"", "Timestamp": ..., "VirtualDeviceId": ..., "Data": }
Timestamp is output as a date/time type in the JSON Object type.
For each record, the component variable ( cv.Id
) is given a record ID, the component variable ( cv.Count
) is given the first record that matches the record, and the ID is incremented by 1, and the number of the ID is incremented in order.
Filter Formula Example
Value.Data > 123
Value.Data.key1 == "abc" && Value.Data.key2 > 123
Component Properties
Name | Required | Description |
---|---|---|
Filter Key | True | The property to filter for |
Filter Value | True | The value to filter for |
From Previous | True | The number of records to retrieve (e.g., if From Previous is 10 and the timescale is a record, the latest 10 will be retrieved). |
Timescale | True | Unit of the latest data to be acquired (choose from records, milliseconds, seconds, minutes, hours, days, weeks, months, and years). cp.Timescale can be one of the following values: “Records”, “Milliseconds”, “Seconds”, “Minutes”, “Hours”, “Days”, “Weeks”, “Months”, or “Years”. |
All Records | True | Get all records by overriding the From Previous and Timescale conditions. |
Time Rounding | True | Get data from the last second, minute, hour, day, day, week, month, and year rounded up to the last time the component was executed. |
Filter Expressions | False | Allow you to choose whether to output the payload in an expression, like the Filter component Filter Expressions. |
Example Use Case
You may want to trigger a script if no motion is detected for 5 minutes. Create a time trigger that executes every 1 minute, then execute the below action. If the last 5 minutes of the Motion layer are empty, the next component (RunScript) will run. If they are not empty, the Action will abort before running the script.
Need more help with this?
Join our slack community for help