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.

Send a Email when a New alert occurs
#1
Hello.

I'm sure this i already posted but I just couldn't find it. 

Is it possible to send an Email when a new alerts occurs. I could imprent it in every script but it just seams alot of extra work if there is a solution. 

If I was to include it in a every script, how do I get the value included in the email also. 



This ofcourse dosen't work but what will? 
temperature = event.getvalue()
subject = 'Vestis Gerby Alarm'
message = 'Vestis Gerby Alarm ', temperature
mail('table', subject, message)
Reply
#2
You can create a custom function and place it into Common functions. Then this function can be used in all script.
Code:
function mailalert(subject, message)
  mail({ ... }, subject, message)
  alert(message)
end

Event script:
Code:
temperature = event.getvalue()
subject = 'Vestis Gerby Alarm'
message = 'Vestis Gerby Alarm ' .. temperature
mailalert(subject, message)
Reply
#3
(28.12.2021, 08:33)admin Wrote: You can create a custom function and place it into Common functions. Then this function can be used in all script.
Code:
function mailalert(subject, message)
  mail({ ... }, subject, message)
  alert(message)
end



Thanks, now I get emails Smile
It's just the alerted function stoped working, what am I missing? 

temperature = event.getvalue()
setpoint = 68
alerted = storage.get('alerted')
if temperature >= setpoint then
  if not alerted then
      mailalert('Vestis Gerby', 'Kayttovesi Lahto Lampotila Korkea Ouman ' .. temperature)
    storage.set('alerted', true)
  end
else
  storage.set('alerted', false)
end
Reply


Forum Jump: