I can't find the WifiSendAlert() function in the libraries.
Re: I can't find the WifiSendAlert() function in the librari
Lee,
Using the portal will it send the alert immediately or does it delay it some period of time (ex. 5 minutes or 1 hour)? I did not receive the immediate SMS text as I expected. I manually tested sending an SMS text using the email address that I specified in the portal and received the text within a few seconds.
Using the portal will it send the alert immediately or does it delay it some period of time (ex. 5 minutes or 1 hour)? I did not receive the immediate SMS text as I expected. I manually tested sending an SMS text using the email address that I specified in the portal and received the text within a few seconds.
Re: I can't find the WifiSendAlert() function in the librari
Its set to only page once every 15 minutes. You can change it with .SetDelay(int)
I wonder if the empty key is causing an issue. Can you try appending that output to http://forum.reefangel.com and see if you get a page? Try without the &key=
I wonder if the empty key is causing an issue. Can you try appending that output to http://forum.reefangel.com and see if you get a page? Try without the &key=
Re: I can't find the WifiSendAlert() function in the librari
Yeah this is the part that didn't work for me either. The serial output looks good though except for the empty key.mudcat1 wrote:Lee,
Using the portal will it send the alert immediately or does it delay it some period of time (ex. 5 minutes or 1 hour)? I did not receive the immediate SMS text as I expected. I manually tested sending an SMS text using the email address that I specified in the portal and received the text within a few seconds.
I need to look at the original code again and make sure I didn't miss anything.
Re: I can't find the WifiSendAlert() function in the librari
Lee,lnevo wrote:Its set to only page once every 15 minutes. You can change it with .SetDelay(int)
I wonder if the empty key is causing an issue. Can you try appending that output to http://forum.reefangel.com and see if you get a page? Try without the &key=
I did not see your message in time. I added a portal key to see if that might be the issue. It will take me a few minutes to put it back to its original state. But i did just try your suggestion...
http://forum.reefangel.com/status/wifia ... with%20key
...with a portal key and the portal did send me a SMS text message.
Re: I can't find the WifiSendAlert() function in the librari
Alright, i know the page works and i know the code is working to some degree...we'll get this going tonight...
Re: I can't find the WifiSendAlert() function in the librari
Lee,
I also tried sending this command after removing the portal key.
wifialert.aspx?id=mudcat1&msg=Test%20without%20key (URL trimmed to prevent spam)
It successfully sent the SMS text too.
I also tried sending this command after removing the portal key.
wifialert.aspx?id=mudcat1&msg=Test%20without%20key (URL trimmed to prevent spam)
It successfully sent the SMS text too.
Re: I can't find the WifiSendAlert() function in the librari
I tested also with a blank key and it was fine...so our syntax is good...
Re: I can't find the WifiSendAlert() function in the librari
Roberto... I think this time it's your fault
If I go to the IP that is set on the wifi module and try the URL I'm generating, I get a 404 that the resource is not found...
URL removed to prevent spamming!
If I use forum.reefangel.com which is a different IP it works. So it looks like we just need to copy the aspx file over... hopefully simple
If I go to the IP that is set on the wifi module and try the URL I'm generating, I get a 404 that the resource is not found...
URL removed to prevent spamming!
If I use forum.reefangel.com which is a different IP it works. So it looks like we just need to copy the aspx file over... hopefully simple
Re: I can't find the WifiSendAlert() function in the librari
I think you are right
I'll fix it shortly....
I'll fix it shortly....
Roberto.
Re: I can't find the WifiSendAlert() function in the librari
Cool. I think that should take care of the issue Btw, I also added a force option just do object.Send("Msg",true); and it will bypass the time check. Make sure you put some type of flag that this was done once. I am using it for my power outage check. So it's nice to know when power is restored. I'm sure others will find good use for it.
Also, some notices, I needed a lot less time (30 seconds...during WC mode...) between notifications or wanted a lot more time (like once per hour), so the SetDelay should be nice feature for all of those. The default in the class is currently 15 minutes.
Also, some notices, I needed a lot less time (30 seconds...during WC mode...) between notifications or wanted a lot more time (like once per hour), so the SetDelay should be nice feature for all of those. The default in the class is currently 15 minutes.
Re: I can't find the WifiSendAlert() function in the librari
Ok, I've made the required changes.
Can you try again?
Can you try again?
Roberto.
Re: I can't find the WifiSendAlert() function in the librari
I don't think it is working for me. Where do I change the time interval with .SetDelay(int)? I can't find this anywhere.
Lee,
Did you have to change any of the original code to get it working?
Lee,
Did you have to change any of the original code to get it working?
Re: I can't find the WifiSendAlert() function in the librari
Its part of the object..so if you declared atoAlarm then atoAlarm.SetDelay(30);
I didn't change any of the code. The code was good i need to upload my version with the force option tomorrow and see if that part is working. That might make debug easier..
I didn't change any of the code. The code was good i need to upload my version with the force option tomorrow and see if that part is working. That might make debug easier..
Re: I can't find the WifiSendAlert() function in the librari
Lee,
The problem that I am encountering now seems to be that it will not send the portal key with the request.
I have the portal key specified in the INO.
ReefAngel.Portal( "mudcat1","xxxxxxxxxx" );
When the float switch is triggered. This gets sent...
GET /status/wifialert.aspx?id=mudcat1&key=&msg=Sump_WaterLevel_too_high
The portal key is missing "&key=" How did you get past that issue?
Thanks,
John
The problem that I am encountering now seems to be that it will not send the portal key with the request.
I have the portal key specified in the INO.
ReefAngel.Portal( "mudcat1","xxxxxxxxxx" );
When the float switch is triggered. This gets sent...
GET /status/wifialert.aspx?id=mudcat1&key=&msg=Sump_WaterLevel_too_high
The portal key is missing "&key=" How did you get past that issue?
Thanks,
John
Re: I can't find the WifiSendAlert() function in the librari
I didn't get that far...i don't use a key. Your using the copy/paste code above? I'll check in a little while if i missed something.
For the record, long term the second arg will be for force not for key...that will get stored in library when you do SendPortal
For the record, long term the second arg will be for force not for key...that will get stored in library when you do SendPortal
Re: I can't find the WifiSendAlert() function in the librari
Oh just re-read your post. If your doing copy / paste the. You will need to do
atoAlarm.Send("msg","key");
Edit: forgot the function syntax updated.
atoAlarm.Send("msg","key");
Edit: forgot the function syntax updated.
Re: I can't find the WifiSendAlert() function in the librari
So, this is starting to seriously call for a class to manage all the dosing pumps and a class for each dosing pump with its characteristics (calibration volume, rate factor, timers, messages, etc.)
Anyway, here's my first run at a calibraton routine. The way it works is that I have a virtual outlet that I turn on to calibrate. This could just as easily be a menu mode... When that outlet is on, the calibration starts. For each pump defined it waits for the maskon to happen. when you turn it on it assumes you are filling a measuring cup to whatever amount you want. At that point it records the time. When the mask off happens it compares the times and gets the total running time. It then pages you with the result. If you need to turn the pump back on for a little more, it will track the running time. When your happy with the result, the last page you get will be the total time.
You can then put that time into a memory variable and that is used by my previous dosing pump routine to calculate the dosage. Since you've also stored the amount of liquid you are measuring we can properly calculate this. Also, the units can be whatever.. it could just as easily be 5 gallons in 200 seconds or 100ml in an hour.
What is now important is that you can now enter the number of ml or gallons or whatever you want and over how ever many doses you want per day and it's all calculated... Let's see how it tests out.
I'm also going to add logging that we started working on for kirkwood. What I would like a separate function that is logging the relay and storing the total time it is on and send me the total each hour.
Anyway, without further-ado. This code is compiled but not yet tested. It will be uploaded after this post
Anyway, here's my first run at a calibraton routine. The way it works is that I have a virtual outlet that I turn on to calibrate. This could just as easily be a menu mode... When that outlet is on, the calibration starts. For each pump defined it waits for the maskon to happen. when you turn it on it assumes you are filling a measuring cup to whatever amount you want. At that point it records the time. When the mask off happens it compares the times and gets the total running time. It then pages you with the result. If you need to turn the pump back on for a little more, it will track the running time. When your happy with the result, the last page you get will be the total time.
You can then put that time into a memory variable and that is used by my previous dosing pump routine to calculate the dosage. Since you've also stored the amount of liquid you are measuring we can properly calculate this. Also, the units can be whatever.. it could just as easily be 5 gallons in 200 seconds or 100ml in an hour.
What is now important is that you can now enter the number of ml or gallons or whatever you want and over how ever many doses you want per day and it's all calculated... Let's see how it tests out.
I'm also going to add logging that we started working on for kirkwood. What I would like a separate function that is logging the relay and storing the total time it is on and send me the total each hour.
Anyway, without further-ado. This code is compiled but not yet tested. It will be uploaded after this post
Code: Select all
// Run calibration routine,
void CalibrateDPumps() {
const byte numPumps=2;
byte pump[numPumps] = { DPump1, DPump2 };
static time_t pumpTimer[numPumps];
static WiFiAlert calibrateMsg;
char msg[16];
if (ReefAngel.Relay.Status(VO_Calibrate)) {
for (int i=0;i < numPumps;i++) {
if (ReefAngel.Relay.isMaskOn(pump[i])) {
pumpTimer[i]=now()-pumpTimer[i];
ReefAngel.Relay.Override(pump[i],2);
ReefAngel.Relay.On(pump[i]);
}
if (ReefAngel.Relay.isMaskOff(pump[i]) && pumpTimer[i]>0) {
ReefAngel.Relay.Override(pump[i],2);
ReefAngel.Relay.Off(pump[i]);
pumpTimer[i]=now()-pumpTimer[i];
sprintf(msg,"Pump%d+:+%d",i+1,pumpTimer[i]);
calibrateMsg.Send(msg,true);
}
}
} else {
for (int i=0;i< numPumps;i++) {
pumpTimer[i]=0;
}
}
}
Re: I can't find the WifiSendAlert() function in the librari
Lee,lnevo wrote:Oh just re-read your post. If your doing copy / paste the. You will need to do
atoAlarm.Send("msg","key");
Edit: forgot the function syntax updated.
That fixed it. I can now send SMS texts from the Reef Angel.
Thanks for all of your help and patience.
John
Re: I can't find the WifiSendAlert() function in the librari
Lee,
One more question. What interval does the 30 specify in this statement?
atoAlarm.SetDelay(30);
Is it 30 minutes, 30 seconds or 30 milliseconds? And does this delay the interval between when it will send the alert? I just tested the Sump too hot code and it SPAMMED me with several messages. I need to tune something.
Thanks,
John
One more question. What interval does the 30 specify in this statement?
atoAlarm.SetDelay(30);
Is it 30 minutes, 30 seconds or 30 milliseconds? And does this delay the interval between when it will send the alert? I just tested the Sump too hot code and it SPAMMED me with several messages. I need to tune something.
Thanks,
John
Re: I can't find the WifiSendAlert() function in the librari
30 seconds. It should only send after 30 seconds.
Re: I can't find the WifiSendAlert() function in the librari
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.
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.
Re: I can't find the WifiSendAlert() function in the librari
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.
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.
Re: I can't find the WifiSendAlert() function in the librari
Lee,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.
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);
}
}
John
Re: I can't find the WifiSendAlert() function in the librari
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.
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.
Re: I can't find the WifiSendAlert() function in the librari
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.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.
Re: I can't find the WifiSendAlert() function in the librari
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.
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.
Re: I can't find the WifiSendAlert() function in the librari
Are you sure the empty is alarming every few minutes...the overflow is the one with the 5 minute delay...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.
Re: I can't find the WifiSendAlert() function in the librari
Lee,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.
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.
Re: I can't find the WifiSendAlert() function in the librari
Yes, the ato empty alert was occurring more frequently than the sump overflow.lnevo wrote:Are you sure the empty is alarming every few minutes...the overflow is the one with the 5 minute delay...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.