π
2010-06-25 00:00
in Computers, Linuxha
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:
https://web.archive.org/web/20120423061924/http://misterhouse.wikispaces.com/X10RFX10SecRFXCOM
or
https://github.com/hollie/misterhouse/wiki/X10RFX10SecRFXCOM (up to date, but formatting a bit broken).
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:
Although, after 6 years of usage, I got tired of replacing the batteries on that DS10A, and I also lost a couple to water damage (it's been hard to waterproof it without killing the radio signals coming out of it). Also, on occasion I would lose a state change due to RF loss. I ended up bringing power and ethernet to my mailbox for IP cams, so I ended up adding an insteon iolinc to read the mailbox open status and at the same time control a flood light to illuminate the mailbox if it gets opened at night:
iolinc has a 2nd relay in parallel with its own relay in put to act as an OR gate and leave the output on even if the input (mailbox) has gone back down
got a weather proof box this time, tight fit
lots of wires going to the mailbox now, but I've always prefered wired to wireless
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 hour 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 |