[SOLVED] createTimer help to prevent rule triggering again and again for a period of time

createTimer is used to schedule a bit of code to run at sometime in the future.

You can’t prevent a Rule from running when an event occurs. So you need to use if statements to decide what code the Rule runs when it is triggered.

There are lots of ways to do this but createTimer isn’t one of them. Using a timestamp is probable the safest.

var lastRun = now.minusMinutes(601) // set to the past

rule "phone1 online"
when
    Item phone1_Online changed to ON
then
    if(now.minusMinutes(600).isAfter(lastRun)) return; // if it has been less than 600 minutes since we last ran exit

    MyEchoDot_Speak.sendCommand('Good day master. I am ready to do your bidding')
    lastRun = now
end

NOTE the use of How to use code fences