Page 1 of 1
Custom Logging / Data Extraction
Posted: Sun Jun 05, 2016 6:52 am
by soyrex
Is there a way i can get access to the state of my relays and the values of my probes? Ie: if i wanted to build a web interface to display these? Ideally i would like a way that i can connect to the RA over a socket on my internal LAN to gather this data.. is this possible with my WIFI expansion?
Re: Custom Logging / Data Extraction
Posted: Sun Jun 05, 2016 7:48 am
by rimai
Re: Custom Logging / Data Extraction
Posted: Sun Jun 05, 2016 7:54 am
by lnevo
I've been pulling the stats from my ra every minute for a long time to feed a web page. I'm doing this now with mrtg
http://www.easte.net/mrtg
Re: Custom Logging / Data Extraction
Posted: Sun Jun 05, 2016 8:56 am
by soyrex
Roberto: Thanks. very helpful.
With the relay data in the XML output... how is the relay status encoded? (do you have docs anywhere or should I dig through the wifi cpp?).
Lee: nice... novel use of mrtg
.
Sent from my iPhone using Tapatalk
Re: Custom Logging / Data Extraction
Posted: Sun Jun 05, 2016 12:38 pm
by rimai
Relay status is a 8 bit representation of the 8 ports.
So, for example value 8 would be port 4 on, value 5 would be port 1 and 3 on.
Re: Custom Logging / Data Extraction
Posted: Sun Jun 05, 2016 4:19 pm
by lnevo
Code: Select all
function applyMasks($a,$b,$c) {
$a &= $c;
$a |= $b;
return str_pad(decbin($a),8,"0",STR_PAD_LEFT);
}
function getBin($a) {
return str_pad(decbin($a),8,"0",STR_PAD_LEFT);
}
Code: Select all
$R=$xml->{'R'};
$RBIN=getBin($R);
$RON=$xml->{'RON'};
$ROFF=$xml->{'ROFF'};
$RMASK=applyMasks($xml->{'R'},$xml->{'RON'},$xml->{'ROFF'});
$relay1val=$RBIN[7];
$relay2val=$RBIN[6];
$relay3val=$RBIN[5];
$relay4val=$RBIN[4];
$relay5val=$RBIN[3];
$relay6val=$RBIN[2];
$relay7val=$RBIN[1];
$relay8val=$RBIN[0];
$relay1status=$RMASK[7];
$relay2status=$RMASK[6];
$relay3status=$RMASK[5];
$relay4status=$RMASK[4];
$relay5status=$RMASK[3];
$relay6status=$RMASK[2];
$relay7status=$RMASK[1];
$relay8status=$RMASK[0];
Re: Custom Logging / Data Extraction
Posted: Mon Jun 13, 2016 7:28 am
by soyrex
thanks Roberto! i should have checked back here sooner. I reverse engineered the same answer from the JS code in the u-app.
Sent from my iPhone using Tapatalk