Alternate Portal

Related to the Portal
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Alternate Portal

Post by binder »

I don't think this topic has been mentioned or discussed much, but I've started working on an alternative to the reef angel portal. What I mean by that is simply a separate portal that the controller can send data to instead of reefangel.com.

I'm creating it using LASP (linux, apache, sqlite3, php) with the intent that it can be run from a raspberry pi or your own custom webserver. It should be able to run on just about any server as long as you can run PHP and Sqlite3 on the server. I could have chosen MySQL but I wanted to go with something lightweight and easily backed up. With sqlite3, it's a flat file to backup and everything is "saved". For those who don't know, sqlite3 is what Android uses for its databases.

There will be some configuration changes on the wifi device and inside the libraries in order for this to work properly. You have to tell the wifi module to use your own hostname and then update the libraries to reference the PHP scripts instead of the ASPX scripts. I'm planning on making this a "feature" that you can enable inside your INO file to turn on the PHP code requests instead of the ASPX requests. Then, like I said, the only thing left to do would be to configure the wifi module.

Currently, there is not a fancy frontend interface for it. It's rudimentary with the main functionality of allowing you to have your controllers update a local database server and allow you to have multiple controllers update the "portal" easily without having to have separate logins (like what is needed for the main portal).

It's still in its infancy. Once I get things working properly, maybe I can see if I can "borrow" lnevo's interface on his portal and create a nice installer script or package to download and unzip to be run. I am also going to add the ability for the Android App to connect to it as well.

I just wanted to put this out there to get feedback from people and see if there's much interest at all in this.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Alternate Portal

Post by rimai »

Cool!!
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Alternate Portal

Post by lnevo »

Very cool. Feel free to borrow..my code needs some work for sure :) i'll try and help any deciphering :) i need to fix the graphs on the desktop/tablet version badly
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Alternate Portal

Post by binder »

awesome. thanks.
yeah, my main goal, like I said, is to get it receiving data first. then adding an interface to it. so your code could get some work as well.
who knows, this could even turn into a potential "marketable" device being sold in the store....custom raspberry pi reef angel server. ;)
KRavEN
Posts: 104
Joined: Sun Mar 17, 2013 8:21 am

Re: Alternate Portal

Post by KRavEN »

I would be happy to help with this if you're wanting to collaborate. For the frontend I have a lot of experience with ExtJS (Sencha.com) javascript framework that can do some nice graphs and provides a really nice frontend experience. I also do a lot of work with symfony MVC framework using the propel ORM that supports most any database available including sqlite.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Alternate Portal

Post by binder »

KRavEN wrote:I would be happy to help with this if you're wanting to collaborate. For the frontend I have a lot of experience with ExtJS (Sencha.com) javascript framework that can do some nice graphs and provides a really nice frontend experience. I also do a lot of work with symfony MVC framework using the propel ORM that supports most any database available including sqlite.
great. I'm all for collaborating on making something like this. Let me get the backend working properly with receiving data and sending data to those that request it.

once i get that going, i'll be ready for collaboration with the frontend. it may take me several more days to a week or so before I have a good functioning backend (who knows for sure). it largely depends on my day job schedule.
:mrgreen:
KRavEN
Posts: 104
Joined: Sun Mar 17, 2013 8:21 am

Re: Alternate Portal

Post by KRavEN »

Sounds good. My day job is php and javascript so if you run into any problems feel free to hit me up.
egadgetjnr
Posts: 54
Joined: Wed Jul 18, 2012 1:32 pm

Re: Alternate Portal

Post by egadgetjnr »

This sounds amazing! :D
Feel free to give me a yell if you need any testing or what not. I work in IT so I can contribute something's (but nothing as complex as the above posters. :p)
I'm also fairly fluent in C# and I'm willing to learn new languages/things so feel free to let me help by doing tedious things if need be. :p
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Alternate Portal

Post by lnevo »

If the display ever became an android device would it be able to run on that? Just throwing that up in the air. Kraven have you looked at my code? I would love to get some bettet php/js eyes on it...that cared about RA..my brother has so much patience for my fish tank project..

It's a fully function site/html5 cached webapp...
KRavEN
Posts: 104
Joined: Sun Mar 17, 2013 8:21 am

Re: Alternate Portal

Post by KRavEN »

lnevo wrote:If the display ever became an android device would it be able to run on that? Just throwing that up in the air. Kraven have you looked at my code? I would love to get some bettet php/js eyes on it...that cared about RA..my brother has so much patience for my fish tank project..

It's a fully function site/html5 cached webapp...
Haven't looked yet but I will. :)

The other benefit of using ExtJS and sencha is that they also have Sencha Touch which is a cross platform API for phone interfaces. From what I've read it's not too difficult to take an ExtJS website and add Sencha Touch to it.
User avatar
chachew
Posts: 84
Joined: Sat Aug 04, 2012 11:52 pm
Location: Pearland, TX

Re: Alternate Portal

Post by chachew »

Any updates on this? I also know PHP and JS. I work for a technology company doing application QA, can i help with anything?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Alternate Portal

Post by binder »

