RFXCOM Ethernet Under Linux - Solved
Moderator: b_weijenberg
RFXCOM Ethernet Under Linux - Solved
Hi,
i'm quite new on RFXCOM device and i'm searching since 2 days on google without any luck on how i could use my RFXCOM Ethernet Receiver under linux.
it's working fine under windows with the rfreceiver tools, and i can see my power meter information.
i have try to setup xpl, heyu and other tools without luck, and they looks too complexe for my initial task (or there is lack of documentation for new user, like a step by step guide for dummies...)
so i hope you can help me.
what i'm trying to achieve is quite simple (at least i was thinking it would be): i just want a tools under linux that connect to RFXCOMIP:port 10001 and read output and store any output to a text file. so i can have something like this :
3000F043410004;RFXMeter[240]M;RFXMeter addr:00F0;ID:240;RFXMeter: 17217;RFXPower: 172,17 kWh;RFXPwr-Module: 17,217 kWh;bits=48
any of you have a piece of script, perl, C, php that would connect to the socket and translate the output into the format describe before. or any documentation that can help me to do it my self.
i think i can achive the TCP socket connection, but i'm missing doc on how to decode the output.
BTW, i did not found the link where i could download the RFXReceiver source code on rfxcom, any clue ?
thanks again for anybody that could help me to progress.
regards,
i'm quite new on RFXCOM device and i'm searching since 2 days on google without any luck on how i could use my RFXCOM Ethernet Receiver under linux.
it's working fine under windows with the rfreceiver tools, and i can see my power meter information.
i have try to setup xpl, heyu and other tools without luck, and they looks too complexe for my initial task (or there is lack of documentation for new user, like a step by step guide for dummies...)
so i hope you can help me.
what i'm trying to achieve is quite simple (at least i was thinking it would be): i just want a tools under linux that connect to RFXCOMIP:port 10001 and read output and store any output to a text file. so i can have something like this :
3000F043410004;RFXMeter[240]M;RFXMeter addr:00F0;ID:240;RFXMeter: 17217;RFXPower: 172,17 kWh;RFXPwr-Module: 17,217 kWh;bits=48
any of you have a piece of script, perl, C, php that would connect to the socket and translate the output into the format describe before. or any documentation that can help me to do it my self.
i think i can achive the TCP socket connection, but i'm missing doc on how to decode the output.
BTW, i did not found the link where i could download the RFXReceiver source code on rfxcom, any clue ?
thanks again for anybody that could help me to progress.
regards,
- b_weijenberg
- Forum Moderator
- Posts: 1746
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
RFXCOM Ethernet Under Linux - Solved
The RFXMeter packet is described in chapter 11 http://www.rfxcom.com/documents/RFXMeter.pdf
The RFreceiver source is no longer available!
The connection to the receiver is standard Linux TCP. I don't have the knowledge of Linux so I can't help you but have a look into the DomotiGa software http://www.domoticaforum.eu/forum.asp?FORUM_ID=38
Or use that package.
Bert
The RFreceiver source is no longer available!
The connection to the receiver is standard Linux TCP. I don't have the knowledge of Linux so I can't help you but have a look into the DomotiGa software http://www.domoticaforum.eu/forum.asp?FORUM_ID=38
Or use that package.
Bert
RFXCOM Ethernet Under Linux - Solved
I would also be interested to know if heyu or other console app works with LAN receiver. I don't have a RFXCOM receiver yet, so I need to decide whether to get the USB or LAN version. LAN version would be ideal, but I need it to work with a Linux console app.
- b_weijenberg
- Forum Moderator
- Posts: 1746
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
RFXCOM Ethernet Under Linux - Solved
You can ask this on the Heyu forum http://tech.groups.yahoo.com/group/heyu_users/
RFXCOM Ethernet Under Linux - Solved
i've posted the question on heyu groups and waiting for feedback.
RFXCOM Ethernet Under Linux - Solved
hi does someone could help me to understand this in the documentation ?
| Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 |
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
4 4 3 2 1
7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
< - - - - - - address - - - - > < - - - - - - - - counter value - - - - - - - > < - - > <parity>
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 2 2 2 2 1 1 1 1 |
5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 3 2 1 0 9 8 7 6 packet type
i am lost by the number under the counter value, how should we read this ?
| Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 |
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
4 4 3 2 1
7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
< - - - - - - address - - - - > < - - - - - - - - counter value - - - - - - - > < - - > <parity>
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 2 2 2 2 1 1 1 1 |
5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 3 2 1 0 9 8 7 6 packet type
i am lost by the number under the counter value, how should we read this ?
- b_weijenberg
- Forum Moderator
- Posts: 1746
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
RFXCOM Ethernet Under Linux - Solved
RFXMeter decoding VB.NET example is added to the RFXMeter document V4.0. See the download page at www.rfxcom.com
RFXCOM Ethernet Under Linux - Solved
for those who maybe interested, i get it working, it still need to be improved, <s>but without more detail on RFXCOM protocol, i can not go further</s> thanks to rfxcom VB.net sample, at least it answer my initial question:
<?php
$rfxcom_ip = "192.168.0.106";
$rfxcom_port = "10001";
$packet_type =array ("0"=>"normal data packet",
"1"=>"New Interval Time Set",
"2"=>"Calibrate Value in Conter Value in MicroSec",
"3"=>"new address set",
"4"=>"counter value reset to zero",
"11"=>"counter value set",
"12"=>"set interval mode within 5 seconds",
"13"=>"calibration mode within 5 seconds",
"14"=>"set address mode within 5 seconds",
"15"=>"identification packet");
$fp = fsockopen ($rfxcom_ip, $rfxcom_port);
if ($fp) {
while (!feof($fp))
{
$begin_stream = fread ($fp,1);
$stream = fread ($fp,6);
$packet_len = strlen ($stream) * 8;
$packet_hex= bin2hex($stream);
if ($packet_len==48)
{
// Split Packet in 6 bytes store in arry recbuf
$recbuf = str_split($packet_hex,2);
//calculate the parity
$parity_check = dechex(~((hexdec($recbuf[0]) >> 4) + (hexdec($recbuf[0]) & 15)
+ (hexdec($recbuf[1]) >> 4) + (hexdec($recbuf[1]) & 15)
+ (hexdec($recbuf[2]) >> 4) + (hexdec($recbuf[2]) & 15)
+ (hexdec($recbuf[3]) >> 4) + (hexdec($recbuf[3]) & 15)
+ (hexdec($recbuf[4]) >> 4) + (hexdec($recbuf[4]) & 15)
+ (hexdec($recbuf[5]) >> 4)) & 15);
// Extract Parity from packet_hex
$hex_parity = substr($packet_hex,11,1);
// Extract Type of Packet from packet_hex
$hex_type = substr($packet_hex,10,1);
if (($hex_parity == $parity_check) & (hexdec($recbuf[0]) + (hexdec($recbuf[1]) ^ 15) == 255))
{
$rfxpower=true;
//grab Addr from packet_hex
$hex_addr = $recbuf[0].$recbuf[1];
$dec_addr = base_convert($hex_addr,16,10);
Echo "$packet_hex\t RFXMeter [$dec_addr]M RFXMeter Addr:$hex_addr ID: $dec_addr ";
// Grab Type of packet
$dec_type = base_convert($hex_type,16,10);
if ($dec_type==0)
{
//grab counter from packet_hex
$hex_counter = $recbuf[4].$recbuf[2].$recbuf[3];
//convert to decimal value
$dec_counter = base_convert($hex_counter,16,10);
//display result
echo "RFXMeter: $dec_counter\t RFXPower: ".strval($dec_counter/100)." Kwh RFXPwr-Module: ".strval($dec_counter/1000)." Kwh";
echo "\n";
}
}
}
}
fclose ($fp);
}
else {
print "unable to connect\n";
}
?>
<?php
$rfxcom_ip = "192.168.0.106";
$rfxcom_port = "10001";
$packet_type =array ("0"=>"normal data packet",
"1"=>"New Interval Time Set",
"2"=>"Calibrate Value in Conter Value in MicroSec",
"3"=>"new address set",
"4"=>"counter value reset to zero",
"11"=>"counter value set",
"12"=>"set interval mode within 5 seconds",
"13"=>"calibration mode within 5 seconds",
"14"=>"set address mode within 5 seconds",
"15"=>"identification packet");
$fp = fsockopen ($rfxcom_ip, $rfxcom_port);
if ($fp) {
while (!feof($fp))
{
$begin_stream = fread ($fp,1);
$stream = fread ($fp,6);
$packet_len = strlen ($stream) * 8;
$packet_hex= bin2hex($stream);
if ($packet_len==48)
{
// Split Packet in 6 bytes store in arry recbuf
$recbuf = str_split($packet_hex,2);
//calculate the parity
$parity_check = dechex(~((hexdec($recbuf[0]) >> 4) + (hexdec($recbuf[0]) & 15)
+ (hexdec($recbuf[1]) >> 4) + (hexdec($recbuf[1]) & 15)
+ (hexdec($recbuf[2]) >> 4) + (hexdec($recbuf[2]) & 15)
+ (hexdec($recbuf[3]) >> 4) + (hexdec($recbuf[3]) & 15)
+ (hexdec($recbuf[4]) >> 4) + (hexdec($recbuf[4]) & 15)
+ (hexdec($recbuf[5]) >> 4)) & 15);
// Extract Parity from packet_hex
$hex_parity = substr($packet_hex,11,1);
// Extract Type of Packet from packet_hex
$hex_type = substr($packet_hex,10,1);
if (($hex_parity == $parity_check) & (hexdec($recbuf[0]) + (hexdec($recbuf[1]) ^ 15) == 255))
{
$rfxpower=true;
//grab Addr from packet_hex
$hex_addr = $recbuf[0].$recbuf[1];
$dec_addr = base_convert($hex_addr,16,10);
Echo "$packet_hex\t RFXMeter [$dec_addr]M RFXMeter Addr:$hex_addr ID: $dec_addr ";
// Grab Type of packet
$dec_type = base_convert($hex_type,16,10);
if ($dec_type==0)
{
//grab counter from packet_hex
$hex_counter = $recbuf[4].$recbuf[2].$recbuf[3];
//convert to decimal value
$dec_counter = base_convert($hex_counter,16,10);
//display result
echo "RFXMeter: $dec_counter\t RFXPower: ".strval($dec_counter/100)." Kwh RFXPwr-Module: ".strval($dec_counter/1000)." Kwh";
echo "\n";
}
}
}
}
fclose ($fp);
}
else {
print "unable to connect\n";
}
?>
- b_weijenberg
- Forum Moderator
- Posts: 1746
- Joined: Sun May 14, 2006 4:32 pm
- Location: Netherlands
RFXCOM Ethernet Under Linux - Solved
The number under the counter value indicates the bit numbers of the counter. So the correct order for the counter bytes is byte 4, byte 2, byte 3
RFXCOM Ethernet Under Linux - Solved
Hi, could you try out if heyu works with remserial (http://lpccomp.bc.ca/remserial/)?
I would be very interested since I'm looking into buying the LAN receiver.
I would be very interested since I'm looking into buying the LAN receiver.
RFXCOM Ethernet Under Linux - Solved
accordind to Heyu groups :
no native TCP support for heyU, but could be possible through a tty redirctor, but what the hell ! could be better if they add native TCP support.
i have updated my script above, which is not too bad for me at the present, i just need to implement the other packets type and message.
but at least this permit me now to import rfxcom over ethernet output to Cacti graph and Nagios for alerting in case too much power is used.
no native TCP support for heyU, but could be possible through a tty redirctor, but what the hell ! could be better if they add native TCP support.
i have updated my script above, which is not too bad for me at the present, i just need to implement the other packets type and message.
but at least this permit me now to import rfxcom over ethernet output to Cacti graph and Nagios for alerting in case too much power is used.
RFXCOM Ethernet Under Linux - Solved
Hello. Just in case it helps anyone: I've been using the RFXCOM receiver with the xpl-perl package under Debian Linux, which works fine. Results at http://www.viridis.net/rrd/combined.html.
Maybe an XPL system is too complicated for your need, but since it's all written in Perl, you can read the code and see what it does.
There's a new version of the xpl-perl package out (0.10), but I haven't upgraded to it yet, as I made a few changes in the previous version, so need to find time to see what's in the new version.
Maybe an XPL system is too complicated for your need, but since it's all written in Perl, you can read the code and see what it does.
There's a new version of the xpl-perl package out (0.10), but I haven't upgraded to it yet, as I made a few changes in the previous version, so need to find time to see what's in the new version.
-
- Member
- Posts: 255
- Joined: Thu Jun 25, 2009 2:09 pm
- Location: Enschede, The Netherlands
RFXCOM Ethernet Under Linux - Solved
Does XPL-Perl work with the LAN receiver and transmitter? Or only the USB-versions?
RFXCOM Ethernet Under Linux - Solved
I think remserial or similar would okay solution for Linux LAN support. But could someone with LAN receiver test it anyways? Also interested if XPL-Perl works with the LAN receiver.
I just want to be sure that some Linux console app (hopefully heyu) can use the LAN receiver.
I just want to be sure that some Linux console app (hopefully heyu) can use the LAN receiver.
-
- Member
- Posts: 145
- Joined: Sat Jul 05, 2008 7:00 pm
- Location: Netherlands
RFXCOM Ethernet Under Linux - Solved
Xpl-perl works fine with the RFXCom LAN receiver. I use it for RFXMeter, RFXPower and Visonic decoding and it does that just fine (although it does bend the rules of XPL a little bit).
Xpl-perl also has RFXCom transmitter support, but I have not used that as I have no transmitter; I'm sure xpl-perl will also support the LAN version though.
Xpl-perl also has RFXCom transmitter support, but I have not used that as I have no transmitter; I'm sure xpl-perl will also support the LAN version though.