Setting Reminders
- ewaldsreef
- Posts: 81
- Joined: Tue Oct 08, 2013 8:22 pm
- Location: Salt Lake City, UT
- Contact:
Setting Reminders
Is there a tutorial for setting reminders? I would like to learn more about this.
-
- Posts: 103
- Joined: Fri Jul 03, 2015 8:29 am
Re: Setting Reminders
i would also like to know if this is possible....anyone?
Re: Setting Reminders
what kind of reminders are you talking about? like general maintenance reminders?
if so, then you will need to do something yourself.
however, depending on what you want to do, you could code a function to send yourself a wifi alert to do something like you can when an error occurs. it gets harder though because you have to store stuff in the internal memory to keep values across reboots.
so more details are needed on what you want to do.
Sent from my iPad mini
if so, then you will need to do something yourself.
however, depending on what you want to do, you could code a function to send yourself a wifi alert to do something like you can when an error occurs. it gets harder though because you have to store stuff in the internal memory to keep values across reboots.
so more details are needed on what you want to do.
Sent from my iPad mini
-
- Posts: 103
- Joined: Fri Jul 03, 2015 8:29 am
Re: Setting Reminders
I would like it for scheduled maintenance reminders, water changes and so on.
Sent from my SAMSUNG-SM-G900A using Tapatalk
Sent from my SAMSUNG-SM-G900A using Tapatalk
Re: Setting Reminders
Ok. Well, if there was a set schedule that you perform things then that could be done. Say for example, every month on the first, you always do your monthly maintenance, you could setup a WifiAlert to be sent out at say 5pm (after work) on that day (or whatever time you wanted) and it could just say "Monthly maintenance reminder".fishflipper wrote:I would like it for scheduled maintenance reminders, water changes and so on.
Sent from my SAMSUNG-SM-G900A using Tapatalk
If you changed your water every 2 weeks or 4 weeks, you could setup another WifiAlert to check if the week of the year is divisible by 2 or 4 (mod 2 or mod 4), and on every Sunday (or whatever day you want), it could send out another reminder for your water change and say "Time for Water Change".
Does that sound like something you would want? If so, reply back with the schedule of alerts/reminders that you would like to have implement and we can get something started for you to tweak.
-
- Posts: 103
- Joined: Fri Jul 03, 2015 8:29 am
Re: Setting Reminders
Yes, that is exactly what I want. I want it to send me a reminder for let's say every Monday and Thursday at 10pm to add my trace elements and every Wednesday at 8pm to do a water change. I would also like it to send a monthly reminder to change my filter pads.
Sent from my SAMSUNG-SM-G900A using Tapatalk
Sent from my SAMSUNG-SM-G900A using Tapatalk
Re: Setting Reminders
Here's a rough outline that is started for you. I added some comments to the functions but they are pretty straight forward. You may have to tweak the WifiAlert function call....I'm just not 100% on the exact syntax of it, but I think I have it correct.fishflipper wrote:Yes, that is exactly what I want. I want it to send me a reminder for let's say every Monday and Thursday at 10pm to add my trace elements and every Wednesday at 8pm to do a water change. I would also like it to send a monthly reminder to change my filter pads.
Sent from my SAMSUNG-SM-G900A using Tapatalk
All you have to do is inside your loop, add the "checkReminders();" function call and that will handle the rest.
This also assumes you are using the Portal and having it updated. Otherwise, the WifiAlert class does not know how or where to send the reminder.
If you want to adjust the times, then you just need to modify the values in the functions. Everything is hard coded but could be changed to be stored in Internal Memory to allow for changing without re-uploading new code.
Anyways, hope this helps.
Code: Select all
void checkReminders()
{
// grab the current time and use it for processing the reminders
// do it this way to prevent rollover errors...just in case
time_t t = now();
remindTraceElements(t);
remindWaterChange(t);
remindMonthly(t);
}
void remindTraceElements(time_t t)
{
// Sunday = 1, Monday = 2, etc
if ((weekday(t) == 2) || (weekday(t) == 5)) {
// Every monday and thursday at 10pm
if ((hour(t) == 22) && (minute(t) == 0) && (second(t) == 0)) {
// send reminder, No Spaces Allowed in message
sendReminder("Add+Trace+Elements");
}
}
}
void remindWaterChange(time_t t)
{
if (weekday() == 4) {
// Every wednesday at 8pm
if ((hour(t) == 20) && (minute(t) == 0) && (second(t) == 0)) {
// send reminder, No Spaces Allowed in message
sendReminder("Water+Change+Time");
}
}
}
void remindMonthly(time_t t)
{
// Every 1st of the month at 8pm
if (day(t) == 1) {
if ((hour(t) == 20) && (minute(t) == 0) && (second(t) == 0)) {
// send reminder, No Spaces Allowed in message
sendReminder("Change+filter+pads");
}
}
}
void sendReminder(char* msg)
{
static WifiAlert r;
// No delay, for immediate sending
r.SetDelay(0);
// No spaces are allowed in the msg
r.Send(msg);
}
-
- Posts: 103
- Joined: Fri Jul 03, 2015 8:29 am
Re: Setting Reminders
This is awesome! Looks pretty straight forward too. I am leaving for vacation and won't be back for a week but will upload it as soon as I do. Thanks so much for this!
Sent from my SAMSUNG-SM-G900A using Tapatalk
Sent from my SAMSUNG-SM-G900A using Tapatalk
Setting Reminders
Awesome work Curt, but there's a major flaw in your code that's easily fixable. Do NOT set the delay to 0. Especially as you wrote the code only using seconds which could cause that function to be called quite a few times during that second. The default delay for the WiFiAlert is 15 minutes to prevent spamming yourself. I would just remove the delay and send the message and it will only get sent once. I guess delay is misleading but its delay between sends. It will always send the first time. The other problem is that since you have three different messages i would have 3 different WiFiAlerts declared and they are at the same time then you may want the delay 0 but then you'd have to track if you sent yourself with a static boolean. You could also Set the delay to one minute and offset each reminder. Sorry if Im throwing you off...
Re: Setting Reminders
makes sense.lnevo wrote:Awesome work Curt, but there's a major flaw in your code that's easily fixable. Do NOT set the delay to 0. Especially as you wrote the code only using seconds which could cause that function to be called quite a few times during that second. The default delay for the WiFiAlert is 15 minutes to prevent spamming yourself. I would just remove the delay and send the message and it will only get sent once. I guess delay is misleading but its delay between sends. It will always send the first time. The other problem is that since you have three different messages i would have 3 different WiFiAlerts declared and they are at the same time then you may want the delay 0 but then you'd have to track if you sent yourself with a static boolean. You could also Set the delay to one minute and offset each reminder. Sorry if Im throwing you off...
the wifi alerts should never be sent out at the same time because the time for notification is always different (the exception is the monthly alert which could happen at the same time but then the time could be offset).
I suppose the best option would be to just remove the delay like you suggested.
thanks for the feedback. I did come up with this code in about 10 minutes this morning while working on some other stuff... I figured it would need a refinement.
Sent from my Moto X
Re: Setting Reminders
Plus you haven't used wifialert much so it's all good. I figured the chances were low but just wanted to point out the possibility
Re: Setting Reminders
Yeah, I wasn't sure about how it works exactly. I didn't realize those possibilities. Thanks again for feedback.lnevo wrote:Plus you haven't used wifialert much so it's all good. I figured the chances were low but just wanted to point out the possibility
Sent from my Moto X
-
- Posts: 103
- Joined: Fri Jul 03, 2015 8:29 am
Re: Setting Reminders
Thank you both for this!
Just so I'm clear, these alerts are going to alert me through the app? Right? Is there a way to do text messages?
Sent from my SAMSUNG-SM-G900A using Tapatalk
Just so I'm clear, these alerts are going to alert me through the app? Right? Is there a way to do text messages?
Sent from my SAMSUNG-SM-G900A using Tapatalk
Re: Setting Reminders
no. they will be sent through the portal not the app. you will also need the portal(...) line added to your code. then from the portal, you will enter your email address and you can get email messages with these alerts (some carriers have a special email address that sends you a txt message to your phone).fishflipper wrote:Thank you both for this!
Just so I'm clear, these alerts are going to alert me through the app? Right? Is there a way to do text messages?
Sent from my SAMSUNG-SM-G900A using Tapatalk
there is really not a way to do this from the phone except for adding in manual alarms...so that defeats the point of the controller sending the reminders.
Sent from my iPad mini
Re: Setting Reminders
Here are the formats for most of the US services. 《number》is your 10 digit phone number.
AT&T: number@txt.att.net
T-Mobile: number@tmomail.net
Verizon: number@vtext.com
Sprint: number@messaging.sprintpcs.com or number@pm.sprint.com
Virgin Mobile: number@vmobl.com
Tracfone: number@mmst5.tracfone.com
Metro PCS: number@mymetropcs.com
Boost Mobile: number@myboostmobile.com
Cricket: number@sms.mycricket.com
Nextel: number@messaging.nextel.com
Alltel: number@message.alltel.com
Ptel: number@ptel.com
Suncom: number@tms.suncom.com
Qwest: number@qwestmp.com
U.S. Cellular: number@email.uscc.net
AT&T: number@txt.att.net
T-Mobile: number@tmomail.net
Verizon: number@vtext.com
Sprint: number@messaging.sprintpcs.com or number@pm.sprint.com
Virgin Mobile: number@vmobl.com
Tracfone: number@mmst5.tracfone.com
Metro PCS: number@mymetropcs.com
Boost Mobile: number@myboostmobile.com
Cricket: number@sms.mycricket.com
Nextel: number@messaging.nextel.com
Alltel: number@message.alltel.com
Ptel: number@ptel.com
Suncom: number@tms.suncom.com
Qwest: number@qwestmp.com
U.S. Cellular: number@email.uscc.net
-
- Posts: 103
- Joined: Fri Jul 03, 2015 8:29 am
Re: Setting Reminders
Thanks, I would rather have text messages. I didn't think there was a way to do it.
Sent from my SAMSUNG-SM-G900A using Tapatalk
Sent from my SAMSUNG-SM-G900A using Tapatalk
Re: Setting Reminders
awesome. great list. I knew they existed but didn't know them.
Sent from my Moto X
Sent from my Moto X
Re: Setting Reminders
Hi there
Has anyone got this code up and running, working?. I'm having troubles in trying to get the code to compile.
Has anyone got this code up and running, working?. I'm having troubles in trying to get the code to compile.
Re: Setting Reminders
Hi Inevo
Thanks for your response.
I think my problem is where in my code to add "checkReminders(); in my main loop and also were to add the function.
My code is all from the wizard. except where I tried to add the reminders. I'm a total noob when it comes down to coding. I do have the wifi module , and reef angel plus.
and then the errors
sketch_aug03a.cpp: In function 'void loop()':
sketch_aug03a:86: error: 'checkReminders' was not declared in this scope
sketch_aug03a:91: error: a function-definition is not allowed here before '{' token
sketch_aug03a:101: error: a function-definition is not allowed here before '{' token
sketch_aug03a:145: error: expected `}' at end of input
Thanks for your response.
I think my problem is where in my code to add "checkReminders(); in my main loop and also were to add the function.
My code is all from the wizard. except where I tried to add the reminders. I'm a total noob when it comes down to coding. I do have the wifi module , and reef angel plus.
Code: Select all
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port2Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.Relay.DelayedOn( Port1 );
ReefAngel.Relay.DelayedOn( Port2 );
ReefAngel.StandardHeater( Port3 );
ReefAngel.StandardHeater( Port4 );
ReefAngel.ActinicLights( Port5 );
ReefAngel.DayLights( Port6 );
ReefAngel.MoonLights( Port7 );
ReefAngel.PWM.SetDaylight( MoonPhase() );
ReefAngel.PWM.SetActinic( MoonPhase() );
ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.DaylightChannel = AntiSync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
////// Place your custom code below here
checkReminders();
////// Place your custom code above here
void checkReminders()
{
// grab the current time and use it for processing the reminders
// do it this way to prevent rollover errors...just in case
time_t t = now();
remindTraceElements(t);
remindWaterChange(t);
remindMonthly(t);
}
void remindTraceElements(time_t t)
{
// Sunday = 1, Monday = 2, etc
if ((weekday(t) == 2) || (weekday(t) == 5)) {
// Every monday and thursday at 10pm
if ((hour(t) == 22) && (minute(t) == 0) && (second(t) == 0)) {
// send reminder, No Spaces Allowed in message
sendReminder("Add+Trace+Elements");
}
}
}
void remindWaterChange(time_t t)
{
if (weekday() == 4) {
// Every wednesday at 8pm
if ((hour(t) == 20) && (minute(t) == 0) && (second(t) == 0)) {
// send reminder, No Spaces Allowed in message
sendReminder("Water+Change+Time");
}
}
}
void remindMonthly(time_t t)
{
// Every 1st of the month at 8pm
if (day(t) == 1) {
if ((hour(t) == 20) && (minute(t) == 0) && (second(t) == 0)) {
// send reminder, No Spaces Allowed in message
sendReminder("Change+filter+pads");
}
}
}
void sendReminder(char* msg)
{
static WifiAlert r;
// No delay, for immediate sending
r.SetDelay(0);
// No spaces are allowed in the msg
r.Send(msg);
}
// This should always be the last line
ReefAngel.Portal( "GreenVF" );
ReefAngel.ShowInterface();
}
and then the errors
sketch_aug03a.cpp: In function 'void loop()':
sketch_aug03a:86: error: 'checkReminders' was not declared in this scope
sketch_aug03a:91: error: a function-definition is not allowed here before '{' token
sketch_aug03a:101: error: a function-definition is not allowed here before '{' token
sketch_aug03a:145: error: expected `}' at end of input
- Attachments
-
- newsetup.ino
- not working code file
- (3.84 KiB) Downloaded 543 times
Re: Setting Reminders
Your code cuts off the closing of the file. You placed all of the code inside the loop when only checkReminders(); needed to be in there. Here's what it should look like:GreenVF wrote:Hi Inevo
Thanks for your response.
I think my problem is where in my code to add "checkReminders(); in my main loop and also were to add the function.
My code is all from the wizard. except where I tried to add the reminders. I'm a total noob when it comes down to coding. I do have the wifi module , and reef angel plus.
and then the errors
sketch_aug03a.cpp: In function 'void loop()':
sketch_aug03a:86: error: 'checkReminders' was not declared in this scope
sketch_aug03a:91: error: a function-definition is not allowed here before '{' token
sketch_aug03a:101: error: a function-definition is not allowed here before '{' token
sketch_aug03a:145: error: expected `}' at end of input
Code: Select all
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port2Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.Relay.DelayedOn( Port1 );
ReefAngel.Relay.DelayedOn( Port2 );
ReefAngel.StandardHeater( Port3 );
ReefAngel.StandardHeater( Port4 );
ReefAngel.ActinicLights( Port5 );
ReefAngel.DayLights( Port6 );
ReefAngel.MoonLights( Port7 );
ReefAngel.PWM.SetDaylight( MoonPhase() );
ReefAngel.PWM.SetActinic( MoonPhase() );
ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.DaylightChannel = AntiSync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
////// Place your custom code below here
checkReminders(); // functions are defined below
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "GreenVF" );
ReefAngel.ShowInterface();
}
// Reminder Code is listed below
void checkReminders()
{
// grab the current time and use it for processing the reminders
// do it this way to prevent rollover errors...just in case
time_t t = now();
remindTraceElements(t);
remindWaterChange(t);
remindMonthly(t);
}
void remindTraceElements(time_t t)
{
// Sunday = 1, Monday = 2, etc
if ((weekday(t) == 2) || (weekday(t) == 5)) {
// Every monday and thursday at 10pm
if ((hour(t) == 22) && (minute(t) == 0) && (second(t) == 0)) {
// send reminder, No Spaces Allowed in message
sendReminder("Add+Trace+Elements");
}
}
}
void remindWaterChange(time_t t)
{
if (weekday() == 4) {
// Every wednesday at 8pm
if ((hour(t) == 20) && (minute(t) == 0) && (second(t) == 0)) {
// send reminder, No Spaces Allowed in message
sendReminder("Water+Change+Time");
}
}
}
void remindMonthly(time_t t)
{
// Every 1st of the month at 8pm
if (day(t) == 1) {
if ((hour(t) == 20) && (minute(t) == 0) && (second(t) == 0)) {
// send reminder, No Spaces Allowed in message
sendReminder("Change+filter+pads");
}
}
}
void sendReminder(char* msg)
{
static WifiAlert r;
// No delay, for immediate sending
r.SetDelay(0);
// No spaces are allowed in the msg
r.Send(msg);
}
Re: Setting Reminders
Thank you Binder
Much appreciated. Got it now compiling. I also found a I had a few errors that I managed to sort out.
note to self. case sensitive and I had to include WifiAlert.h file
Here is the completed working code for now.
Much appreciated. Got it now compiling. I also found a I had a few errors that I managed to sort out.
note to self. case sensitive and I had to include WifiAlert.h file
Here is the completed working code for now.
- Attachments
-
- newsetup.ino
- (3.94 KiB) Downloaded 593 times
Re: Setting Reminders
awesome. glad you got it compiling.
yeah, things are case sensitive.
Sent from my iPad mini
yeah, things are case sensitive.
Sent from my iPad mini