I use the following script for the motion detector (from the Wiki)
Code: Select all
-- ~/domoticz/scripts/lua/script_device_PIRs.lua
commandArray = {}
tc=next(devicechanged)
v=tostring(tc)
if (v:sub(1,3) == 'PIR') then
c=v:sub(4)
commandArray[c] = 'On'
tmess = c..' On - time 0'
print(tmess)
end
return commandArray
When there is a motion, a dummy switch is set to ON, I use another script to turn it off after a couple of minutes. Now the following happens: someone crosses the motion the detector, the virtual switch is set to ON, now this person moves for the sensor and the script is sending the ON command again. I would like to send the ON signal just once. I am not so experienced in LUA scripting, so any help is appreciated.