Adding ATO to developmental PDE
-
- Posts: 99
- Joined: Fri Apr 01, 2011 10:53 am
Re: Adding ATO to developmental PDE
Definitly looking forward to those additions Curt!
Re: Adding ATO to developmental PDE
With this code, if we trigger the alert by passing true to the isalert parameter, do we have to pass in false to clear the alert? It appears that we have to based on your code, but I wanted to be certain.
curt
curt
Re: Adding ATO to developmental PDE
Hey guys.
I'm trying to implement messagin from controller via email using wifi module.
I can't tell it dows not work, but in some cases i'm not getting email whenI should.
I have LowATO set to turn pump on and off.
HightATO suppose to tell me when water level in fresh container is low. I used code from this thread. For some reason I'm not getting email every time I trigger HightATO.
Also, my wifi module flashes 3 yellow lights for some time (like 10-30 seconds) accasionally.
I'm not sure yet, but looks like this triggered by me setting alert from ATO, but I'm not sure as it also starts by itself.
Did anyone have somilar issue?
Thanks.
I'm trying to implement messagin from controller via email using wifi module.
I can't tell it dows not work, but in some cases i'm not getting email whenI should.
I have LowATO set to turn pump on and off.
HightATO suppose to tell me when water level in fresh container is low. I used code from this thread. For some reason I'm not getting email every time I trigger HightATO.
Also, my wifi module flashes 3 yellow lights for some time (like 10-30 seconds) accasionally.
I'm not sure yet, but looks like this triggered by me setting alert from ATO, but I'm not sure as it also starts by itself.
Did anyone have somilar issue?
Thanks.
Re: Adding ATO to developmental PDE
Sure. Sorry I did not do it before:
Code:
ReadAngel_Features.h
Code:
Code: Select all
// RAMenus.pde
//
// This version designed for v0.8.5 Beta 10 and later
#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>
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=serhiyi@gmail.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));
}
}
}
void ConvertNumToString(char* string, int num, byte decimal)
{
char temptxt[3];
int Temp = num;
if (Temp==0xFFFF) Temp=0;
itoa(Temp/decimal,string,10);
if (decimal>1)
{
itoa(Temp%decimal,temptxt,10);
strcat(string, ".");
if (Temp%decimal<10 && decimal==100) strcat(string, "0");
strcat(string, temptxt);
}
}
void DrawCustomMain()
{
byte x = 6;
byte y = 2;
byte t;
char text[7];
ReefAngel.LCD.DrawDate(6, 2);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
pingSerial();
x = 4;
y += 12;
ReefAngel.LCD.DrawText(COLOR_BLACK, DefaultBGColor, x, y, "Temperature:");
y += 10;
ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
pingSerial();
ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
x = 76;
ReefAngel.LCD.DrawText(T2TempColor,DefaultBGColor,x,y,"LED");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp2, T2TempColor, x+28, y, 10);
ReefAngel.LCD.DrawText(T3TempColor,DefaultBGColor,x,y+9,"ROOM");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp3, T3TempColor, x+28, y+9, 10);
pingSerial();
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 42, 132, 42);
x = 4;
y = 45;
ReefAngel.LCD.DrawText(PHColor,DefaultBGColor,x,y,"pH");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.PH, PHColor, x+28, y, 100);
y = 55;
// ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x,y,"ATO");
// atoH = "Off";
// if (ReefAngel.HighATO.IsActive()) atoH = "On";
// atoL = "Off";
// if (ReefAngel.LowATO.IsActive()) atoL = "On";
// ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+28,y,"Hi "+atoH+" Low "+atoL);
x = 76;
y = 45;
ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,x,y,"DayL");
x=104;
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(),DPColor, x, y, 1);
t = intlength(ReefAngel.PWM.GetDaylightValue()) + 1;
t *= 5;
ReefAngel.LCD.DrawText(DPColor, DefaultBGColor, x+t, y, "%");
x = 76;
y = 55;
ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x,y,"ActL");
x=104;
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),APColor, x, y, 1);
t = intlength(ReefAngel.PWM.GetActinicValue()) + 1;
t *= 5;
ReefAngel.LCD.DrawText(APColor, DefaultBGColor, x+t, y, "%");
pingSerial();
x = 12;
y = 118;
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(x, y, TempRelay);
}
void DrawCustomGraph()
{
// ReefAngel.LCD.DrawGraph(5,50);
}
void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.SetTemperatureUnit(0);
ReefAngel.PWM.SetActinic(0);
ReefAngel.PWM.SetDaylight(0);
// Set the ports that get toggled on & off during the following modes
// To enable a port to be toggled, place a 1 in the appropriate position
// Uncomment and update as needed
// Port 87654321
ReefAngel.FeedingModePorts = B11110000;
ReefAngel.WaterChangePorts = B11110000;
ReefAngel.OverheatShutoffPorts = B01011100;
ReefAngel.LightsOnPorts = B00001110;
ReefAngel.Relay.On(Port7); // Return Pump
ReefAngel.Relay.On(Port8); // Skimmer
}
void loop()
{
ReefAngel.ShowInterface();
ReefAngel.Relay.On(Port7); // Return Pump
ReefAngel.Relay.On(Port8); // Skimmer
// Specific functions
ReefAngel.SingleATOLow(Port1);
if (ReefAngel.HighATO.IsActive()) { // Overwrite ATO OFF - no water fresh water
ReefAngel.Relay.Off(Port1);
if (ReefAngel.LowATO.IsActive()) { // ATO low and high ON - no water
ReefAngel.Relay.Off(Port7); // Return Pump OFF
ReefAngel.Relay.Off(Port8); // Skimmer OFF
}
}
ReefAngel.StandardFan(Port2);
ReefAngel.MHLights(Port3); // For LED Daylight
ReefAngel.StandardLights(Port4); // For LED Actinic
ReefAngel.Wavemaker1(Port5);
ReefAngel.Wavemaker1(Port6);
ReefAngel.PWM.SetActinic(PWMSlope(InternalMemory.StdLightsOnHour_read(),InternalMemory.StdLightsOnMinute_read(),InternalMemory.StdLightsOffHour_read(),InternalMemory.StdLightsOffMinute_read(),0,InternalMemory.LEDPWMActinic_read(),90,ReefAngel.PWM.GetActinicValue()));
ReefAngel.PWM.SetDaylight(PWMSlope(InternalMemory.MHOnHour_read(),InternalMemory.MHOnMinute_read(),InternalMemory.MHOffHour_read(),InternalMemory.MHOffMinute_read(),0,InternalMemory.LEDPWMDaylight_read(),60,ReefAngel.PWM.GetDaylightValue()));
if (ReefAngel.Params.Temp1<760 && ReefAngel.Params.Temp1>0) WifiSendAlert(3,true);
if (ReefAngel.Params.Temp1>770 && ReefAngel.Params.Temp1<1850) WifiSendAlert(3,false);
if(bitRead(ReefAngel.Relay.RelayData,Port1-1)==0 && ReefAngel.LowATO.IsTopping()) WifiSendAlert(1,true); else WifiSendAlert(1,false);
if (ReefAngel.HighATO.IsActive()) WifiSendAlert(7,true); else WifiSendAlert(7,false);
if (now()%3600==0) WifiSendAlert(0, false);
}
Code: Select all
#ifndef __REEFANGEL_FEATURES_H__
#define __REEFANGEL_FEATURES_H__
#define SIMPLE_MENU
#define DisplayLEDPWM
#define wifi
#define NUMBERS_16x16
#define CUSTOM_MAIN
#endif // __REEFANGEL_FEATURES_H__
Re: Adding ATO to developmental PDE
Everything seems correct.
Did you try leaving just the HighATO trigger?
Comment out the others and let me know if the emails still do not get sent.
Did you try leaving just the HighATO trigger?
Code: Select all
// if (ReefAngel.Params.Temp1<760 && ReefAngel.Params.Temp1>0) WifiSendAlert(3,true);
// if (ReefAngel.Params.Temp1>770 && ReefAngel.Params.Temp1<1850) WifiSendAlert(3,false);
// if(bitRead(ReefAngel.Relay.RelayData,Port1-1)==0 && ReefAngel.LowATO.IsTopping()) WifiSendAlert(1,true); else WifiSendAlert(1,false);
if (ReefAngel.HighATO.IsActive()) WifiSendAlert(7,true); else WifiSendAlert(7,false);
// if (now()%3600==0) WifiSendAlert(0, false);
Roberto.
Re: Adding ATO to developmental PDE
Something strange is going on with my setup.
Loaded code with email notification for ATOHight only:
if (ReefAngel.HighATO.IsActive()) WifiSendAlert(7,true); else WifiSendAlert(7,false);
I reset wifi and loaded everything fresh on it. I tested wifi by loading code and got temperature readings in terminal as I should.
Loaded my code to RA and connected wifi. Green and yellow led on wifi wew blinking for about 35 seconds.
After that I got slow blinking of green.
Triggered ATO and got green/yellow dancing for long time again, but I got email.
The wifi is going crazy with green and yellow lights, only stops for few seconds to blink just green.
Connected to RA via http://192.168.1.112:2000/wifi.
First I got "Unknown request", after refresh I got controller's page and lights on WiFi became normal (slow green with occational yellow).
Closed RA web page.
Triggered ATO High.
Yellow led blinked at trigger. For about 5 seconds looked normal and now it is green/yellow crazy dance again.
No email this time (I was able to get couple of emails before during many times of re-uploads and resets).
Looks like getting RA web page stops lights from going nuts, but I had to hit refresh several times.
Just in case, cleared ATO warnings on controller (red status led was not on, but tried anyway).
WiFi still looks good and internal pages lods quickly with no issues.
Triggered ATO again and wifi is going crazy again. But I know for sure that trying to get internal web page makes it "normal".
I'm totally lost. What can I check or do to make it work?
Looks like it only happens when email notification is triggered. I just loaded code with all notifications commented out and wifi looks normal.
Loaded code with email notification for ATOHight only:
if (ReefAngel.HighATO.IsActive()) WifiSendAlert(7,true); else WifiSendAlert(7,false);
I reset wifi and loaded everything fresh on it. I tested wifi by loading code and got temperature readings in terminal as I should.
Loaded my code to RA and connected wifi. Green and yellow led on wifi wew blinking for about 35 seconds.
After that I got slow blinking of green.
Triggered ATO and got green/yellow dancing for long time again, but I got email.
The wifi is going crazy with green and yellow lights, only stops for few seconds to blink just green.
Connected to RA via http://192.168.1.112:2000/wifi.
First I got "Unknown request", after refresh I got controller's page and lights on WiFi became normal (slow green with occational yellow).
Closed RA web page.
Triggered ATO High.
Yellow led blinked at trigger. For about 5 seconds looked normal and now it is green/yellow crazy dance again.
No email this time (I was able to get couple of emails before during many times of re-uploads and resets).
Looks like getting RA web page stops lights from going nuts, but I had to hit refresh several times.
Just in case, cleared ATO warnings on controller (red status led was not on, but tried anyway).
WiFi still looks good and internal pages lods quickly with no issues.
Triggered ATO again and wifi is going crazy again. But I know for sure that trying to get internal web page makes it "normal".
I'm totally lost. What can I check or do to make it work?
Looks like it only happens when email notification is triggered. I just loaded code with all notifications commented out and wifi looks normal.
Re: Adding ATO to developmental PDE
This seems to be the same bug that was fixed on the last patch.
Are you using latest version?
Are you using latest version?
Roberto.
Re: Adding ATO to developmental PDE
I'm using v0.8.5.16 dev libraries.
Was fix there or in standard?
Thanks.
Was fix there or in standard?
Thanks.
Re: Adding ATO to developmental PDE
It was on dev libs, but I think it could be unreleased yet.
If you use the update utility, you will get the latest code even if it was not released.
http://forum.reefangel.com/viewtopic.php?f=8&t=2
Give it a shot.
I'll try it over here too.
If you use the update utility, you will get the latest code even if it was not released.
http://forum.reefangel.com/viewtopic.php?f=8&t=2
Give it a shot.
I'll try it over here too.
Roberto.
Re: Adding ATO to developmental PDE
Thank you. This is a very nice tool.
I reinstalled all libs from scratch.
Loaded code. It looks like wifi is not going crazy now.
Trying to figure out emails. I triggered ATO Hight several times with no email. Then I was playing with ATO Low for couple of seconds and triggered ATO High again. This time I got email.
Not sure if it was delay or somehting else. Will play with it a little more.
Thank you for your help.
I reinstalled all libs from scratch.
Loaded code. It looks like wifi is not going crazy now.
Trying to figure out emails. I triggered ATO Hight several times with no email. Then I was playing with ATO Low for couple of seconds and triggered ATO High again. This time I got email.
Not sure if it was delay or somehting else. Will play with it a little more.
Thank you for your help.
Re: Adding ATO to developmental PDE
Ok. Getting better but still can't figure out.
After new code using new libs installed I did not get email. I cleared ATO on controller.
Triggered ATO three times and got 2 emails.
Cleared ATO. Triggered ATO 3 times, got only one email.
Cleared ATO. Triggered ATO 4 times, only 3 emails.
To clarify, I checked email after each trigger and set new trigger only after getting email.
After writing this post I triggered ATO again and got email.
Looks like there is timeout somewhere that stops sending emails.
Just want to confirm if this is the case.
Thanks for your help, Roberto. It saved me a lot of hair
After new code using new libs installed I did not get email. I cleared ATO on controller.
Triggered ATO three times and got 2 emails.
Cleared ATO. Triggered ATO 3 times, got only one email.
Cleared ATO. Triggered ATO 4 times, only 3 emails.
To clarify, I checked email after each trigger and set new trigger only after getting email.
After writing this post I triggered ATO again and got email.
Looks like there is timeout somewhere that stops sending emails.
Just want to confirm if this is the case.
Thanks for your help, Roberto. It saved me a lot of hair