Page 1 of 1

ATO container low

Posted: Thu Jan 11, 2018 8:42 am
by Swampfox
What do i need to do to get notified (portal, text, email) when the water is low in my ATO container? I installed the float switch in the container, and plugged it into my controller. what is next? a code? thank you

Re: ATO container low

Posted: Thu Jan 11, 2018 10:37 am
by rimai
You can set alerts on the portal

Re: ATO container low

Posted: Thu Jan 11, 2018 11:03 am
by Swampfox
so there is no code that will need to be installed or anything? I already plugged it into the controller, now i just get it where i can get on the portal. I pushed down on the float sensor but I didn’t get any alarms.

Re: ATO container low

Posted: Thu Jan 11, 2018 6:08 pm
by Swampfox
Please what do I need to do?

Re: ATO container low

Posted: Thu Jan 11, 2018 7:27 pm
by binder
the alarm will only trigger when the portal gets updated. it can take up to 5 minutes. the controller only sends data to the portal every 5 minutes (hence why it can take up to 5 minutes). then when the controller processes the data and compares it to the alert rules you have set, it will send you an alert.
so that's why you don't get an alert when you push the float down. you also need to make sure you have your alert set properly (it needs to be something like AtoLow == 1).

Sent from my XT1585 using Tapatalk

Re: ATO container low

Posted: Thu Jan 11, 2018 8:10 pm
by Swampfox
Just put AtoLow ==1 in portal settings? Should the red light come on the controller when the level is low? Or just are the 5 mins it will send me an alert?

Re: ATO container low

Posted: Sat Jan 13, 2018 8:04 am
by binder
Swampfox wrote:Just put AtoLow ==1 in portal settings? Should the red light come on the controller when the level is low? Or just are the 5 mins it will send me an alert?
ok. so having the atolow line in the portal will trigger the alert once it is sent to the portal and processed.
there will be no light on the controller indicating anything since we have not coded that to happen. what we have discussed is simply allowing the portal to handle all the processing and alerts and the controller simply sends data to it.

Sent from my XT1585 using Tapatalk

Re: ATO container low

Posted: Sat Jan 13, 2018 8:26 am
by binder
To get the LED to be activated on the controller AND to have the ATO Alert flag triggered when the low ato port is activated, you will want to add this code to the loop() function of your code.

Code: Select all

/*
If the LowATO port ever gets activated, we will trigger an alert
  - Turn on the LED 
  - Set the ATO Alert Flag 

The ATO Ports are:
  - LowATO
  - HighATO
  
The alerts will ALWAYS be set until they are manually cleared. It does not 
matter what the float switch does. Once triggered, the alert stays until 
cleared.

To clear it, you must use the ATOClear function. ReefAngel.ATOClear()
You can clear it with the apps or via the Portal. 
*/
if ( ReefAngel.LowATO.IsActive() ) {
  ReefAngel.LED.On();
  bitSet(ReefAngel.AlertFlags,ATOTimeOutFlag)
}
The benefit from me setting the AlertFlag for the ATO Timeout, that will simplify the alerts. You could then allow the portal to check that the ATO Timeout is set. In my Android app, I display the alert flags and allow notifications to be set based on the alert flags if desired.

I have also added comments to the code above, so hopefully this makes sense and helps.

Re: ATO container low

Posted: Sun Jan 14, 2018 9:22 pm
by Swampfox
Thank you binder

Re: ATO container low

Posted: Mon Jan 15, 2018 7:11 pm
by Swampfox
Binder I tried to upload the code, but it is saying "firmware.ino:22:1: error: expected initializer before 'void'
void if (ReefAngel.LowATO.IsActive() ) {" It also had a error for no semi colon after the finial }, but I added it. I just don't know what to put in to fix there expected initializer.

Also what cause this when i try to upload to my controller?
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
Could not program the board

Re: ATO container low

Posted: Mon Jan 15, 2018 8:03 pm
by binder
Swampfox wrote:Binder I tried to upload the code, but it is saying "firmware.ino:22:1: error: expected initializer before 'void'
void if (ReefAngel.LowATO.IsActive() ) {" It also had a error for no semi colon after the finial }, but I added it. I just don't know what to put in to fix there expected initializer.

Also what cause this when i try to upload to my controller?
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
Could not program the board
My bad, I missed the semi-colon. Here's the code that compiles:

Code: Select all

    if(ReefAngel.LowATO.IsActive()) {
      ReefAngel.LED.On();
      bitSet(ReefAngel.AlertFlags, ATOTimeOutFlag);
    }
You don't need a void keyword at all. This code gets place inside the loop() function. So I don't know where or how you came across as putting it in. The only thing I can think of is if you put the code in the wrong spot and had it outside of the loop() function. Then arduino is going to treat it as a custom function (which it is not).
It needs to go after the "////// Place your custom code below here" line.

Code: Select all

void loop()
{
    // WM 1 / Left, 1 minute delay
    ReefAngel.Relay.DelayedOn( Port2, 1 );
    // WM 2 / Right, 1 minute delay
    ReefAngel.Relay.DelayedOn( Port6, 1 );
    ReefAngel.StandardHeater( Port3 );
    // Dimmable lights, ballasts plugged into relay
    ReefAngel.DayLights( Port7 );
    
    // Non-dimmable lights
    //   plugged into relay port along with fan power supply
    //   comes on 1 hour after daylights and
    //   shuts off 1 hour before daylights
    ReefAngel.StandardLights(Port8,
        InternalMemory.StdLightsOnHour_read()+1,
        InternalMemory.StdLightsOnMinute_read(),
        InternalMemory.StdLightsOffHour_read()-1,
        InternalMemory.StdLightsOffMinute_read());
        
    ReefAngel.PWM.DaylightPWMSlope();
    ReefAngel.PWM.ActinicPWMSlope();
    
    ////// Place your custom code below here


    //////////////  THIS CODE IS ADDED FOR THE ATO FUNCTIONALITY
    if(ReefAngel.LowATO.IsActive()) {
      ReefAngel.LED.On();
      bitSet(ReefAngel.AlertFlags, ATOTimeOutFlag);
    }

    ////// Place your custom code above here

    // This should always be the last line
    //ReefAngel.Portal( "binder" );
    ReefAngel.ShowInterface();
}
That is what the loop() should look like with the code added to it. This was an old revision of the code that I run on my controller (minus your ATO code).

As for the avrdude timeout, that can be various causes. Best suggestion is to keep the controller unplugged until you are certain you want to upload the code. Then plug it in. For whatever reason, arduino is timing out talking to the controller. It happens from time to time and I don't have a good reason why.

Re: ATO container low

Posted: Wed Jan 17, 2018 5:41 pm
by Swampfox
Thank you