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
#3
(15.03.2019, 08:05)admin Wrote: Create an event script mapped to temperature object:
Code:
temp = event.getvalue()

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

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

 storage.set('temp_over', curr)
end

Then create a scheduled script that runs every minute to check whether e-mail needs to be sent. Change delta time if needed (60 * 60 = 1 hour in seconds).
Code:
curr = storage.get('temp_over')
notified = storage.get('temp_notified')
if curr and not notified then
 now = os.time()
 time = storage.get('temp_time', now)

 delta = now - time
 if delta > 60 * 60 then
   -- send email
   storage.set('temp_notified', true)
 end
end

Thank you very much!! Script works perfectly on my LM. Is there any handbook or manual to learn advanced scripts in LUA???
Reply


Messages In This Thread
RE: Controlling Temp with timer - by admin - 15.03.2019, 08:05
RE: Controlling Temp with timer - by ajgarcia.reyse - 21.03.2019, 13:27
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: