Timer/Sleeptimer Simulation with Rules

Hi,
I would like to simulate a Timer, wich has the behaviour of a Sleeptimer, which is build in in a TV.

My idea is to build some items (state, time remaining) and a rule witch is executed every minute. While the timer is running I would to see it state (time remaining) and would to have the ability to change it (increase or decrease the value). Also the timer must not have a problem with a new day if it is running over midnight.

Does somebody has such a timer and would like to share it?

Otherwise, is it good to run a rule every minute?
Some suggestions how to build it?
What would be the best way to build it? One Item with the remaining time in minutes? Two Items like a alarm clock (hour + minute)?

One rule for changing the remaining time and another for the action if the timer reaches zero?

Regards,
Julian

Hi,

if I understand all example correctly, this are timers but this don’t achieve the requirement that I can read (and show) the current remaining time while the timer is running.

Regards,
Julian

Yes they do, The minutes counter is held in a Number Item, do what you want with it - show it in a UI, compare it to something else in rules, change it, abort it.

Hi,

I was looking for a similar rule example, because I want to add some sleep timer logic for a bunch of switches. Since I don’t find any solution, I created my own “Generic SleepTimer Library” :wink: You can find it on github:

Best regards,
Andi