This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Set / reset circuit with timer
#2
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.
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
Reply


Messages In This Thread
Set / reset circuit with timer - by tennung - 11.08.2020, 21:30
RE: Set / reset circuit with timer - by admin - 12.08.2020, 09:33
RE: Set / reset circuit with timer - by Dré - 21.03.2021, 11:03
RE: Set / reset circuit with timer - by admin - 25.08.2020, 06:31
RE: Set / reset circuit with timer - by admin - 22.03.2021, 06:33
RE: Set / reset circuit with timer - by Dré - 22.03.2021, 13:30

Forum Jump: