Updates vs Changes
Great example. Here’s my attempt at visualizing this.
With a generic updates (no comparison specified), when any value comes in, the ‘updates’ trigger would be fired.
But with a generic changes (no comparison specified), the new value would have to be different than the previous value for the trigger to fire.
On Transition Only
The same type of logic applies when the ‘On Transition Only’ option is selected for a trigger that has a comparison configured.
Regular (On Transition Only: ☐, unchecked)
The trigger would fire any time a value came in that matched the configured comparison.
On Transition Only: ✓ (checked)
The trigger would only fire the first time the trigger evaluated to true. If new events came in and the trigger continued to evaluate to true, the trigger would not fire again. A value would have to be received where the trigger is not true for it to ‘exit’, then a new value would have to come in that evaluates true again before an ‘On Transition Only’ would fire again.
TLDR: The ‘On Transition Only’ will only trigger when the event value first transitions to the configured state. It won’t trigger again until the event value transitions out of the configured state.
Step-by-Step Timeline Description (tap to expand)
At t0, the value was 74 which is below the configured threshold so the rule is not triggered.
Then at t1, the reported value was 75 which is
>74, so the rule would have been triggered under either the ‘On Transition Only’ or the regular trigger.
At t2, we see the benefit of the ‘On Transition Only’ setting.
- With the regular trigger, the new event would have evaluated and the rule would have seen it as
>74 and triggered the rule to run again.
- But with ‘On Transition Only’, the rule would have known that it had already been triggered on a previous change to
>74 and it had remained above 74, so it does not need to trigger again.
At t3, the new event value is below 74 and the trigger condition is not met, so neither configuration is triggered.
- Behind the scenes, the On Transition Only is internally reset at this point. It flags itself as the trigger not being matched, so the next time an event comes in that is matched, the system will know it’s a change in the trigger state.
At t4, the new value is
>74, so the rule is triggered in either configuration.
- Regular Trigger: triggered any time the received event value matches the configuration
- On Transition Only: per the
t3 notes, the system knows that the last event did not match the trigger configuration, and it knows that this new value is
>74, so the rule is triggered.
At t5, the same logic as
t2 applies. The regular trigger, is always triggered when it’s configured condition is met. And the On Transition Only, knows that it was already triggered and since the received events stayed triggered, it doesn’t need to trigger again.
The same type of language is used with these triggers as well (‘updates’ vs ‘changes’). The regular trigger would read:
…temperature updates and is greater than 74
And if you ticked the box for ‘On Transition Only’, the trigger would read:
…temperature changes to greater than 74