chachew wrote:Any updates on this? I also know PHP and JS. I work for a technology company doing application QA, can i help with anything?
not much further updates on my end. depending on how involved you want to be will determine what all you want to work on. i know lnevo has a portal already working in terms that it displays the data. i know he updates it, but maybe more work could be done on that end to get and display the data.
i started working on a script to store the data in a database but do not remember how far i got. i know i have some basics but have not really tested sending data to my server.
so, it's up to you as to what you want to work on and contribute with. just let us know what you would be interested in helping with.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Alternate Portal

Post by lnevo »

I use mine exclusively. The code is posted. Its definitely not the cleanest but it works great!!!
User avatar
chachew
Posts: 84
Joined: Sat Aug 04, 2012 11:52 pm
Location: Pearland, TX

Re: Alternate Portal

Post by chachew »

binder wrote:
chachew wrote:Any updates on this? I also know PHP and JS. I work for a technology company doing application QA, can i help with anything?
not much further updates on my end. depending on how involved you want to be will determine what all you want to work on. i know lnevo has a portal already working in terms that it displays the data. i know he updates it, but maybe more work could be done on that end to get and display the data.
i started working on a script to store the data in a database but do not remember how far i got. i know i have some basics but have not really tested sending data to my server.
so, it's up to you as to what you want to work on and contribute with. just let us know what you would be interested in helping with.
I would like to look at it if you guys dont mind. Is there a downloadable copy somewhere?
User avatar
chachew
Posts: 84
Joined: Sat Aug 04, 2012 11:52 pm
Location: Pearland, TX

Re: Alternate Portal

Post by chachew »

lnevo wrote:I use mine exclusively. The code is posted. Its definitely not the cleanest but it works great!!!
lnevo, i ran across your thread and im going to check yours out as well. Thanks
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Alternate Portal

Post by rimai »

If you would like to look at our universal app and see why it doesn't work as standalone, it would be awesome too :)
http://forum.reefangel.com/viewtopic.php?f=8&t=4674
It's basically a HTML5 with jquerymobile interface. I have it working as an app for Android and iOS7, but I didn't have time to look at why it doesn't work as standalone.
Files are here: https://github.com/reefangel/U-App
Roberto.
User avatar
chachew
Posts: 84
Joined: Sat Aug 04, 2012 11:52 pm
Location: Pearland, TX

Re: Alternate Portal

Post by chachew »

rimai wrote:If you would like to look at our universal app and see why it doesn't work as standalone, it would be awesome too :)
http://forum.reefangel.com/viewtopic.php?f=8&t=4674
It's basically a HTML5 with jquerymobile interface. I have it working as an app for Android and iOS7, but I didn't have time to look at why it doesn't work as standalone.
Files are here: https://github.com/reefangel/U-App
Roberto, i see a few problems right off the bat here.

index.js
  • Line 31 - need ';' at the end of that line
  • Need to set the value for 'forum_username' in localStorage via localStorage.setItem("forum_username",$("#txt_controller_name").val());

    Currently 'forum_username' is never set when adding a new controller
When trying to get values from RA, you cannot get data from a cross domain source. You CAN get around this problem by using jsonp, BUT RA returns XML and not JSON. I guess you could convert XML to a JSON string. But i have not gone that far yet.

As far as i know this is NOT possible with XML cross domain calls. I think at this point their are 2 possible solutions.
1. Have the RA controller output a json string in addition to the XML data??
2. Use a 3rd party, YQL, to possible convert the data. https://developer.yahoo.com/yql/guide/u ... imits.html

Option 1 would be ideal
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Alternate Portal

Post by lnevo »

I think we can get json, I just don't remember how :)
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Alternate Portal

Post by binder »

yes we can get json data, check ra_wifi.cpp file and it will show you the data.


Sent from my iPad mini
89delta
Posts: 163
Joined: Mon Oct 15, 2012 7:21 pm
Location: Leesburg, GA

Re: Alternate Portal

Post by 89delta »

I've got a pi still sitting in the box meant for xbmc but if this can made to run my own RA server it'd be great especially with the U-app interface.

Sent from my SAMSUNG-SGH-I717 using Tapatalk
User avatar
chachew
Posts: 84
Joined: Sat Aug 04, 2012 11:52 pm
Location: Pearland, TX

Re: Alternate Portal

Post by chachew »

binder wrote:yes we can get json data, check ra_wifi.cpp file and it will show you the data.


Sent from my iPad mini
How am i getting this via locally hosted site?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Alternate Portal

Post by binder »

i dont follow. if you look in your libraries folder for the ra_wifi.cpp file, that will tell you the command you can issue to your controller to retrieve the json data for usage.


Sent from my iPad mini
User avatar
chachew
Posts: 84
Joined: Sat Aug 04, 2012 11:52 pm
Location: Pearland, TX

Re: Alternate Portal

Post by chachew »

binder wrote:i dont follow. if you look in your libraries folder for the ra_wifi.cpp file, that will tell you the command you can issue to your controller to retrieve the json data for usage.


Sent from my iPad mini
I see it now, i had to update my libraries first ;)

