Custom Logging / Data Extraction
Custom Logging / Data Extraction
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
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
http://www.easte.net/mrtg
Re: Custom Logging / Data Extraction
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
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
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.
So, for example value 8 would be port 4 on, value 5 would be port 1 and 3 on.
Roberto.
Re: Custom Logging / Data Extraction
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
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
Sent from my iPhone using Tapatalk