rfxcom linux/perl

Forum about Rfxcom home automation Domotica devices.

Moderator: b_weijenberg

Post Reply
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

rfxcom linux/perl

Post by Snelvuur »

After some digging i found a piece of code that should work with the rfxcom and perl. However i have not tested this yet.

For the usb to work you need (to be safe) 2.6.9 or higher. It should be normally included in the kernel.

Anyone with some code under linux that works with the rfxcom, please share so we can have a bigger userbase/idea's.

Here is the piece of code:

#! /usr/bin/perl -w

use strict;
use Fcntl;

my $port = $ARGV[0];
print "Port: $port\n";
system("stty 4800 < $port");
system("stty -a < $port");
sysopen(RFXCOM, $ARGV[0], Fcntl::O_RDWR(), 0666) || die "ERROR: can not open $ARGV[0]\n";

my $timeout = 90;
my $inbuff = "";
my $char;
my $rin = "";
my $rout;

vec($rin, fileno(RFXCOM), 1) = 1;

while ((select($rout=$rin, undef, undef, $timeout)) && (!($inbuff =~ m/.+\n/))) {
sysread RFXCOM, $char, 1;
print "--$char--";
$inbuff .= $char;
}

if ($inbuff eq "") {
print "Error! Timed out waiting for input.\n";
}
else {
print "Got line:" . $inbuff . "";
}
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

rfxcom linux/perl

Post by Snelvuur »

Hmm, seems someone else has been busy too:

http://www.xpl-perl.org.uk/file/xpl-per ... om?rev=215

xpl perl with experimental rfxcom support.
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

rfxcom linux/perl

Post by Snelvuur »

The xpl-perl rfxcom is by far the most correct one. I dot get several messages back, although they still need decoding. At least it gives data back.

If you want to try it out, download it from the trunk since version 0.4 of the xpl-perl does not include this part yet.
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

rfxcom linux/perl

Post by Snelvuur »

Well i had a chat with the builder of the xpl-perl project. Basicly he's added now support for temperature for the rfxsensor:

xpl-trig/sensor.basic: bnz-rfxcom.debiantje -> * - rfsensor00f0[temp]=7.5
xpl-trig/sensor.basic: bnz-rfxcom.debiantje -> * - rfsensor00f0[temp]=7
xpl-trig/sensor.basic: bnz-rfxcom.debiantje -> * - rfsensor00f0[temp]=7.5

I'll help him out more so we can have all the functions.

And i've also spoken him about the ctx35. Since my perl project was allready 99% done he can almost copy my stuff 1 on 1 to xpl.
Post Reply

Return to “Rfxcom Receivers & Transmitters Forum”