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.

Controlling Temp with timer
#6
Event script:
Code:
temp = event.getvalue()

curr = temp > 23
prev = storage.get('temp_over')

if curr ~= prev then
  storage.set('temp_time', os.time())
  storage.set('temp_notified', false)
  storage.set('temp_over', curr)
end

Scheduled script:
Code:
notified = storage.get('temp_notified')
if not notified then
  curr = storage.get('temp_over')
  
  now = os.time()
  time = storage.get('temp_time', now)
  delta = now - time
  
  if delta > 5 * 60 then
    if curr then
      text = 'temp over limit'
    else
      text = 'temp under limit'
    end

    -- send email
    storage.set('temp_notified', true)
  end
end
Reply


Messages In This Thread
RE: Controlling Temp with timer - by admin - 15.03.2019, 08:05
RE: Controlling Temp with timer - by admin - 21.03.2019, 13:31
RE: Controlling Temp with timer - by Gadjoken - 10.09.2019, 12:10
RE: Controlling Temp with timer - by admin - 10.09.2019, 14:40

Forum Jump: