Can anyone help me to get this script to work.
After many attempts I did manage to get no more error messages in the Domoticz log. But the script still doesn't work
The script should turn on a switch on movement and turn off after a set time.
Code: Select all
return
{
active = true,
on =
{
devices = {
'691', --Bewegingsensor (Xiaomi Human Body Sensor)
'37', --Camera kinderkamer (schakelaar)
},
},
execute = function(dz,motion)
local motion = dz.devices('691')
local cam = dz.devices('37')
if motion.state == 'On' and cam.active then
domoticz.log('Motion state');
return
elseif not(cam.active) then
cam.switchOn()
domoticz.log('Cam state on');
cam.switchOff().afterSec(30)
domoticz.log('Cam state off');
end
end
}
Fredom