If you want to be notified of something being opened, such as a bedroom door, the mailbox, or the liquor cabinet, you need a door and window sensor. Up until recently you pretty much had to hack together your own door sensor, by modifying a motion detector, but thanks to a new home automation controller (discussed shortly) you can use wireless door and window security sensors instead.
The security sensors aren't especially attractive, but they're small and easy to install. They have a two-piece magnetic switch, one half of which you mount to your door, the other half to the door jamb. A short set of wires runs to the battery-powered transmitter. When the door opens, the transmitter blips out a signal to your home automation controller. Another signal is sent when the door has closed. It's simple, yet very effective. And since these sensors are meant for use with a security system, they even transmit a warning beacon when their battery is low.
Door sensors are sold individually but the best price is usually in a multi-pack of four or more sensors, if you think you need that many. Make sure the ones you buy are compatible with X10 security systems; other types of wireless sensors won't be able to talk to the home automation controller.
Wireless-to-USB Home Automation Controller
It wasn't very long ago that connecting a home automation controller to your Mac required a jumble of adapters. Luckily, X10 Corporation's CM15 Active Home Pro controller puts all that in the past. It's USB-based and, best of all, it includes a wireless receiver that works with the motion detectors and door sensors we've been discussing. It provides everything you need for this project and more.
While you can buy the Active Home Pro by itself, if you have any inkling that you might want to try automating a few lights too, it's a better deal to get the ActiveHome Pro Starter Kit instead. It adds a motion detector and a few other modules that you can use to do more than what's described in this article. For help with putting those extras to use, I hope you'll consider turning to my O'Reilly book, Smart Home Hacks.
Home Automation Software
There are a few good home automation applications for the Mac, but I think that the best choice for this project is to download the "light" version of XTension. The full version is a versatile home automation toolkit, but the free version allows you to work with up to five units (sensors), which is plenty for what we're doing here. Another choice is Indigo, but its demo version expires after 30 days. However, if you insist that your Mac experience consist of nothing but Cocoa applications, using Indigo is sure to make you happy.
If your tastes run more toward free and open software, then gander at MisterHouse. Written in Perl and driven with a web interface, it runs on Unix, Mac OS X, and Windows systems. Unfortunately, it doesn't (yet) support the CM15 Active Home Pro controller. You'll have to use a alternate controllers, and those adapters I mentioned. Check out the MisterHouse docs for what it supports, and read my article Hacks for Smart Homes for tips about getting the software up and running on Mac OS X.
Setting It Up
Whew, getting the hardware was the hardest part, you're in the home stretch now. To get going, install your home automation software, connect the Active Home Pro to a nearby wall socket and to a USB port on your Mac, and mount a sensor in an appropriate location. Let's say it's a motion detector over the front porch.
The next step is to set the detector's X10 address. Every X10 device has an address that consists of an alphabetic house code (A through P) followed by a unit number (1 through 16). On the motion detector, the address is set by pressing two tiny buttons underneath its front door. For the sake of example, let's say that you set the address to C14.
Now you can add the detector to your home automation software. If you're using XTension, choose File -> New Unit, then fill in the unit's address (C14), click the checkbox to indicate that it is an X10 Unit Type, and then check the Allow Wireless option under Unit Behavior. Give it a descriptive name too, such as "Front Door Motion" as shown in Figure 2.
Figure 2: Tell XTension about the sensor.
Click OK and the unit is added to the Master Unit List. Repeat this process for each of your sensors. Or, if you're anxious to see some results, keep reading and come back to configure the others later.
If you're using a door and window sensor, be sure to set the Unit Type to Security, so XTension will know about the different type of signals it sends. Also, security units don't have an address that you set directly. When you're first putting batteries in the unit, stand near your computer, then push the button on the sensor and XTension will walk you through the process of adding the new unit.