Timer (modifyable during runtime)

Hallo all,

I’d like to implement a timer (e.g. for a lamp) that switches off after a certain amount of time. Additionally, the remaining time should be displayed in my GUI and should be modifyable by a GUI click.

I understood the normal retriggerable timers like these: (works fine)

if(timerDimmer == null) {
timerDimmer = createTimer(now.plusSeconds(timeoutSeconds), [|
timerDimmer = null
else {

1.) How can I show the remaining time in seconds in a gui widget? => This means how do I put the remaining time in an “auto-updated” item? Or alternatively, how can I put the ending time in an item?
2.) How can I extend/reduce the timer by clicking on my gui => This means how can I extend the timer by a e.g. switch item? How to connect that switch item or number item (or whatever) to the timer?


  1. To have a countdown you need to have a recurring timer that updates a countdown Item while the Timer is active. You can easily put the ending time into an Item with

    createTimer(now.plusMinutes(5), [| do some timer stuff])

  2. That isn’t going to be easy either. You will need to have a Number Item on the Sitemap and your recurring timers that update that Number as the Timer counts down to doing the actual work. Use a Setpoint to put that Item on the sitemap. Then create a Rule that triggers when that Number Item receives command and cancels the current Timer that will do the work and reschedules it for the new Time.