at the moment when the script is called the timer is reset to 20 seconds again.
is this the way to do things or should i first cancel the previous command with .cancelQueuedCommands()
eg, is the .cancelQueuedCommands() neccesary because it works with this command as well but i do not know if this eats up memory by extending the timer instead of closing it and calling it again
i basically want the timer to be extended when movement is detected instead of switching the light off and on again
Code: Select all
return {
active = true,
on = {
devices = {
['PIR sensor'] = {'between sunset and 00:00'}
}
},
execute = function(domoticz, beweging)
domoticz.devices('Veranda').cancelQueuedCommands()
if beweging.state == 'On' then
domoticz.devices('Veranda').switchOn().checkFirst().afterSec(20)
end
end
}