Email Alert

Do you have a question on how to do something.
Ask in here.
Post Reply
rsalomez
Posts: 1
Joined: Mon Mar 02, 2015 12:02 pm
Location: France

Email Alert

Post 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
User avatar
Xender
Posts: 105
Joined: Sun Mar 20, 2011 12:38 am
Location: France

Re: Email Alert

Post by Xender »

Hello,

No clue?

Thx
Fresh Water Aquarium 180*60*80
Salt Water Aquarium 60*60*60
Click Here to see the Video of my Fresh Water Aquarium
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Email Alert

Post by lnevo »

Should work...do regular portal alerts work?
User avatar
Xender
Posts: 105
Joined: Sun Mar 20, 2011 12:38 am
Location: France

Re: Email Alert

Post by Xender »

Yes temp alert are working but no leak alert
Fresh Water Aquarium 180*60*80
Salt Water Aquarium 60*60*60
Click Here to see the Video of my Fresh Water Aquarium
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Email Alert

Post 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.
Post Reply