Just created my first button rule which controls two switches independently, depending on hiw many times button is pushed.
What i would like to do is only run the rule if previous button push was less than a certain time, say 30 seconds. If the button hasnt been pressed in last 30 seconds then all lights go off.
Basically subtracting one time from another, but allowing for going past midnight.
Can you share a screenshot of the rule?
This is what I have so far (Italicised is code, bold is what I want to add in sort of psuedo code
Set CurrentTime to current date and time(2023-09-20 17:15)
IF CurrentTime < LastPress + 30 (secs)
Set Lights to 10
IF (Front(off) is on FALSE) Add 1 to Lights
IF (Table(off) is on FALSE) Add 2 to Lights
IF (Variable Lights(11) = 10 FALSE) On: Front
IF (Variable Lights(11) = 11 TRUE) On: Table
IF (Variable Lights(11) = 12 FALSE) Off: Table
IF (Variable Lights(11) = 13 FALSE) Off: Front
Set LastPress to current date and time(2023-09-20 17:15)
Hope that makes sense