How to use the trigger options in the Portal

Related to the Portal
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

How to use the trigger options in the Portal

Post by jsclownfish »

I'm really looking forward to adding a few more email alerts to my code. Some things look obvious, like temperature or pH, but how do you code alerts for the other options? Maybe a key as to what the codes in the drop down menu represent would help?

Thanks and great work!

-Jon
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to use the trigger options in the Portal

Post by rimai »

T1 - Temperature Probe 1
T2 - Temperature Probe 2
T3 - Temperature Probe 3
PH - pH
SAL - Salinity
ORP - ORP
ATOHIGH - Status of ATO High port
ATOLOW - Status of ATO Low port
PWMA - PWM % of Actinic Channel
PWMD - PWM % of Daylight Channel
R - Decimal number representing the Main Relay Box status
RON - Relay Mask On for Main Relay Box
ROFF - Relay Mask Off for Main Relay Box
R1 - Decimal number representing the Expansion Relay Box 1 status
RON1 - Relay Mask On for Expansion Relay Box 1
ROFF1 - Relay Mask On for Expansion Relay Box 1
R2 - Decimal number representing the Expansion Relay Box 2 status
RON2 - Relay Mask On for Expansion Relay Box 2
ROFF2 - Relay Mask On for Expansion Relay Box 2
R3 - Decimal number representing the Expansion Relay Box 3 status
RON3 - Relay Mask On for Expansion Relay Box 3
ROFF3 - Relay Mask On for Expansion Relay Box 3
R4 - Decimal number representing the Expansion Relay Box 4 status
RON4 - Relay Mask On for Expansion Relay Box 4
ROFF4 - Relay Mask On for Expansion Relay Box 4
R5 - Decimal number representing the Expansion Relay Box 5 status
RON5 - Relay Mask On for Expansion Relay Box 5
ROFF5 - Relay Mask On for Expansion Relay Box 5
R6 - Decimal number representing the Expansion Relay Box 6 status
RON6 - Relay Mask On for Expansion Relay Box 6
ROFF6 - Relay Mask On for Expansion Relay Box 6
R7 - Decimal number representing the Expansion Relay Box 7 status
RON7 - Relay Mask On for Expansion Relay Box 7
ROFF7 - Relay Mask On for Expansion Relay Box 7
R8 - Decimal number representing the Expansion Relay Box 8 status
RON8 - Relay Mask On for Expansion Relay Box 8
ROFF8 - Relay Mask On for Expansion Relay Box 8
PWME0 - PWM % of PWM Expansion Channel 0
PWME1 - PWM % of PWM Expansion Channel 1
PWME2 - PWM % of PWM Expansion Channel 2
PWME3 - PWM % of PWM Expansion Channel 3
PWME4 - PWM % of PWM Expansion Channel 4
PWME5 - PWM % of PWM Expansion Channel 5
AIW - Intensity % of Aqua Illumination White Channel
AIB - Intensity % of Aqua Illumination Blue Channel
AIRB - Intensity % of Aqua Illumination Royal Blue Channel
RFM - Vortech Mode
RFS - Vortech Speed
RFD - Vortech Duration
RFW - Intensity % of Radion white Channel
RFRB - Intensity % of Radion Royal BlueChannel
RFR - Intensity % of Radion Red Channel
RFG - Intensity % of Radion Green Channel
RFB - Intensity % of Radion Blue Channel
RFI - Intensity % of Radion Master Channel
IO - Decimal number representing the I/O Expansion status
C0 - Custom Field 0
C1 - Custom Field 1
C2 - Custom Field 2
C3 - Custom Field 3
C4 - Custom Field 4
C5 - Custom Field 5
C6 - Custom Field 6
C7 - Custom Field 7
PHE - pH Expansion
WL - Water Level
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to use the trigger options in the Portal

Post by rimai »

Custom fields have not been tested yet, nor have a place defined on the dashboard yet.
This is where you would be able to place customs numbers such as your flow and light meters :)
Roberto.
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Re: How to use the trigger options in the Portal

Post by jsclownfish »

Nice! :D

So to try this, should I just define a variable (ie. flow) as C1 and then ask for an email alert if C1=0 to tell me that the pump has stopped?

Code: Select all

int C1:
flow=C1;
Thanks,
Jon
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to use the trigger options in the Portal

Post by rimai »

