Temperature email alert

9 years 2 weeks ago #2642 by old-techie
Hi Guys,
Loving this project.
I have looked through a whole bunch of threads about email alerts, & I think i have roughly the idea, from numerous postings here, thanks.

But I just don't understand how to link that with a temperature value going below a certain level, I am not normally thick, but I do feel it on this one!

Say I need an alert if temp <= 25 degrees C
Any pointers would be gratefully received. Thanks in advance.

Please Log in or Create an account to join the conversation.

9 years 2 weeks ago - 8 years 9 months ago #2643 by NightOne
Replied by NightOne on topic Temperature email alert
Hi there,

The developer of EasyIOT has been very kind to us newbies and has done all the hard work behind the scenes.... we can access email though the automation fucntion.

First we must create a new automation program... then we must tell the program to watch a perticular sensor value and send a mail if it falls below a certain value

Here is some sample code for you to work with (assuming you use gmail):
Please note also that you would have to change the values for your sensor as well as your email address and password.....
For more info you can read up on email helper function here iot-playground.com/2-uncategorised/32-ea...-automation-part-iii

Code starts here:

public void Setup()
{
EmailHelper.SetupSmtp("This email address is being protected from spambots. You need JavaScript enabled to view it.", "yourgmailpass", "smtp.gmail.com", 587, true);

EventHelper.ModuleChangedHandler((o, m, p) =>
{
Console.WriteLine(m.Address + " in program id "+ Program.ProgramId.ToString()+ " property "+ p.Property + " value " + p.Value);
if ((m.Domain == Domains.VIRTUAL) && (m.Address == "N0S1") && (p.Property == "Sensor.Temperature") && (Int32.Parse(p.Value) <= 25))
{
string mailBody = "Temp has fallen below 25 and the sensor is currently reading: " +p.Value;
EmailHelper.SendEmail("This email address is being protected from spambots. You need JavaScript enabled to view it.", "This email address is being protected from spambots. You need JavaScript enabled to view it.", "Temp: Alert", mailBody);
}
return true;
});
}
public void Run()
{
}
The following user(s) said Thank You: osalval, old-techie

Please Log in or Create an account to join the conversation.

9 years 2 weeks ago #2646 by old-techie
Replied by old-techie on topic Temperature email alert
tch,
you beauty!

Thanks very much, look slike a great answer.
Big smiles.
;-)

Please Log in or Create an account to join the conversation.

8 years 10 months ago #2998 by seston
Replied by seston on topic Temperature email alert
I want to try this too.

Please Log in or Create an account to join the conversation.

Time to create page: 0.240 seconds

Forum latest

  • No posts to display.