Code: Select all
return {
on = {
devices = {'PIR*'},
timer = {'every minute'}
},
execute = function(domoticz,device,triggerInfo)
if triggerInfo.type == domoticz.EVENT_TYPE_DEVICE and device.active then
domoticz.devices(device.name:sub(4)).switchOn().checkFirst().silent()
elseif triggerInfo.type == domoticz.EVENT_TYPE_TIMER then
domoticz.devices().filter(function(device)
return (device.name:sub(1,3) == 'PIR')
end).forEach(function(PIRDevice)
if not(PIRDevice.active) and PIRDevice.lastUpdate.minutesAgo >= 5 then
domoticz.devices(PIRDevice.name:sub(4)).switchOff().checkFirst().silent()
end
end)
end
end
}
Everything worked fine for over a year unit just recently I manually turned a light on by clicking on the device light bulb (21:54:31) in the Domoticz GUI and the light shut off the following minute. IE 21:55:00. The light is supposed to stay on for 5 minutes, I believe this was working fine when I initially wrote this. I tried turning the light on through json and the same issue occurs, but when I activate a motion sensor all works well.
I'm running the latest Domoticz beta on a rpi3.
Any ideas?