A rule that runs periodically and calls a user defined rule with the list of Things that match a configured criteria. For example, one can run it once a minute or so and call another rule with the list of Things that are OFFLINE, or the ones that are not ONLINE.
A list of Things that match the criteria is passed to the called rule and is available with
context.getAttribute("things");. This list can be processed any way desired.
The conditions of the rule called are taken into account so one can put limits on when or how often the the rule runs (e.g. don’t run at night).
By default it is configured with a cron trigger to run periodically based on the desired periodicity. One could customize the rule by changing the triggers to list each Things’s status change individually or use any other criteria desired to trigger the rule.
One useful trick will be to keep track of the old list of Things in the called rule so one can see which ones changed since the last call. (
var oldthings = (oldthings === undefined) ? context.getAttribute("things") : oldthings;).
Feel free to customize this rule as much as desired to meet your needs. You could even replace the code that calls your rule and put that processing inline.
All but the rule properties are optional. If unchanged the rule template will cause the rule to run every 30 seconds and call your rule with all the Things that are OFFLINE.
- none known
- initial release