conditional .switchOff().afterMin(15)

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Ewaldharmsen
Posts: 130
Joined: Tuesday 07 February 2017 15:00
Target OS: Linux
Domoticz version:
Contact:

conditional .switchOff().afterMin(15)

Post 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?
User avatar
habahabahaba
Posts: 192
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

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

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest