I've recently started coding my Domoticz install using DzVents. I really like the simplicity, especially compared to the other methods of scripting. But there's one thing I'm missing that should not be that hard to implement I think.
I'm trying to automate things after a period of inactivity. So you enter a room, light comes on (PIR detection) but it should switch off again after 15 minutes of inactivity (left the room but didn't kill the lights). Perfectly doable of course using a timer script and monitoring the last activity on the PIR, but then I have my "light on" and "light off" code in two different scripts.
What you'd really want is something like:
Code: Select all
device.switchOn()
device.switchOff().afterMin(15)
Code: Select all
device.switchOn()
device.switchOff().afterMin(15, true)
Even fancier would be to have an inline method execute. So something like:
Code: Select all
device.do( (device) => {
if (device.state == 'On') then
device.switchOff()
end
}).afterMin(15, true)
Let me know your thoughts!