Actually, I need to patch the Portal and get Curt to upate RAGen too in order to get the custom variables to work.
Roberto.
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Re: How to use the trigger options in the Portal

Post by jsclownfish »

Ok thanks! How does it know if the value is from say PWME0? Could I just fake it for now and give another variable the same name? Or should I just be patient? ;) :)
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to use the trigger options in the Portal

Post by rimai »

They are all working, with exception of the custom fields.
PWME0 is sent automatically when you enable PWM expansion.
In fact, everything is sent automatically when the feature is enabled :)
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to use the trigger options in the Portal

Post by rimai »

Ok, so I fixed the portal and you can now use the custom fields.
You need this on the features file:

Code: Select all

#define CUSTOM_VARIABLES
Because RAGen still doesn't have the option, you will need to manually add it until we get next update from Curt.
Then, on your code, you can use this:

Code: Select all

ReefAngel.CustomVar[0]=100;
You can replace the 0 with any number from 0 to 7.
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How to use the trigger options in the Portal

Post by binder »

Check off another item added to RAGen. A screenshot to preview...
Custom Variables
Custom Variables
Custom_Variables.png (21.12 KiB) Viewed 12083 times
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

there is a way to check if the Relay is set manually to on or off ? and not in auto ?

last summer i have a problem, someone in internet set my Fan relay to OFF :-(
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

T probe, the value is 251 or 25.1 or 25,1 °C ? :-D
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

The Portal say:

"Send email notifications:

For multiple email addresses, separate them with a comma. Only one email notification will be sent during one hour period. "

One email for every trigger ?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How to use the trigger options in the Portal

Post by binder »

lukeluke wrote:there is a way to check if the Relay is set manually to on or off ? and not in auto ?
It will show ON or OFF if it is manually set to one of those. If it is auto it will show AUTO.
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

binder wrote:
lukeluke wrote:there is a way to check if the Relay is set manually to on or off ? and not in auto ?
It will show ON or OFF if it is manually set to one of those. If it is auto it will show AUTO.
For make it , i use :

RON > 0 for check force ON state
ROFF < 255 for check force OFF state
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

how can i check the ATO or overheat alarms ?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How to use the trigger options in the Portal

Post by binder »

lukeluke wrote:how can i check the ATO or overheat alarms ?
You would have to monitor them separately. They would need to be handled in the custom variables.
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

ok...

i made it so:


void loop(){
ReefAngel.ShowInterface();
if ( InternalMemory.read(ATO_Single_Exceed_Flag) == 1 )
{
ReefAngel.CustomVar[0]=1;
}
else
{
ReefAngel.CustomVar[0]=0;
}
if ( InternalMemory.read(Overheat_Exceed_Flag) == 1 )
{
ReefAngel.CustomVar[1]=1;
}
else
{
ReefAngel.CustomVar[1]=0;
}

}


Right ?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to use the trigger options in the Portal

Post by rimai »

Hey Luca, I remember once a long time ago when you said you couldn't code....
Man, you the master of RA :)
Roberto.
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

I look at your script and replied :-P
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How to use the trigger options in the Portal

Post by binder »

Make sure you are putting the custom variable updating BEFORE the Portal() function. Otherwise the values will not be sent until the next time through.

Code: Select all

void loop()
{
  // modify custom variables

  ReefAngel.Portal("userid");
  ReefAngel.ShowInterface();
}
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

i don't use ReefAngel.Portal() is the server to get the value. i don't have space for send parameters... ;-)
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

work

<RA>
<T1>268</T1>
<T2>0</T2>
<T3>0</T3>
<PH>642</PH>
<R>11</R>
<RON>0</RON>
<ROFF>255</ROFF>
<ATOLOW>0</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>0</EM>
<REM>0</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>0</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

i put this trigger:

T1 <= 24 Temp too less
T1 >= 27.5 Temp too high
RON > 0 Relay force on
ROFF < 255 Relay force off
C0 = 1 ATO Alarm
C1 = 1 Overheat Alarm

;-)
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

i try the ATO Alarm , C0=1... but i see that the alarm don't arrive.

so i try to connect to wifi of the controller... but not work. /wifi or /r99 nothing ......

i restart my controller, but nothing the web server don't respond....

i try to clear the ato alarm and..... magically the web server work!

there is some bug to customs ?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How to use the trigger options in the Portal

Post by binder »

