‘FOLLOW’ is a trigger function that lets you delay the transition of a trigger between true/false states when the trigger conditions are no longer met.
In other words, it lets you temporarily keep the state of a trigger at ‘true’ for a period of time, even when its conditions have become false.
- Under normal conditions, triggers will immediately move from true to false when their conditions are no longer met.
- If you set a ‘follow’ delay then the trigger will remain as true for the length of time you specify, even if its conditions become false. The trigger will transition to false once the delay period has elapsed.
- If the trigger conditions become true again while a follow delay is active, then the trigger immediately resets to true. The follow delay is discarded.
Note 1 – ‘Follow’ only works on ‘True -> False’ transitions. It does not work on ‘False -> True’ transitions. So ‘follow’ can keep triggers ‘true’ for a length of time, but cannot keep them ‘false’.
Note 2 – ‘In-progress’ follow delays are cancelled by meshbot service restarts. A service restart can occur if the hub is rebooted manually or because of a power-cut, or if the meshbot is disabled then re-enabled. This is because follow is only activated when a trigger transitions from true to false. If no state transition occurs then ‘Follow’ doesn’t get fired.
For example, if you set a follow delay of 10 hours then the trigger will attempt to retain a true state for that length of time should its conditions become false. If you restart your hub during those 10 hours, and the trigger conditions are still false at restart, then the trigger will jump straight to false regardless of your earlier ‘follow’ command.
Please bear this in mind if you set a large follow delay stretching into hours or days.
This table explains how follow delays and state changes contribute to a trigger’s overall state
|Initial Trigger State||State Change||Follow Delay||Trigger Result|
|True||FALSE||10 secs||True||10 secs →||False|
Final row in the table – The trigger immediately becomes ‘true’ if column 2 goes back to true again during the 10 second delay. The ‘follow’ delay is discarded in this case.
You have a motion sensor which turns a hallway light on if it detects motion, and off when it stops detecting motion. But you don’t want it to turn the light off if somebody just stops moving for a few seconds.
You can use ‘Follow’ to set a trigger reset delay of 3 minutes to achieve this goal:
- Trigger – Create a trigger that becomes ‘true’ if the motion sensor detects movement. Set the ‘Follow’ delay to 3 minutes.
- Action – Create an action with a ‘True’ response that turns the light on. Click the ‘False’ tab and set the false action to turn the same light off.
- As soon as the sensor detects motion it will turn the trigger ‘True’. This activates the ‘True’ action you have set up, which is to turn the light on.
- The trigger will become ‘False’ at the instant the motion sensor stops detecting motion.
- Ordinarily, this would cause the ‘False’ action to be fired right away, plunging the hallway into darkness.
However, your ‘Follow’ delay means the trigger is now held at ‘true’ for 3 minutes, meaning the light remains on.
- If there is no further movement for those 3 minutes then the trigger reverts to false and the light is turned off.
- If there *is* further movement during the 3 minutes, then the trigger immediately resets to ‘true’. When the trigger resets to true it also resets the 3 minute ‘Follow’ timer and the process begins again.
The following image shows you how to set this up in a meshbot:
The result is your light will remain on unless there are 3 unbroken minutes of no movement. The meshbot will restart this 3 minute timer every time it detects movement.