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
#5
If I adjust the first code, will this work?
Code:
obj1 = grp.find('0/2/6') -- "lock"
obj2 = grp.find('0/2/7') -- "normal"
obj3 = grp.find('0/2/5') -- "2 hour lock"

now = os.time() -- current timestamp in seconds
delta1 = now - obj1.updatetime -- last object update relative time
delta2 = now - obj2.updatetime -- last object update relative time
delta3 = now - obj3.updatetime -- last object update relative time

if (delta1 > delta3) and (obj2.value and delta2 > (2 * 60 * 60))  then
  obj2:write(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 tennung - 24.08.2020, 20:27
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: