I can't find the WifiSendAlert() function in the libraries.

Requests for new functions or software apps
User avatar
Posts: 5338
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed May 29, 2013 4:34 pm
30 seconds. It should only send after 30 seconds.

Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm
PostPosted: Mon Jun 03, 2013 11:46 am
Lee,
I am curious if you have been receiving frequent false alarms from WifiAlert. I have been using it for a few days now and I receive several SMS alerts each day when I know that it should not be triggered that frequently. I am monitoring the status of both the ATO Low and ATO High float switches and sending the SMS text based upon the status. The ATO low float has been physically flipped so that the indicated display status on the portal displays green. The float switch is fully submerged in my ATO container and is triggered when the container is empty. I was receiving SMS text alerts every few minutes so I had to disable the code. The ATO High float switch is mounted at the top of the sump to monitor the water level and to prevent a sump overflow. It should not be triggered but I am receiving SMS alerts every few hours (but I don't see a pattern). I realize that you are not monitoring float switches but was curious if you are receiving false alerts too.
User avatar
Posts: 5338
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Jun 03, 2013 12:33 pm
I do have an alert on my float switches and haven't had any false alerts at all. Quite the opposite...a few alerts i should have received i have not. I don't know if roberto put any time delay on the alert page or if our strings are using up too much of the serial buffer or not. It has been working well, but i wouldn't say 100% at this point.

Can you post your code so i can see how you implemented it. I can see if any hanging logic as well that may be screwing up.

Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm
PostPosted: Mon Jun 03, 2013 12:55 pm
lnevo wrote:I do have an alert on my float switches and haven't had any false alerts at all. Quite the opposite...a few alerts i should have received i have not. I don't know if roberto put any time delay on the alert page or if our strings are using up too much of the serial buffer or not. It has been working well, but i wouldn't say 100% at this point.

Can you post your code so i can see how you implemented it. I can see if any hanging logic as well that may be screwing up.


Lee,
I also have a buzzer implemented which has been a very reliable alert for me so I have a good indicator when the float switches have been activated. I receive random SMS text alerts at all times to the extent that I have decided to disable the ATO container empty alert because it is triggered too frequently while the ATO container is actually full. Here are my code snippets...

Code: Select all
// ************ PLACE GLOBAL VARIABLE CODE BELOW HERE *******************

class WiFiAlert
{
public:
  WiFiAlert();
  void Send(char *message, char *key);
  inline void Send(char *message) { Send(message,""); }
  inline void SetDelay(int delay) { AlertDelay=delay; }
private:
  int AlertDelay;
  time_t LastAlert;
  boolean IsAlert();
  void WiFiSendAlert(char *message, char *key); 
};

WiFiAlert::WiFiAlert()
{
  AlertDelay=900;
  LastAlert=0;
}

boolean WiFiAlert::IsAlert()
{
  if (now()-LastAlert >= AlertDelay)
  {
    return true;
  }
  return false;
}

void WiFiAlert::Send(char *message, char *key)
{
  if (IsAlert())
  {
    LastAlert=now();
    WiFiSendAlert(message, key);
  }
}

void WiFiAlert::WiFiSendAlert(char *message, char *key)
{
  Serial.print("GET /status/wifialert.aspx?id=");
  Serial.print(ReefAngel.portalusername);
  Serial.print("&key=");
  Serial.print(key);
  Serial.print("&msg=");
  Serial.println(message);
  Serial.println("\n\n");
}

// Initialize Buzzer variables
byte buzzer=0;
byte overheatflag=0;
byte atoflag=0;

// Declare variables for Wifi Alert
static WiFiAlert sumpOverflowAlarm, tempAlarm;
static WiFiAlert atoEmptyAlarm;

void setup()
{
 
// Added buzzer 1-19-13   
// Sound buzzer if any flag is set.
// Added 1-19-13 - Uncomment when I purchase the IO expansion module.
//   buzzer = overheatflag + atoflag + iochannel0flag + iochannel1flag + iochannel2flag + iochannel3flag + iochannel4flag + iochannel5flag;
   buzzer = overheatflag + atoflag;
   if ( buzzer >= 1 ){
     buzzer = InternalMemory.read(buzzer_volume); // Set value of buzzer volume.
 } else {
     ReefAngel.PWM.SetDaylight(0);
   } 
//   Do not sound the buzzer for empty ATO reservior between 7:00 am and 10:00 pm.
   if (!ReefAngel.LowATO.IsActive() && ( hour() >= 7 && hour() < 22)) {
      ReefAngel.PWM.SetDaylight( buzzer );
      atoEmptyAlarm.SetDelay(3600); // delay SMS text alert for 1 hour.
      atoEmptyAlarm.Send("ATO_container_empty","xxxxxxxxxx");
 } else {   
      ReefAngel.PWM.SetDaylight(0);
      if (!ReefAngel.HighATO.IsActive()) {
        ReefAngel.PWM.SetDaylight( buzzer );
        sumpOverflowAlarm.SetDelay(300); // delay SMS alert for 5 minutes.
        sumpOverflowAlarm.Send("Sump_WaterLevel_too_high","xxxxxxxxxx");
    } else {
        ReefAngel.PWM.SetDaylight(0);
      }
   }   


Thanks for your help,
John
User avatar
Posts: 5338
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Jun 03, 2013 2:00 pm
So two things to check...is it just the ato empty alarm being flakey? Or both?

What is the IP the alert is coming from? I did have a false alarm early on but it was from someone or some bot clicking in this thread...i changed the url in the post and havent had any others..

We may need some logs from roberto to see if these hot queued up on his end or if he's getting valid alerts from your controller.

The code looks good at first glance.

Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm
PostPosted: Mon Jun 03, 2013 3:36 pm
lnevo wrote:So two things to check...is it just the ato empty alarm being flakey? Or both?

What is the IP the alert is coming from? I did have a false alarm early on but it was from someone or some bot clicking in this thread...i changed the url in the post and havent had any others..

We may need some logs from roberto to see if these hot queued up on his end or if he's getting valid alerts from your controller.

The code looks good at first glance.


They are both sending false alerts, but the ATO empty occurs every few minutes where the Sump overflow occurs every few hours. The buzzer works flawlessly and is triggered by the same float switches.
User avatar
Posts: 5338
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Jun 03, 2013 4:26 pm
Ok a few strange things i noticed.

One is you have all that code in setup() and not in loop()...not sure why that would make a difference, but something worth correcting, I had a block of code in setup and it was behaving completely different than what I'd expect.

Second you have your wifi alarm variables as globals and static which might cause it to behave strangely. Try taking off the static or leaving it but putting it inside setup or eventually to loop.
User avatar
Posts: 5338
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Jun 03, 2013 4:27 pm
mudcat1 wrote:They are both sending false alerts, but the ATO empty occurs every few minutes where the Sump overflow occurs every few hours. The buzzer works flawlessly and is triggered by the same float switches.


Are you sure the empty is alarming every few minutes...the overflow is the one with the 5 minute delay...

Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm
PostPosted: Mon Jun 03, 2013 5:06 pm
lnevo wrote:Ok a few strange things i noticed.

One is you have all that code in setup() and not in loop()...not sure why that would make a difference, but something worth correcting, I had a block of code in setup and it was behaving completely different than what I'd expect.

Second you have your wifi alarm variables as globals and static which might cause it to behave strangely. Try taking off the static or leaving it but putting it inside setup or eventually to loop.


Lee,
I tried to make my code similar to yours, however, I was not sure how to use the #include statement as you did so I copied the wifialert() code immediately following the include statements. I added the static declaration because I saw it in your ino but I will remove it shortly.

Posts: 133
Joined: Sun Dec 09, 2012 7:23 pm
PostPosted: Mon Jun 03, 2013 5:08 pm
lnevo wrote:
mudcat1 wrote:They are both sending false alerts, but the ATO empty occurs every few minutes where the Sump overflow occurs every few hours. The buzzer works flawlessly and is triggered by the same float switches.


Are you sure the empty is alarming every few minutes...the overflow is the one with the 5 minute delay...


Yes, the ato empty alert was occurring more frequently than the sump overflow.
PreviousNext

Return to Requests

Who is online

Users browsing this forum: No registered users and 2 guests