The alarm is only sent when the data is sent to the portal. If you are only sending the data every 3 minutes, then it can take up to 3 minutes for the alarm to be sent once it is triggered. Also, make sure you are setting the alarm / custom variable BEFORE the call to Portal() (or webbanner()). Otherwise, the value will not be sent until the next time it is sent (which could be another 3 minutes later).
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

the problem is not the alarm...but the internal web server of the RA.

When the ato alarm is on and the c0=1 the internal web server of the RA don't work.

when i write on my browser ip:2000/wifi o /r99 it not answer
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to use the trigger options in the Portal

Post by rimai »

I'll have to check on that.
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to use the trigger options in the Portal

Post by rimai »

This is the code I use to test:

Code: Select all

#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <ReefAngel.h>

void setup()
{
  ReefAngel.Init();  
}

void loop()
{
  ReefAngel.SingleATO(true,Port1,4,1);

  if ( InternalMemory.read(ATO_Single_Exceed_Flag) == 1 )
  {
    ReefAngel.CustomVar[0]=1;
  }
  else
  {
    ReefAngel.CustomVar[0]=0;
  }

  ReefAngel.ShowInterface();
}

With this features:

Code: Select all

#ifndef __REEFANGEL_FEATURES_H__
#define __REEFANGEL_FEATURES_H__


#define DisplayLEDPWM
#define wifi
#define SIMPLE_MENU
#define ENABLE_EXCEED_FLAGS
#define CUSTOM_VARIABLES


#endif  // __REEFANGEL_FEATURES_H__
When I pull the data without timeout, I get this:

Code: Select all

HTTP/1.1 200 OK
Server: ReefAngel
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Connection: close
Content-Type: text/xml
Content-Length: 257

<RA><T1>0</T1><T2>0</T2><T3>0</T3><PH>505</PH><R>0</R><RON>0</RON><ROFF>255</ROFF><ATOLOW>0</ATOLOW><ATOHIGH>0</ATOHIGH><EM>0</EM><REM>0</REM><PWMA>20</PWMA><PWMD>20</PWMD><C0>0</C0><C1>0</C1><C2>0</C2><C3>0</C3><C4>0</C4><C5>0</C5><C6>0</C6><C7>0</C7></RA>
When I pull data with the timeout, I get this:

Code: Select all

HTTP/1.1 200 OK
Server: ReefAngel
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Connection: close
Content-Type: text/xml
Content-Length: 257

<RA><T1>0</T1><T2>0</T2><T3>0</T3><PH>504</PH><R>0</R><RON>0</RON><ROFF>255</ROFF><ATOLOW>0</ATOLOW><ATOHIGH>0</ATOHIGH><EM>0</EM><REM>0</REM><PWMA>20</PWMA><PWMD>20</PWMD><C0>1</C0><C1>0</C1><C2>0</C2><C3>0</C3><C4>0</C4><C5>0</C5><C6>0</C6><C7>0</C7></RA>
I could not get the same behavior you experienced.
Can you post your code and features?
Roberto.
lukeluke
Posts: 88
Joined: Mon Apr 04, 2011 4:12 am
Location: Rome, Italy

Re: How to use the trigger options in the Portal

Post by lukeluke »

this is my pde
// Autogenerated file by RAGen (v1.2.1.158), (02/21/2012 19:09)
// RA_022112_1909.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File:
#define DisplayLEDPWM
#define wifi
#define WDT
#define SIMPLE_MENU
#define CUSTOM_MAIN
#define ENABLE_ATO_LOGGING
#define ENABLE_EXCEED_FLAGS
#define CUSTOM_VARIABLES
*/


#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 <ReefAngel.h>

int DP3_Timer = InternalMemory.DP1Timer_read() * 4;

