Email notifications

Related to the Portal
Post Reply
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Email notifications

Post by jsclownfish »

Hi all,

If I understand it correctly, when the portal sends an email alert it can only occur in 5 minute intervals and once per hour. I ask because there are times when it would be good to know quicker. For instance if my power cuts out. Usually everything comes back on OK, but sometimes there are problems. I also don't know if my battery back-up will run that long. Another example might be if there was a water leak. I might be able to get to it quicker or call home before things get out of hand.

Thanks,
Jon
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Email notifications

Post by rimai »

Try this:

Code: Select all

void WifiSendAlert(byte id, boolean IsAlert)
{
  static byte alert_status;

  if (IsAlert)
  {
    if ((alert_status & 1<<(id-1))==0)
    {
      alert_status|=1<<(id-1);
      Serial.print("GET /status/alert.asp?e=xxxxx@messaging.sprintpcs.com&id=");
      Serial.println(alert_status,DEC);
      Serial.println("\n\n");
    }
  }
  else
  {
    if (id==0)
    {
      alert_status=0;
      delay(900);
    }
    else
    {
      alert_status&=~(1<<(id-1)); 
    }
  }
}
Then use something like this in your loop:

Code: Select all

  if (ReefAngel.Params.Temp[1]<750 && ReefAngel.Params.Temp[1]>0) WifiSendAlert(3,true); 
  if (ReefAngel.Params.Temp[1]>760 && ReefAngel.Params.Temp[1]<1850) WifiSendAlert(3,false);
This thread is a little old, but you should be able to get the idea:
https://groups.google.com/forum/?fromgr ... -nQcPIF4hA
Roberto.
Post Reply