
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 you’re not much of a programmer—setting 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 config