I do have a simple switch which is working. Now I would like to use a simple delay in order to “delay” the update of the new state of the switch. This means when I press the switch I would like to wait x-seconds before the switch changes its state.
Is this possible in the UI? I have not found anything I can use with a rule or metadata.
Hi Norick,
directly in UI this might not be possible.
In a rule that should work.
You would need another switch which would be used to delay your “real” switch.
The rule could look like this:
var Timer delaytimer = null
rule "delayed switching 1"
when
Item delayed_switch changed to ON
then
delaytimer=createTimer(now.plusSeconds(5)) [| // wait 5 seconds
your_real_switch.sendCommand(ON)
]
delayed_switch.sendCommand(OFF)
end
// --- or with Thread::sleep command:
rule "delayed switching 2"
when
Item delayed_switch changed to ON
then
Thread::sleep(5000) // wait 5 seconds
your_real_switch.sendCommand(ON)
delayed_switch.sendCommand(OFF)
end
It’s possible in the UI but not possible using just simple UI rules. But you can use Blockly to write the script actions all in the UI. You can write text based script actions all in the UI too.