|  Developer
Updated on May 24, 2022

function/repeat

  • The REPEAT function controls number of times child events become during the period specified. The function block should switch to the state if child conditions are changed to at least defined number of times.

Parameters:

Field Type Required Description
blockOptions.function.repeat object Settings of a REPEAT function.
blockOptions.function.repeat.times int + Number of times child conditions should become to raise the REPEAT function. Minimal value is: 2.
blockOptions.function.repeat.seconds int + A period in which these transitions should occur.
  • NOTE: The REPEAT 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.
function/repeat
  • The function REPEAT is intended to ignore too-fast transitions between the and the state of child events.
  • The REPEAT sets the interval duration in seconds.
  • If a child event becomes , this function saves the timestamp of state transition. The state of a function stays . If a child event becomes , and then again, the function REPEAT checks whether an interval between the state transitions was less than the interval set as a function condition, and the number of transitions matches the number of times stored in the function options.
  • If it is less than that interval, and the number of times reached the function operator becomes . Otherwise, if the interval between the transitions is greater than the REPEAT function specified, the operator stays .

This feature is available since advanced_scenes/1.20.

Examples:

function/repeat

				
					{
   "blockOptions":{
      "method":{
         "args":{
            "blocks":"blocks"
         },
         "name":"function"
      },
     "function":{
         "repeat":{
             "times": 3,
             "seconds": 10
         }
      }
   },
   "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.