Page 1 of 2

Re: Alternate Portal

Posted: Fri Jul 11, 2014 7:10 am
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?

Re: Alternate Portal

Posted: Fri Jul 11, 2014 7:46 am
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.

Re: Alternate Portal

Posted: Fri Jul 11, 2014 8:37 am
by lnevo
I use mine exclusively. The code is posted. Its definitely not the cleanest but it works great!!!

Re: Alternate Portal

Posted: Fri Jul 11, 2014 9:55 am
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?

Re: Alternate Portal

Posted: Fri Jul 11, 2014 9:56 am
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

Re: Alternate Portal

Posted: Fri Jul 11, 2014 10:00 am
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

Re: Alternate Portal

Posted: Fri Jul 11, 2014 12:29 pm
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

Re: Alternate Portal

Posted: Fri Jul 11, 2014 1:44 pm
by lnevo
I think we can get json, I just don't remember how :)

Re: Alternate Portal

Posted: Fri Jul 11, 2014 3:11 pm
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

Re: Alternate Portal

Posted: Fri Jul 11, 2014 5:23 pm
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

Re: Alternate Portal

Posted: Fri Jul 11, 2014 7:30 pm
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?

Re: Alternate Portal

Posted: Sat Jul 12, 2014 1:54 pm
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

Re: Alternate Portal

Posted: Sat Jul 12, 2014 4:47 pm
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

Re: Alternate Portal

Posted: Sat Jul 12, 2014 8:12 pm
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.

Re: Alternate Portal

Posted: Sat Jul 12, 2014 8:15 pm
by lnevo
either, the controller is live, the db has things like labels and port names but is 5 minute data.

Re: Alternate Portal

Posted: Sat Jul 12, 2014 9:00 pm
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

Re: Alternate Portal

Posted: Sun Jul 13, 2014 5:11 am
by lnevo
I'm sure roberto can dump json for the labels

Re: Alternate Portal

Posted: Sat Aug 02, 2014 6:23 pm
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?

Re: Alternate Portal

Posted: Sat Aug 02, 2014 6:32 pm
by rimai
send the get a dump
I think something got messed up when you did the reset.

Re: Alternate Portal

Posted: Sat Aug 02, 2014 6:49 pm
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> 

Re: Alternate Portal

Posted: Sun Aug 03, 2014 8:50 am
by rimai
And you said that it does the same thing when using an internal ip as well?
I just want to eliminate the loopback issue.
Did you try sniffing the network traffic to see if the server is getting any connection at all, even if it is broken?

Re: Alternate Portal

Posted: Sun Aug 03, 2014 9:49 am
by binder
rimai wrote:And you said that it does the same thing when using an internal ip as well?
I just want to eliminate the loopback issue.
Did you try sniffing the network traffic to see if the server is getting any connection at all, even if it is broken?
Correct. internal and external ip yields same result. not a loopback issue. my router handles the loopback appropriately.

no, i have not sniffed any network traffic yet. that will be the next step. i was also going to try to use the wifi utility to reprogram my wifi module thinking that may help. i will see what i come up with today.

Re: Alternate Portal

Posted: Sun Aug 03, 2014 1:01 pm
by binder
I figured out my problem and got things working. I used the wifi utility to program my module so I could see how the defaults were set. Turns out, I was only doing half of what I needed to do in regards to getting it to update. Now I haven't tested this more because it is working, but this is what I needed to do. I needed to change the host ip to my public ip and my host dns name to my public domain name.

Code: Select all

set ip host XXX.XXX.XXX.XXX
set dns name my.domain.name
I'm sure I could have set things to be based solely on my internal network but I opted to go this route. I will have to test more in the future. As soon as I plugged the module back into my controller and started viewing my webserver logs, I could see the requests and commands coming through just fine. So I know that works now and that I can receive the data from the controller. On to pulling the data from my database..... :ugeek:

Re: Alternate Portal

Posted: Sun Aug 03, 2014 7:31 pm
by binder
success!!!

i now have my own portal logging my data for me. i can receive the data from my controller and i can pull the data from it using my android app (i have it tweaked to work with my portal specifically though for testing).

i don't have anything being displayed on the webserver for my portal other than listing what devices are connected and giving a form to add a new device. this can be fixed in the future though.

the good news is everything works and can be deployed easily for people. so you could run your own custom portal/data logger on something like a raspberry pi (hence my internal name raPiPortal). i have to continue to tweak the main page and the settings and everything but it's looking pretty good and working fairly well for me so far. this could be great for those with multiple devices (like a fish shop or dealer or something) or someone who wants to keep all their data "in-house" and do other things with the data.

anyways, just thought i'd share my progress. :geek:

Re: Alternate Portal

Posted: Sun Aug 03, 2014 7:44 pm
by rimai
Awesome!!!

Re: Alternate Portal

Posted: Fri May 22, 2015 10:24 am
by joshlawless
Just wanted to stick my head in this and announce I'd be very interested in this feature, even if it required some legwork.

I'd be much more comfortable in the security of my tank if I could have the WiFi module communicating with a webserver on my LAN, behind my firewall, to avoid the port-forwarding and the reliance on basic HTTP auth to protect my tank from unauthorized tinkering.

If you were willing to share the changes you made to the libraries, the configuration you passed with the WiFi utility, and the code running on your webserver, I'd be very grateful.

Re: Alternate Portal

Posted: Fri May 22, 2015 7:33 pm
by binder
joshlawless wrote:Just wanted to stick my head in this and announce I'd be very interested in this feature, even if it required some legwork.

I'd be much more comfortable in the security of my tank if I could have the WiFi module communicating with a webserver on my LAN, behind my firewall, to avoid the port-forwarding and the reliance on basic HTTP auth to protect my tank from unauthorized tinkering.

If you were willing to share the changes you made to the libraries, the configuration you passed with the WiFi utility, and the code running on your webserver, I'd be very grateful.
sure thing.

i just pushed the webserver code to my github account:
https://github.com/curtbinder/rapiportal

i added comments to the README file on how to set it up. hopefully i got all the steps in there. i haven't really messed with this since last year. i was going on my comments and code.

this is just a bare basics start. my php skills are very limited. i also have not updated the database code to reflect the newer fields in the database.

also, i believe you need to create the "device" in the database first. the "device" is the name you use inside the Portal("username"); command. Typically that is your portal username but this custom portal will allow you to have multiple devices all sending data to it. so you can create your own names and such.

feel free to look around the code and test it out and all. i may add in more comments about setting it up and possibly fill in the missing database fields for it to handle....just depends on what all i have going on this weekend. if i get the backend working good, then the main thing would be to get a simple frontend created for displaying the data. i know it sends the data out just fine when queried because i had it working with my android app.

anyways, let me know if you have questions.

Re: Alternate Portal

Posted: Sat May 23, 2015 6:30 am
by Smotz
following..

Re: Alternate Portal

Posted: Mon May 07, 2018 10:16 am
by dlplunkett44
Is this ready to be used? I am getting a raspberry pi and would love to be able to log all of the data and make graphs over time.

Re: Alternate Portal

Posted: Mon May 07, 2018 7:18 pm
by binder
dlplunkett44 wrote:Is this ready to be used? I am getting a raspberry pi and would love to be able to log all of the data and make graphs over time.
I haven't worked on it in a while. it needs to be updated to handle the newer commands. It also does not have any specific interface for it. I didn't have a lot of time for it and there didn't seem to be a lot of interest in it either.
Do you have any coding experience? would you be able to help?

Sent from my XT1585 using Tapatalk