22
Part I: Home Automation
Logic and Timer
The intelligence for this project will be provided by a script you create
and run on your computer, such as the one in Exhibit B. This script (the
logic component) will receive input from the computer’s internal clock and
motion detectors. It will then issue commands to the control mechanism to
turn the porch light on or off.
For the script described in this section to work properly, you should have a
serial port on your computer and you should leave your computer running
at all times.
Some people prefer to turn their computers off when not in use because
they think it will extend the life of the computer and lower their electric bills.
However, it’s usually better to leave them on, even if you don’t have anything
running. Computers today include power management capabilities that turn off
unused components so the computer draws very little power when not in use.
Additionally, starting and shutting down your computer can cause more wear and
tear than simply leaving it on.
Don't worry if youre not much of a programmersetting up this script
requires minimal understanding of scripting. The script has a few depen-
dencies that need to be set up first: the X10 computer interface, the Perl
scripting language, and some modules that add home automation func-
tionality to Perl. After you configure these dependencies, you will type or
download the provided home automation script, test it, and then schedule
it to run automatically when your computer starts.
Shortcut: Many graphical applications that control X10 devices are available.
These applications don’t provide the same level of flexibility as creating your own
script, but they may get you started faster if you're not comfortable with scripting.
Some of the free applications include:
MisterHouse, a very complete and complex set of Perl scripts for home auto-
mation (http://www.misterhouse.net)
Java Home Automation (http://jhome.sourceforge.net)
Home Control Assistant; free, limited version available (http://www.
smarthome.com/1268.html)
X10Controller (http://x10controller.sourceforge.net)
Your X10 computer interface probably came with software to allow you
to control X10 home automation devices. It’s a good idea to play with this
software to make sure that the interface works, and to familiarize yourself
Logic and Timer
hhpg.indb 22
11/24/2004 1:54:02 PM

Get Home Hacking Projects for Geeks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.