void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 10, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 10, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
byte x = 8;
byte y = 45;
char text[7];
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x, y, "DP1:");
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+25, y, InternalMemory.DP1Timer_read());
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+37, y, "DP2:");
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+62, y, InternalMemory.DP2Timer_read());
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+75, y, "DP3:");
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+101, y, DP3_Timer);
x = 6;
y += MENU_START_ROW+6;
y -= 3;
ReefAngel.LCD.Clear(COLOR_BLACK, x, y, 124, y);
y +=1;
ReefAngel.LCD.Clear(COLOR_BLUE, x+1, y, 123, y+10);
y +=11;
ReefAngel.LCD.Clear(COLOR_BLACK, x, y, 124, y);
ReefAngel.LCD.Clear(COLOR_BLACK, x, y-11, x, y+16);
ReefAngel.LCD.Clear(COLOR_BLACK, 124, y-11, 124, y+16);
ReefAngel.LCD.DrawText(COLOR_WHITE, COLOR_BLUE, x+40, y-9, "Alarms");
y += 6;
x += 2;
byte fcolor;
// This is for the LOW Ato switch
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+2, y,"ATO:");
if ( InternalMemory.read(ATO_Single_Exceed_Flag) == 1 )
{
// add in InternalMemory.write(700, 1) when ato is tripped
// add in InternalMemory.write(700, 0) when ato is cleared
fcolor = COLOR_RED;
ReefAngel.LCD.DrawText(fcolor, DefaultBGColor, x+30, y, "YES");
}
else
{
fcolor = COLOR_GREEN;
ReefAngel.LCD.DrawText(fcolor, DefaultBGColor, x+30, y, "NO ");
}
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, x+55, y,"OverH:");
if ( InternalMemory.read(Overheat_Exceed_Flag) == 1 )
{
// add in InternalMemory.write(701, 1) when overheat is tripped
// add in InternalMemory.write(701, 0) when overheat is cleared
fcolor = COLOR_RED;
strcpy(text, "YES");
}
else
{
fcolor = COLOR_GREEN;
strcpy(text, "NO ");
}
ReefAngel.LCD.DrawText(fcolor, DefaultBGColor, x+94, y, text);
ReefAngel.LCD.Clear(COLOR_BLACK, x-2, y+11, 124, y+11);
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 95, TempRelay);
}

void DrawCustomGraph()
{
// ReefAngel.LCD.DrawGraph(5, 5);
}


void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.SetTemperatureUnit(1); // set to Celsius Temperature
ReefAngel.PWM.SetActinic(0);
ReefAngel.PWM.SetDaylight(0);
int DP3_Timer = InternalMemory.DP1Timer_read() * 4;

}

void loop()
{
// Specific functions
ReefAngel.StandardFan(Port1);
ReefAngel.MHLights(Port2);
// ReefAngel.DosingPump1(Port3);
//ReefAngel.DosingPumpRepeat(Port3, 0, 360, InternalMemory.DP1Timer_read());
ReefAngel.Relay.DelayedOn(Port4, 5);
// ReefAngel.DosingPump2(Port5);
//ReefAngel.DosingPumpRepeat(Port5, 10, 360, InternalMemory.DP2Timer_read());
ReefAngel.SingleATOHigh(Port6);
ReefAngel.StandardHeater(Port8);

ReefAngel.DosingPump(Port3, 1, 23, 20, InternalMemory.DP1Timer_read());
ReefAngel.DosingPump(Port3, 1, 05, 00, InternalMemory.DP1Timer_read());
ReefAngel.DosingPump(Port3, 1, 11, 00, InternalMemory.DP1Timer_read());
ReefAngel.DosingPump(Port3, 1, 17, 00, InternalMemory.DP1Timer_read());

ReefAngel.DosingPump(Port5, 2, 23, 30, InternalMemory.DP2Timer_read());
ReefAngel.DosingPump(Port5, 2, 05, 10, InternalMemory.DP2Timer_read());
ReefAngel.DosingPump(Port5, 2, 11, 10, InternalMemory.DP2Timer_read());
ReefAngel.DosingPump(Port5, 2, 17, 10, InternalMemory.DP2Timer_read());

// ReefAngel.DosingPump(Port7, 23, 20, DP3_Timer); // Setup Dosing Pump 3 Oligo

ReefAngel.ShowInterface();
if ( InternalMemory.read(ATO_Single_Exceed_Flag) == 1 )
{
ReefAngel.CustomVar[0]=1;
}
else
{
ReefAngel.CustomVar[0]=0;
}
if ( InternalMemory.read(Overheat_Exceed_Flag) == 1 )
{
ReefAngel.CustomVar[1]=1;
}
else
{
ReefAngel.CustomVar[1]=0;
}

}
with the new version the dosingpump repeat don't work.... or i' m not able.... :-D

if you want, this evening i retry it ;-)
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to use the trigger options in the Portal

Post by rimai »

Did you download 0.9.2 for the dosing pump fix?
I'll look over your code to see what I get.
Roberto.
Post Reply