12.08.2020, 09:33
For the timer you need a scheduled script that runs every minute. It check if the object is in ON state and sends off if the object has not been updated in 2 hour time.
You will need two event scripts.
0/2/5 (turn 0/2/7 ON when ON is received):
0/2/6 (turn 0/2/7 OFF when ON is received):
Code:
obj = grp.find('0/2/7')
now = os.time() -- current timestamp in seconds
delta = now - obj.updatetime -- last object update relative time
if obj.value and delta > (2 * 60 * 60) then
obj:write(false)
end
You will need two event scripts.
0/2/5 (turn 0/2/7 ON when ON is received):
Code:
value = event.getvalue()
if value then
grp.write('0/2/7', true)
end
0/2/6 (turn 0/2/7 OFF when ON is received):
Code:
value = event.getvalue()
if value then
grp.write('0/2/7', false)
end