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.

temperature not reach setpoint
#1
Hy,

Maybe is same example script.
I need script if real temperature difference is more then 1 degree of set point in 24 hours need to send alert.
Reply
#2
You need two scripts:
1. Event script mapped to a tag (for both setpoint and current temperature). For each object update, check if delta is within limits or not. If delta is ok, put current timestamp in storage:
Code:
temp =  grp.getvalue('1/1/1')
setp = grp.getvalue('1/1/2')
delta = math.abs(temp - setp)
if delta <= 1 then
  storage.set('last_update', os.time())
  storage.set('notified', false)
end

2. Scheduled script which will check time difference between now and last_update key (in seconds):
Code:
prev = storage.get('last_update', 0)
delta = prev - os.time()
if delta >= (24 * 60 * 60) then
  notified = storage.get('notified')
  if not notified then
    -- send e-mail here
    storage.set('notified', true)
  end
end
Reply
#3
Thanks for your help Wink
Reply


Forum Jump: