Rule that power on at a specific time, but power off again after 30 sec

Hi

Can someone help me creating a rule, that turns on a power outlet ie. at 11.00 o’clock, and then power it off again after 30 sec.

In the rule editor, the minimum setting are 1 min.

Thanks.

You can use a CRON rule to turn the light on at a certain time, then use the expire binding to turn the light off 39 seconds later.

rule "turn on at 11am"
when
    Time cron "0 0 11 ? * * *" // See: https://www.freeformatter.com/cron-expression-generator-quartz.html
then
    myLight.sendCommand(ON)
end

3 options:

  • a rule that turn off at 11:00:30 (See above)
  • use the expire binding (As mentionned above) but this means that the light will ALWAYS turn off 30s after being turned on
  • Use a timer:
rule "turn on at 11am"
when
    Time cron "0 0 11 ? * * *" // See: https://www.freeformatter.com/cron-expression-generator-quartz.html
then
    myLight.sendCommand(ON)
    createTimer(now.plusSeconds(30), | [
        myLight.sendCommand(OFF)
    ])
end

Not nessasirly - you could always create two versions of the switch. One with the expire binding, one without.