checkFirst doesn't work in my script
Posted: Friday 09 February 2018 15:09
Hi
First of all big thank for dzVents!
This is my first script so excuse me for my noob question.
Goal of this script. When motion in my house, the dummy switch ' iemand thuis' = on. When for 20 minutes no motion is detected switch = off. But with the script below i only get ' off' messages and no ' on' message.See last 3 lines. What is wrong?
Greets Gijs
First of all big thank for dzVents!
This is my first script so excuse me for my noob question.
Goal of this script. When motion in my house, the dummy switch ' iemand thuis' = on. When for 20 minutes no motion is detected switch = off. But with the script below i only get ' off' messages and no ' on' message.See last 3 lines. What is wrong?
Greets Gijs
Code: Select all
return {
on = {
devices = {
'Motion Woon',
'Motion Studeer',
'Motion Keuken',
'Motion Badkamer',
'Motion Hal',
'Motion Emma'
}
},
execute = function(domoticz, device)
if ((device.name == 'Motion Woon' and device.state == 'On') or
(device.name == 'Motion Studeer' and device.state == 'On')or
(device.name == 'Motion Keuken' and device.state == 'On')or
(device.name == 'Motion Badkamer' and device.state == 'On')or
(device.name == 'Motion Hal' and device.state == 'On')or
(device.name == 'Motion Emma' and device.state == 'On')) then
domoticz.devices('Iemand Thuis').switchOn().checkFirst()
domoticz.devices('Iemand Thuis').cancelQueuedCommands()
domoticz.devices('Iemand Thuis').switchOff().afterMin(20)
end
end
}