Timer Value

No, a timer is a rule thing, not something that is exposed to the sitemap. The purpose of a timer is for it to execute some code that you pass to it at a certain time in the future. So what you have is essentially a no-op (i.e. doesn’t do anything). A proper timer in a rule would be:

timer = createTimer(now.plusSeconds(180), [|
    // code that should execute 180 seconds from now
])

To have a countdown timer like you are looking for you would need to create a rule with a loop and a sleep that updates an item every second.

rule "Countdown"
when
    Item StartCountdown received command ON
then
    var count = 180
    while(count >= 0) {
        Countdown.postUpdate(count)
        count = count - 1
        Thread::sleep(1000)
    }
end
3 Likes