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?
conditional .switchOff().afterMin(15)
Moderator: leecollings
-
- Posts: 130
- Joined: Tuesday 07 February 2017 15:00
- Target OS: Linux
- Domoticz version:
- Contact:
- habahabahaba
- Posts: 192
- Joined: Saturday 18 March 2023 14:44
- Target OS: Windows
- Domoticz version: 2024.4
- Contact:
Re: conditional .switchOff().afterMin(15)
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
Who is online
Users browsing this forum: No registered users and 1 guest