Page 1 of 1

Email Alert

Posted: Sat Aug 01, 2015 2:18 am
by rsalomez
Hello,

How do I code an alert when there is a Leak?

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <PAR.h>
#include <ReefAngel.h>
#include <WiFiAlert.h>

////// Place global variable code below here
void emergencyLeak(char *message);
////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    InternalMemory.LCDID_write(255); //Old LCD
    //ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port3Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port2Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit;
    // Ports turned off when Leak is detected
    ReefAngel.LeakShutoffPorts = Port4Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 280 );


    // Ports that are always on
    ReefAngel.Relay.On( Port3 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port5 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );
    ReefAngel.Relay.On( Port8 );

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.StandardHeater( Port1,245,761 );
    ReefAngel.StandardFan( Port2,771,255 );
    ////// Place your custom code below here
    
    if (ReefAngel.IsLeakDetected())
    {
      emergencyLeak("Leak");
    } 
    
    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "rsalomez", "xxxxxxx" );
    ReefAngel.ShowInterface();
}

void emergencyLeak(char *message){

  static WiFiAlert t;
  t.SetDelay(0);
  t.Send(message);

  DISPLAYLOG=true;
  LOGMESSAGE = message;
}
I also tried with the portal setting but I've got no email :

Portal() function requires security key: ON
Portal() security key: xxxxxx
Send email notifications --> ON
Email address(es): my email

Code: Select all

Temperature 1 >= 28
Water Leak Flag = 1

Thanks for your help

Re: Email Alert

Posted: Mon Aug 31, 2015 6:18 am
by Xender
Hello,

No clue?

Thx

Re: Email Alert

Posted: Sat Sep 05, 2015 6:23 am
by lnevo
Should work...do regular portal alerts work?

Re: Email Alert

Posted: Sat Sep 05, 2015 7:58 am
by Xender
Yes temp alert are working but no leak alert

Re: Email Alert

Posted: Sat Sep 05, 2015 12:02 pm
by lnevo
Can you connect the RA and run Serial Monitor, trigger the alert and you should be able to capture the URL that gets called. Wondering if the key is an issue.