|  Developer
Updated on December 2, 2022

function/follow

  • The FOLLOW function provides the ability to delay the reset of the when block ( -> transition). The function block keeps the state of a when block for a specified duration, after the condition of a when block is no longer satisfied.

Parameters:

Field Type Required Description
blockOptions.function.follow object Settings of a FOLLOW function.
blockOptions.function.follow.delayReset int + For how long the reset of the when block will be delayed. Value should be positive. Specified in seconds.
  • If all function’s children become , the operator becomes instantly.
    If a child event becomes and the previous state of the FOLLOW function was , the operator schedules a delayed reset. During the delay the operator stays in state.
    If the deferred reset was scheduled and during the delay all function’s children become again, then the delayed reset is discarded.
  • NOTE: The FOLLOW function state is not saved between the scene service restarts, so, the function operator should not be used to handle large periods of time like hours and days. It is only intended to handle periods in seconds.

This feature is available since advanced_scenes/1.27.

Example:

				
					{
   "blockOptions":{
        "method":{
            "args":{
                "blocks":"blocks"
            },
            "name":"function"
        },
        "function": {
            "follow":{
                "delayReset": 3
            }
        }
    },
    "blockType":"when",
    "fields":[
        {
            "name":"blocks",
            "type":"blocks",
            "value": [
                __WHEN_BLOCK__, ..., __WHEN_BLOCK__
            ]
        }
    ]
}				
			

Here, the stands for any valid when block, like a final event or a logical operator.