Question regarding rules and timers

I have more than one rule that i want to use a timer on does that mean I have to define a timer variable for every instance I need it like the following?

var timer = null
var timer1 = null
var timer2= null

thanks
Steve

It depends. You haven’t given us enough context to truly answer the question.

If each Rule’s timer is independent then you must define a separate variable for each. However, if each Rule is working on the timing of the same thing then you need only one variable.

I want to use the rules for turning lights off, after a set interval after they have been turned on, so i am guessing I need a seperate one for each for each rule, something like this ?

var Timer1 md1Timer = null
var Timer2 md1Timer = null
var Timer3 md1Timer = null
var Timer4 md1Timer = null


The easiest way to do this would probably be with the Expire binding.

2 Likes

Yes, you need a separate time for each light if each light operates independently. As Garry mentioned, the Expire binding is great for this.

1 Like