Thanks
User avatar
chachew
Posts: 84
Joined: Sat Aug 04, 2012 11:52 pm
Location: Pearland, TX

Re: Alternate Portal

Post by chachew »

So i have a question. Is the goal of the local www app to get controller data from the 'users' internal network or from the reef angel db? I havent downloaded the android app yet but was just wondering what the ultimate goal was for the www app.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Alternate Portal

Post by lnevo »

either, the controller is live, the db has things like labels and port names but is 5 minute data.
User avatar
chachew
Posts: 84
Joined: Sat Aug 04, 2012 11:52 pm
Location: Pearland, TX

Re: Alternate Portal

Post by chachew »

lnevo wrote:either, the controller is live, the db has things like labels and port names but is 5 minute data.
It just brings me back to the problem i stated above. There is NO WAY you can make a website perform XML cross-domain calls. JSON, yes. XML, nope

--EDIT--
OK after some code changes i DO have the 'Download Labels from Portal' function working. Now keep in mind this is using a YQL query that acts as a proxy. This is to get past the cross-domain issues that i have stated before. This will work for any scenario where the local app needs to talk to reefangel.com for downloading any type of XML data. As i have stated before the YQL calls have hourly/daily limits and COULD cause a problem if a user is over using the query via webpage updates.

If a anyone is interested to see just that part working let me know and i can upload a .zip with the few changes in it that i have made. :D
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Alternate Portal

Post by lnevo »

I'm sure roberto can dump json for the labels
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Alternate Portal

Post by binder »

i've been working on this portal today and now I'm running into some issues trying to send data from my controller. I've changed the libraries to reference my submit script (/ra/submitp.php?....). I've added in the ReefAngel.Portal() command to send the data. If I connect to the serial monitor, I see the data get sent.
My problem is I don't think my wifi module is configured correctly. I've talked with Roberto and he told me what he has set to work with the standard portal. I had to set the Host and Port to be the IP address of the server in use. I tried my internal network address and also my external network address but nothing.
I used the

Code: Select all

set ip host XXX.XXX.XXX.XXX
set ip remote 80
Do I need to change anything else from the wifi module?
Here's some output of the settings:

Code: Select all

<4.00> 
get w

SSID=BinderWifi
Chan=0
ExtAnt=0
Join=1
Auth=MIXED
Mask=0x1fff
Rate=12, 24 Mb
Linkmon-Infra=30
Linkmon-AP=3600
Passphrase=
EAP_Id=userid
EAP_User=peap-user

<4.00> 
get i

IF=UP
DHCP=CACHE
IP=10.0.42.41:2000
NM=255.255.255.0
GW=10.0.42.1
HOST=98.253.61.42:80
PROTO=TCP,
MTU=1524
FLAGS=0x7
TCPMODE=0x0
BACKUP=0.0.0.0
I was thinking that I may have to change some other settings, but I am not 100% positive. Anybody have some ideas? Or do I need to share more output from my wifi module?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Alternate Portal

Post by rimai »

send the get a dump
I think something got messed up when you did the reset.
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Alternate Portal

Post by binder »

rimai wrote:send the get a dump
I think something got messed up when you did the reset.
I think you are right. Here's the output:

Code: Select all

<4.00> 
get a

Beacon=102
Reboot=0
<4.00> 
get e

wifly-GSX Ver 4.00.1, Apr 19 2013 11:48:31 on 131C94
Beacon=102
Reboot=0
IF=UP
DHCP=CACHE
IP=10.0.42.41:2000
NM=255.255.255.0
GW=10.0.42.1
HOST=98.253.61.42:80
PROTO=TCP,
MTU=1524
FLAGS=0x7
TCPMODE=0x0
BACKUP=0.0.0.0
OPEN=
CLOSE=
REMOTE=
FlushSize=1024
MatchChar=0
FlushTimer=5
IdleTimer=3
CmdChar=$
DNS=10.0.42.1
Name=dns1
Backup=rn.microchip.com
Lease=86400
FTP=0.0.0.0:21
File=wifly-GSX.img
User=roving
Pass=Pass123
Dir=public
Timeout=200
FTP_mode=0x0
SSID=BinderWifi
Chan=0
ExtAnt=0
Join=1
Auth=MIXED
Mask=0x1fff
Rate=12, 24 Mb
Linkmon-Infra=30
Linkmon-AP=3600
Passphrase=
EAP_Id=userid
EAP_User=peap-user
SleepTmr=0
WakeTmr=0
Trigger=0x1
Autoconn=0
IoFunc=0x0
IoMask=0x20f0
IoValu=0x0
DebugReg=0x0
PrintLvl=0x0
LaunchStr=web_app
TimeEna=0
TIMEADR=64.90.182.55:123
Zone=7
Baudrate=57600
Flow=0x0
Mode=0x0
Cmd_GPIO=0
JoinTmr=1000
Replace=0x24
DeviceId=WiFly-GSX
Password=
Format=0x0
Signal=0
Average=5
BCAST=255.255.255.255:55555
Interval=0x7
Backup=0.0.0.0:0
Sensor=0x0
SensePwr=0x0
<4.00> 
Post Reply