Portal is not updating

Related to the Portal
Post Reply
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Portal is not updating

Post by ecam »

Guys. my portal has been acting up for a little over a month now. When I first opens up it shows the data for Mar 24. After a few mins it will update to current but on every refresh it will do the samething. B\c of this my android app goes haywire to the point that i cant use the phone App. Please help
I have attached the image below:
CaptureRA.JPG
CaptureRA.JPG (99.73 KiB) Viewed 8059 times
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Portal is not updating

Post by lnevo »

Looks like you are not sending data since march 24th then.

Did you change any code then? Can you post your current code that is loaded.
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Portal is not updating

Post by ecam »

Code: Select all

    #include <Salinity.h>
    #include <Relay.h>
    #include <RA_ATO.h>
    #include <RF.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 <PH.h>
    #include <WaterLevel.h>
    #include <ReefAngel.h>

    ////// Place global variable code below here
        byte myRFMode=0;
        byte myRFDuration=0;
        byte myRFSpeed=0;
    ////// Place global variable code above here

    void setup()
    {
        // This must be the first line
          ReefAngel.Init();  //Initialize controller

        // Ports toggled 
      ReefAngel.WaterChangePorts = Port3Bit | Port7Bit| Port8Bit| Box1_Port1| Box1_Port4| Box1_Port6; // Turn off Return, UV, Skimmer, Heater, Sump Equipment, ATO
      ReefAngel.FeedingModePorts = Port3Bit | Port8Bit; // Turn off Return and Skimmer
      ReefAngel.LightsOnPorts = Port2Bit | Box1_Port2;  //Turn on ATI lights, Fan and Fuge Light
      ReefAngel.OverheatShutoffPorts = Port4Bit |Box1_Port1; // ATI Lights and Heaters 
      ReefAngel.TempProbe = T3_PROBE;
        ReefAngel.OverheatProbe = T3_PROBE;
                InternalMemory.OverheatTemp_write( 825 );   // Set the Overheat temperature setting
          
        // Ports that are always on
        ////// Place additional initialization code below here
        ////// Place additional initialization code above here
    }

    void loop()
      {
           //Box1
           ReefAngel.Relay.Off(Port1);                        //  Port1 Acropower Dosing ... 
           ReefAngel.Relay.Off(Port2);                        //  Port2 Fuge Light
                    if (hour()>=23 && hour()<7) ReefAngel.Relay.On(Port2);     // Fuge Between 11pm-7am turn the relay on
           ReefAngel.Relay.On(Port3);                         //  Port3 Return Pump -- Always on
           ReefAngel.Relay.Off(Port4);                        //  Port4 Not Used 
           ReefAngel.Relay.Off(Port5);                        //  Port5 Not Used 
           ReefAngel.Relay.Off(Port6);                        //  Port6 Not Used 
           ReefAngel.Relay.On(Port7);                         //  Port7 UV Lamp -- Always on
           ReefAngel.Relay.DelayedOn( Port8,5 );              //  Port8 Skimmer -- 5 min delay start
         
          //box 2 (Box1_Portxx)

          ReefAngel.StandardHeater( Box1_Port1,778,790 );     //  Box1_Port1 Heater   
          ReefAngel.Relay.On(Box1_Port2);                     //  Box1_Port2 Razor_LED (Sump) -- Always on
          ReefAngel.Relay.Off(Box1_Port3);                    //  Box1_Port3 Not Used
          ReefAngel.Relay.On(Box1_Port4);                     //  Box1_Port4 Sump Equipment-- Always on
          ReefAngel.Relay.On(Box1_Port5);                     //  Box1_Port5 MP40s -- Always on
         // ReefAngel.Relay.Off(Box1_Port6);                  //  Box1_Port6 ATO Top off (RODI)
            ReefAngel.SingleATO(true,Box1_Port6,300,0); // ATO Low port with 60 seconds timeout
         // ReefAngel.SingleATOHigh(true,Box1_Port6,300,0);         // ATO Low port with 5 min timeout (200 mls per min, 3,785mls in a gallon)
          ReefAngel.Relay.Off( Box1_Port7);                   // Box1_Port7 ALK Doser 
          ReefAngel.Relay.Off( Box1_Port8);                   // Box1_Port8 Calc Doser 

                          // Old Code
                              //moonlight dimming
                                     //    if (hour()>=6 && hour()<10) ReefAngel.PWM.SetDaylight( PWMParabola(6,0,10,0,9,100,9) ); // Moonlight Between 5-10am turn the relay on
                                     //    if (hour()>=20 && hour()<=23) ReefAngel.PWM.SetDaylight( PWMParabola(20,0,23,0,100,0,100) ); // From 8pm-Midnight turn the relay on
                                     //    else ReefAngel.PWM.SetDaylight(0);
                                     //  ReefAngel.Relay.Set( Port2, !ReefAngel.Relay.Status( Port4 ) ); //Refuge opposite of Actinic
                                     //  ReefAngel.Relay.Off( Box1_Port3); // Start with the relay off       Port #11 Moonlight
                                        //if (hour()>=5 && hour()<10) ReefAngel.Relay.On(Box1_Port3); // Moonlight Between 5-10am turn the relay on  
                                        //if (hour()>=20 && hour()<=23) ReefAngel.Relay.On(Box1_Port3); // From 8pm-Midnight turn the relay 
                                     //    ReefAngel.PWM.SetDaylight( PWMSlope(20,0,23,0,100,0,180,100) );
                                     //   ReefAngel.PWM.SetDaylight( PWMSlope(6,0,10,0,9,100,240,9) );  
                                     //ReefAngel.Relay.off(Box1_Port3);
                                     //  if (hour()>=10 || hour()<20) ReefAngel.PWM.SetDaylight(0);
                                     //    ReefAngel.PWM.SetDaylight( MoonPhase()+10 );
                                    // ReefAngel.PWM.SetDaylight(PWMParabola(20,0,23,0,0, MoonPhase(),0 ));
                                    //ReefAngel.PWM.SetDaylight(PWMSlope(6,0,23,0,0,100,240,0));
                                    //if (hour()>=5 && hour()<20) ReefAngel.PWM.SetDaylight(0);
                                    //ReefAngel.PWM.SetDaylight( PWMParabola(20,0,23,0,100,0,100) );
                                    //ReefAngel.PWM.SetDaylight( PWMParabola(6,0,10,0,9,100,9) );

////// Place your custom code below here
       
       
          ReefAngel.RF.UseMemory = false;
          if (hour()>=6 && hour()<11)
            myRFSetMode(ReefCrest,85,10);
          else if (hour()>=11 && hour()<13)
            myRFSetMode(ReefCrest,85,10);
          else if (hour()>=13 && hour()<16)
            myRFSetMode(Smart_NTM,85,50);
          else if (hour()>=16 && hour()<19)
            myRFSetMode(ReefCrest,65,10);
          else
            myRFSetMode(Lagoon,40,10);
             
                    
        // Hardcode PH calibrations
         //ReefAngel.PHMin=544; // PH7.0
         //ReefAngel.PHMax=830; // PH10.0

         RunDosingPumps();
         LogDosingPumps();
        ////// Place your custom code above here

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

    void DrawCustomMain()
    {

        pingSerial();

        // Parameters
    #if defined DisplayLEDPWM && ! defined RemoveAllLights
        ReefAngel.LCD.DrawMonitor( 15, 48, ReefAngel.Params,
        ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
    #else // defined DisplayLEDPWM && ! defined RemoveAllLights
        ReefAngel.LCD.DrawMonitor( 15, 48, ReefAngel.Params );
    #endif // defined DisplayLEDPWM && ! defined RemoveAllLights
        pingSerial();
            char text[10];
              ConvertNumToString(text, ReefAngel.Params.Salinity, 10);
              strcat(text,"  ");
              ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,93,"Salinity:");
              ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,75,93,text);
              pingSerial();
 
   
         // Main Relay Box
        byte TempRelay = ReefAngel.Relay.RelayData;
        TempRelay &= ReefAngel.Relay.RelayMaskOff;
        TempRelay |= ReefAngel.Relay.RelayMaskOn;
        ReefAngel.LCD.DrawOutletBox( 12, 94, TempRelay );
        pingSerial();

        // Date and Time
        ReefAngel.LCD.DrawDate( 6, 122 );
        pingSerial();
    }

    /////////////////////////////////////////
    // Define Your dosing pumps
    /////////////////////////////////////////
    #define numDPumps 3
    byte pumpRelays[numDPumps]={ Box1_Port7, Box1_Port8,Port1Bit};
    int DPVolume[numDPumps]={ 17, 17, 7} ; // 1ml for each alk and calcium - total volume for the day
    int DPRepeat[numDPumps]={ 360, 360, 360 } ; // Repeat every 4 hrs 6x a day --- in mins
    /////////////////////////////////////////
    // Define Calibration here
    /////////////////////////////////////////
    int CalTime[numDPumps]={ 600, 600, 600 }; // 10 minutes / 10 minutes
    int CalVol[numDPumps]={ 350, 300,384 }; // 350ml / 300ml... .58 / .5/.64

    /////////////////////////////////////////
    // Function: RunDosingPumps()
    /////////////////////////////////////////
    void RunDosingPumps() {
      float rate;
      int calcTime[numDPumps];

      for (int i=0;i < numDPumps; i++) {
        rate=(float)CalVol[i]/CalTime[i];
        calcTime[i]=DPVolume[i]/rate/(1440/DPRepeat[i]);

        // Run the pumps
        ReefAngel.DosingPumpRepeat(pumpRelays[i], i*5, DPRepeat[i], calcTime[i]); // Offset between each pump is 5 minutes
      }

      // Display Time calculated in portal
      ReefAngel.CustomVar[0]=calcTime[0];
      ReefAngel.CustomVar[1]=calcTime[1];
      ReefAngel.CustomVar[2]=calcTime[2];
    }

    /////////////////////////////////////////
    // Function: LogDosingPumps()
    /////////////////////////////////////////
    void LogDosingPumps() {
      static time_t pumpTimer[numDPumps];
      static boolean pumpStatus[numDPumps];
      float rate;

      for (int i=0;i< numDPumps;i++) {
        if (ReefAngel.Relay.Status(pumpRelays[i])) {
          if (!pumpStatus[i]) {
            pumpTimer[i]=now()-pumpTimer[i]; // Pump was off, timer is now a time
            pumpStatus[i]=true;
          }
        } else {
          if (pumpStatus[i]) {
            pumpTimer[i]=now()-pumpTimer[i]; // Pump was on, timer is now a timer
            pumpStatus[i]=false;
       
            rate=(float)CalVol[i]/CalTime[i];

            // Report How much volume has been dosed per day.
            // Could make this in minutes... excercise for the reader..
            ReefAngel.CustomVar[3]=pumpTimer[0]*rate;
            ReefAngel.CustomVar[4]=pumpTimer[1]*rate; 
            ReefAngel.CustomVar[5]=pumpTimer[2]*rate; 
          }
       }
     
        // Clear timer at end of day
        if (now()%SECS_PER_DAY==SECS_PER_DAY-1) pumpTimer[i]=0;
      } 
    }


        void DrawCustomGraph()
        {
        }

        void myRFSetMode(byte m, byte s, byte d)
        {
          if (m!=myRFMode || s!=myRFSpeed || d!=myRFDuration || millis()<5000)
          {
            myRFMode=m;
            myRFSpeed=s;
            myRFDuration=d;
            ReefAngel.RF.SetMode(m,s,d);
          }
        }

ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Portal is not updating

