Is there any way to check on running timers started with "runIn()"?

I'm not very hopeful, but is there any way to check on if a timer is still running that I started with runIn() as seen in Common Methods | Hubitat Documentation.

Also, I just realized that this timer is a singleton (by default since the overwrite defaults false). Is there a way to name these timers?

These aren't timers, but scheduled jobs (to call the handler) for the future. You could grab the time just before calling runIn() with now() into a state variable. Then that value could be tested against now() later, and since you know how long you put into runIn(), you can determine how much time is left (if any).

Assuming that you are using overwrite: false so you have multiple of these scheduled jobs, you can pass data with each call. That data could be the 'name'.

runIn(60, handler, [overwrite: false, data: [name: "myName"]])

The handler has a parameter for the passed data:

void handler(data) {
    log.debug "name is $data.name"
}

Awesome! Thanks for the fast reply.

I also found this thread interesting

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.