7.1 What You Need

X10 is a company that has been selling its proprietary electrical switches for many years, and the technology has changed little since its introduction over thirty years ago. Yet regardless of its age, X10 power switches are still a primary home automation technology, mostly because they are inexpensive and, when coupled with a computer, can send and schedule power on/off events.

Instead of relying on X10’s rigid and proprietary Windows-based application to control X10 devices, we are going to use a freely available open source utility called Heyu. Created and maintained by Daniel Suthers and Charles Sullivan, Heyu provides a command-line interface to monitor and send a variety of X10 commands to the CM11A. These instructions will then be relayed to the specified X10 switches.

For this project, it is best to stick with the Linux or Mac operating system, since they can easily compile the source code without modification. Unfortunately, there is no native port of Heyu available for Windows, and none is planned anytime in the near future. If you are using Windows, consider running a Linux distribution in a virtual machine using a program like VirtualBox.[62]

You will need the following parts (refer to the photo in Figure 22, Web-Enabled Light Switch parts):

/epubstore/R/M-Riley/Programming-your-home//images/webenabledlightswitchparts-labeled.jpg

Figure 22. Web-Enabled Light Switch parts
  1. X10 CM11A computer interface[63]—note that unlike the serial port-based CM11A, the newer X10 CM15A model connects to a computer via USB and will not work with Heyu software. See the Heyu FAQ for more details.[64]

  2. X10 PLW01 standard toggle wall switch

  3. Serial to USB interface cable

  4. An Android OS phone or tablet device (used to run the Web-Enabled Light Switch client application)

  5. A computer (not shown), preferably Linux or Mac-based, with Ruby 1.8.7 or higher installed

Additionally, you will need the following software:

  • Heyu 2.9.3 or higher[66]

  • Ruby on Rails 3.0 or higher[67]

  • The Eclipse IDE[68]

  • The Android SDK 1.5 or higher[69]

  • The Android Development Tools (ADK) Plugin for Eclipse[70]

At the heart of any computer-assisted X10 setup is the control module. The module provides the interface between the transmission of instructions to X10 devices as well as for the notifications of triggers (ex: motion detection) from X10 appliances equipped with such capabilities. Several of these interfaces exist, such as the X10 Firecracker (known by its serial number as the CM17A) or the original X10 computer interface, the CM11A. Most of the open source X10 automation software available today supports both of these and other interfaces, but I find the CM11A to be the most prevalent. Hence, I recommend using the CM11A for this project.

With the required hardware and software in hand, let’s take a look at how we are going to combine all this technology to make it turn a light on and off from an Android smartphone application.

Programming Your Home
cover.xhtml
f_0000.html
f_0001.html
f_0002.html
f_0003.html
f_0004.html
f_0005.html
f_0006.html
f_0007.html
f_0008.html
f_0009.html
f_0010.html
f_0011.html
f_0012.html
f_0013.html
f_0014.html
f_0015.html
f_0016.html
f_0017.html
f_0018.html
f_0019.html
f_0020.html
f_0021.html
f_0022.html
f_0023.html
f_0024.html
f_0025.html
f_0026.html
f_0027.html
f_0028.html
f_0029.html
f_0030.html
f_0031.html
f_0032.html
f_0033.html
f_0034.html
f_0035.html
f_0036.html
f_0037.html
f_0038.html
f_0039.html
f_0040.html
f_0041.html
f_0042.html
f_0043.html
f_0044.html
f_0045.html
f_0046.html
f_0047.html
f_0048.html
f_0049.html
f_0050.html
f_0051.html
f_0052.html
f_0053.html
f_0054.html
f_0055.html
f_0056.html
f_0057.html
f_0058.html
f_0059.html
f_0060.html
f_0061.html
f_0062.html
f_0063.html
f_0064.html
f_0065.html
f_0066.html
f_0067.html
f_0068.html
f_0069.html
f_0070.html
f_0071.html
f_0072.html
f_0073.html
f_0074.html
f_0075.html
f_0076.html
f_0077.html
f_0078.html
f_0079.html
f_0080.html
f_0081.html
f_0082.html
f_0083.html
f_0084.html
f_0085.html
f_0086.html
f_0087.html
f_0088.html
f_0089.html
f_0090.html
f_0091.html
f_0092.html
f_0093.html
f_0094.html
f_0095.html
f_0096.html
f_0097.html
f_0098.html
f_0099.html
f_0100.html
f_0101.html
f_0102.html
f_0103.html
f_0104.html
f_0105.html
f_0106.html
f_0107.html
f_0108.html
f_0109.html
f_0110.html
f_0111.html
f_0112.html
f_0113.html
f_0114.html
f_0115.html
f_0116.html
f_0117.html
f_0118.html
f_0119.html
f_0120.html
f_0121.html
f_0122.html
f_0123.html
f_0124.html
f_0125.html