Post by ecam »

Also Lee and roberto,

Can you tell me how this is possible based on my previously posted code that calls for 17 mls of dosing....
Attachments
Capture.PNG
Capture.PNG (9.26 KiB) Viewed 8023 times
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Portal is not updating

Post by lnevo »

We'll first off your pumpArray declaration is wrong. You need to use Port1 not Port1Bit...
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Portal is not updating

Post by ecam »

I fixed that. but what is overdosing is the Calc and Alk port7 and port 8
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Portal is not updating

Post by lnevo »

I'll look at it closer today..
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Portal is not updating

Post by ecam »

Thank you!!!

I just checked my portal and it looks like the Custom variables are not changing. By 9am. my volume should be the same as the time. However it is still showing 49 and 56. But the rest of the portal is updating just fine (i can toggle switches and graphs seem okay.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Portal is not updating

Post by lnevo »

Your RA is not sending data to the portal it sounds like, but port forwarding it working and your RA is responding on the network.

Did you reuse one of the built on timers anywhere?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Portal is not updating

Post by lnevo »

Yeah, your RA has not sent data to the portal since March still..

<MYREEFANGELID>ecam</MYREEFANGELID>
<LOGDATE>3/25/2014 3:40:53 AM</LOGDATE>

Either the outgoing data is blocked, you removed ReefAngel.Portal() from your code, or you re-used the portal timer for something else. Let me look through your code...
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Portal is not updating

Post by lnevo »

I don't see anything in the code that would block the portal updates.... but your definitely not sending... Did you set a portal key in the portal settings?
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Portal is not updating

Post by ecam »

But Lee,

If you wait about 2 mins. The page updates correctly and allow me to toggle switchs. However after every toggle it takes 2 mins as the date resets to the 3/25 and then resets to May 1.
[img]
Capture2.JPG
Capture2.JPG (94.18 KiB) Viewed 6720 times
[/img]
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Portal is not updating

Post by ecam »

lnevo wrote:I don't see anything in the code that would block the portal updates.... but your definitely not sending... Did you set a portal key in the portal settings?
No


[img]
Capture3.JPG
Capture3.JPG (25.2 KiB) Viewed 6718 times
[/img]
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Portal is not updating

Post by lnevo »

No, there is 2 sets of communication we are talking about...

1) Portal -> RA (happens when you log in and want to switch relays/update memory)
This is the one that requires port forwarding to get back inside your network.

2) RA -> Portal (happens every 5 minutes from the RA. Sends your parameters to the portal)
This is the data that is stored in the DB and shows up when you first log in.

You have #1 working. When you log into the portal it first shows data from #2 and then refreshes after you've loaded the page. This is why you see good data after waiting 2 minutes.

#1 is usually the hard one to setup since it requires port forwarding. For #2 the only other thing it could be is the IP address for the portal may have been screwed up. Did you change anything on your wifi module around that time? I'll let roberto chime in on what parameter it is your looking for. I think if you can get a "get e" on your wifi module it would help to determine if I'm on the right track.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal is not updating

Post by rimai »

Looks like to be the wifi attachment.
You will need to either get the dump from the wifi module with "get e" command or plug the usb-ttl cable and use the Serial Monitor on Arduino.
Roberto.
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Portal is not updating

Post by ecam »

Please explain?. Should I essentially uninstall and then re-install the wifi module?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Portal is not updating

Post by rimai »

Roberto.
ecam
Posts: 229
Joined: Thu Nov 15, 2012 11:27 am

Re: Portal is not updating

Post by ecam »

It worked guys. Thanks for all the help. I am now updating to the portal. I did the factory reset
Post Reply