Welcome, Guest
Username: Password: Remember me

TOPIC: Temperature email alert

Temperature email alert 1 year 4 months ago #2642

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.
The administrator has disabled public write access.

Temperature email alert 1 year 4 months ago #2643

  • NightOne
  • NightOne's Avatar
  • Offline
  • Premium Member
  • Posts: 81
  • Thank you received: 26
  • Karma: 5
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()
{
}
Last Edit: 1 year 1 month ago by NightOne.
The administrator has disabled public write access.
The following user(s) said Thank You: osalval, old-techie

Temperature email alert 1 year 4 months ago #2646

tch,
you beauty!

Thanks very much, look slike a great answer.
Big smiles.
;-)
The administrator has disabled public write access.

Temperature email alert 1 year 1 month ago #2998

  • seston
  • seston's Avatar
  • Offline
  • Junior Member
  • Posts: 38
  • Thank you received: 1
  • Karma: 0
I want to try this too.
The administrator has disabled public write access.
Time to create page: 0.146 seconds
Powered by Kunena Forum