|
I spent a long time reading and writing documentation on how to use those RF interfaces with misterhouse, and how to use XPL in general.
Instead of pasting the information here, here is the link with all the goods:
http://misterhouse.wikispaces.com/X10RFX10SecRFXCOM
I did also learn about RF and antenna design in the process. Here is the quarter wave antenna I built and that I'm now using on my MR26a:



And the simpler, but actually more effective dipole antenna I made and that I use for the W800RF32:




The serial W800RF32 is easier to extend with a long serial cable
One of my first applications was to read an X10Sec module in my mailbox to know when said mailbox was opened:


The next one was to know when my garage doors were opened or closed.
The first thing was to move the door sensors to be at the bumper level, which included drilling holes in the gardrail, no small feat without diamond tip drills which I didn't have. After several hours of making new holes and adjusting the sensors, they are now set to detect the car's bumper as opposed to looking for the car's tires which made it easy to close the door on top of the hood ...

Next, I installed X10Sec sensors on each door so that I know when they get opened or closed.


Technical notes:
X10Sec modules send their code 4 times, but if you miss it because the RF band was noisy or the antenna a bit out of reach (even though I tried hard with a dipole antenna put in the attic), then you have no way of querying the state.
X10Sec modules are however nice enough to rebroadcast their state every 4 hours or so in case you missed the previous state update.
Here is the code I wrote for misterhouse:
#08/05/2010 11:34:22 State Garage2 is alertbattlowmin
#08/05/2010 11:34:22 State Garage2 is normalbattlowmin
my %x10rfstate; #noloop
foreach my $dev (["x10sec_garage1", "Main Garage Door"], ["x10sec_garage2", "Small Garage Door"], ["x10sec_mailbox", "Mailbox"])
{
my $obj = $dev->[0];
my $name = $dev->[1];
$obj = &::get_object_by_name($obj);
$x10rfstate{$obj} = $obj->state if (not defined $x10rfstate{$obj});
if ($obj->state_now)
{
my $oldstate = $x10rfstate{$obj};
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
$year += 1900;
$mon++;
print_log "X10SEC: $name is ".$obj->state." (was $oldstate)";
open(LOG, ">>/var/log/x10sec");
printf LOG ("%.4d/%.2d/%.2d %.2d:%.2d:%.2d $name: ".$obj->state." (was $oldstate)\n", $year,$mon,$mday,$hour,$min,$sec);
close(LOG);
if ($obj->state ne $oldstate)
{
if ($obj->state =~ /alert/)
{
system('date | Mail -s "'.$name.' Just Opened" EMAIL');
}
elsif ($obj->state =~ /normal/)
{
system('date | Mail -s "'.$name.' Just Closed" EMAIL');
}
else
{
system('date | Mail -s "'.$name.' UNKNOWN STATE" EMAIL');
}
$x10rfstate{$obj} = $obj->state;
}
}
}
# vim:sts=4:sw=4 |