Page 1 of 1

conditional .switchOff().afterMin(15)

Posted: Wednesday 14 February 2024 9:28
by Ewaldharmsen
I want my light to switch off automatically after 15 minutes after I turned it on. I know I can do that with .switchOff().afterMin(15).
But I don't want to switch off if some condition is true at th emoment of switching off.

How can I do that?

Re: conditional .switchOff().afterMin(15)

Posted: Wednesday 14 February 2024 9:37
by habahabahaba

Code: Select all

if (MotionSensor1.state == 'On' and switchSecondFloor.state == 'Off') then
                 
                 switchSecondFloor.switchOn().forMin(2).checkFirst()
              
                 
            elseif (MotionSensor1.state == 'On' and switchSecondFloor.state == 'On') then 
                
                switchSecondFloor.cancelQueuedCommands()  
                switchSecondFloor.switchOff().checkFirst().afterSec(120)
                 
            end