<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by RDNZL</i>
<br />Mark,
I finally had some time to look into my RFXPower module probs I had with xpl-rfxcom.
I solved 2 bugs, dunno if these break other modules.
Code: Select all
server:/usr/local/bin# diff /home/domo/install/xpl-perl/lib/xPL/RF/RFXMeter.pm /usr/local/share/perl/5.8.8/xPL/RF/RFXMeter.pm
58c58,59
< my $device = sprintf "%02x%02x", $bytes->[1], $bytes->[2];
---
> my $device = sprintf "%02x%02x", $bytes->[0], $bytes->[1];
>
102c103
< my $kwh = ( ($bytes->[4]<<16) + ($bytes->[2]<<8) + ($bytes->[3]) ) / 100;
---
> my $kwh = ( ($bytes->[4]<<16) + ($bytes->[2]<<8) + ($bytes->[3]) ) / 1000;
This fixes the problem I described earlier, about the wrong device id. I found out xpl-perl reads the wrong bytes ( 1 off)...
And for an RFXPower module inserted in RFXMeter you need to divide by 1000 instead of 100 to get the kWh.
Problem which is still there is rrd not accepting the readout:
2007-09-25_17:51:39.96879 ERROR updating /var/lib/rrd/rfxmeter.00f0/kwh.rrd: not a simple integer: '224.271'
2007-09-25_17:53:39.97997 ERROR updating /var/lib/rrd/rfxmeter.00f0/kwh.rrd: not a simple integer: '224.299'
2007-09-25_17:57:39.99785 ERROR updating /var/lib/rrd/rfxmeter.00f0/kwh.rrd: not a simple integer: '224.354'
2007-09-25_17:59:40.00677 ERROR updating /var/lib/rrd/rfxmeter.00f0/kwh.rrd: not a simple integer: '224.385'
I can round it, but i loose important data then.
Anyone knows why rrd is complaining?
I have also created 2 very simple scripts, to stop and start xpl-perl the right way, make live so much easier!
stop-xpl:
Code: Select all
#!/bin/sh
cd /etc/xplperl/service
for i in `ls`
do
sv down $i
done
start-xpl:
Code: Select all
#!/bin/sh
cd /etc/xplperl/service
for i in `ls`
do
sv up $i
done
I'm starting to like xpl-perl! [8)]
Regards,
Ron.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Thanks for the address bug fix. I've incorporated that in to svn r363.
The other fix is not so simple. Since I have one of the original rfxpower transmitters and that transmits kwh*100 not kwh*1000. I'll try to find out if there is a programmatic way to tell the two apart.
As for the RRD problem, counters in rrd must be integers - I didn't realize that earlier versions just truncated them silently. I think the best thing to do is just to multiply them back up (*1000) for storage and divide again for display. However, I'm not really sure that I can think of a good way to do this in the code. I'll have a think about it. I've raised a ticket in the xPL-Perl bug tracker at
http://www.xpl-perl.org.uk/ticket/7. Send me a private message if you want a login so you can raise other tickets.
Thanks very much for the helpful feedback. It is much appreciated.
Regards,
Mark.