I'm struggling with some easy stuff.
All I want to do is switch a dummy to detect presence for an x time to control lights .
The code below works but if the switch is triggered for a second time within the countdown time the 'Presence' won't go to it's OFF state any more
every time there is movement it needs to be reset to 60 minutes and countdown again.
Using the 'Off after' doen't do the job, then the lights go off and you have to move your butt to trigger it again
hope you guys can help me out
Code: Select all
commandArray = {}
if (devicechanged['Motion 1 WK'] == 'On' and otherdevices['PowerOff'] == 'On') then
commandArray['Presence'] = 'On FOR 60' -- minutes
end
if (devicechanged['Motion 2 Hal'] == 'On' and otherdevices['PowerOff'] == 'On') then
commandArray['Presence'] = 'On FOR 60' -- minutes
end
return commandArray