So the specific time is the time you need to push the button 4 times… even easier ![]()
var Timer myTimer = null
var Number myCounter = 0
rule "trigger"
when
Item MyTriggerSwitch received command
then
if(myTimer === null) { // no timer started, so startup timer
myTimer = createTimer(now.plusMillis(5000), [ // timeout is 5 Seconds
myTimer = null // when timer expired, reset timer
myCounter = 0 // and counter
])
}
myCounter += 1 // each time a command is received, count up
if(myCounter == 4) { // rule was triggered 4 times within 5 Seconds
MyRegularSwitch1.sendCommand(if(MyRegularSwitch1.state != ON) ON else OFF) // toggle Switch
MyRegularSwitch2.sendCommand(if(MyRegularSwitch2.state != ON) ON else OFF) // toggle Switch
MyRegularSwitch3.sendCommand(if(MyRegularSwitch3.state != ON) ON else OFF) // toggle Switch
}
end
Maybe toggling switches is not the goal, but then you have to decide which switch should be the “Master” (i.e. which switch state should be used to toggle)
EDIT: some additional information…