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.

Double timer, with time on and off
#2
Event script:
Code:
if event.getvalue() then
  storage.set('presence_time', os.time())  
end

Resident script with sleep time set to 1 second:
Code:
curr_trig_time = storage.get('presence_time', 0)

if not prev_trig_time then
  prev_trig_time = curr_trig_time
end

if curr_trig_time > prev_trig_time then
  prev_trig_time = curr_trig_time

  grp.write('0/0/2', true)
  os.sleep(5 * 60)
  grp.write('0/0/2', false)
  os.sleep(15 * 60)
end
Reply


Messages In This Thread
RE: Double timer, with time on and off - by admin - 16.11.2022, 07:54

Forum Jump: