Automate Your Place, part 1
Volume Number: 23 (2007)
Issue Number: 01
Column Tag: Home Automation
Automate Your Place, part 1
Have your Mac brew your coffee and take care of the lights on your way out
By Andrew Turner
Like any good developer or power-user, you've been using the great tools that come with Mac OS X to automate much of your workflow. Applescript and Automator together allow you to rid yourself of repetitive tasks. You import, backup, convert, and markup your photos automatically. Data backups happen once per week, with incremental backups in between.
However, despite all this effort to make your computer work more efficient, safe, and hassle free you probably haven't really considered how much your Mac could be doing for you. Why restrict your automation to just the virtual desktop, why not also automate your real desk. While you're at it automate your office, house, store, garage, shop, or any other place where you have a Mac!
Seem a little too Sci-Fi? Just imagine that in the morning your alarm goes off. As you get out of bed your coffee maker begins brewing a fresh pot of coffee, your Mac wakes up, starts downloading your email, updates your news RSS feeds, opens iCal to the day's agenda, and plays some soothing morning music. Half-an-hour later your coffee maker automatically shuts off. As you pull out of your driveway your computer performs a backup of your files then goes to sleep. When you come home at night, your house knows that it's dark outside and turns on the porch and hallway lights for you. When you're ready to watch a movie you pull up FrontRow and the living room lights dim, the stereo turns on and your video starts playing. You could do the same thing to your shop, office, or garage. Save energy by turning off unused lights, know the state of your security system via a web-browser from your house, or get notified by email when someone enters your driveway. These are just some of the possibilities of an automation system powered by your Mac.
In this article we will introduce you to the current field of Location Automation in the Apple world, it's not just about your house anymore. Automation software has become more advanced, hardware more prevalent and robust, and the community has grown. We will show you how to get started, setup your environment, and connect to the community. In future articles, we will cover more in-depth topics such as writing complex scripts, web interfaces, homemade sensors, and notifications on your cellphone, email, or Skype.
A Whole World of Options
There are two main components of the automation system: automation devices, and the management software that will connect to all these devices and allow you to create your scripts and settings.
When home automation became really popular several years ago, everywhere you looked there were ads for X-10 devices. More often than not, the advertised systems were camera systems that had little to do with the X10 standard associated with automation systems. However, the ads made the term X10 known to most computer users. X10 is a standard communication system developed in 1975 for remote control of devices in a home or building. This standard is known for sometimes being unreliable as the communication between the controlling computer and the devices is dependent on the quality of the wiring in the building.
Recently, several more robust standard have begun to emerge to address the frustrations and shortcomings of X10. Most are still in the standards formulation and beta release stage. These include Zigbee, UPB, WiMax, Z-Wave, and HomeRF.
One technology that very has been recently released and gained widespread use and support is INSTEON, which was developed by SmartLabs Technology. INSTEON couples the traditional powerline communications with redundant mesh-networking to speed up response times as well as add state verification. These techniques are implemented to provide users with a hopefully more enjoyable and reliable automation system.
A benefit of the new INSTEON system is that it is backwards compatible with the older X10 devices. This allows current users to slowly upgrade their existing X10 automation systems to INSTEON, and new users purchase the newer INSTEON controller and then purchase INSTEON or inexpensive X10 modules as necessary for your location. For this reason, in this article we will design our automation system using the INSTEON modules. Readers can apply the same techniques to older X10 components.
There are 3 key hardware pieces required for the simplest automation system: controller, signalinc receivers/repeaters, and a device module. We suggest you look at buying starter packages from a vendor (see Resources) to start off your automation system. An INSTEON starter package will cost about $130 USD.
The controller connects to your Mac via USB and plugs into an electrical socket on the other end. The controller will send and receive signals from the INSTEON devices at your location. If you're on a budget, you can stick with an X10 controller like the PowerLinc 1132CU, which is USB and therefore doesn't require a USB to Serial cable. The PowerLinc also has good support with most of the available Mac software packages.
The SignaLinc receiver/repeater are new devices that provide the INSTEON signal repeating and mesh-networking redundancy. The Signalincs come in a pair, and plug into wall sockets around your location. They also have small antennas and will need to be setup so that the pair can communicate wirelessly through your walls.
The device module can be a lamp dimmer or appliance controller (on/off). These modules plug into a wall socket, and then you plug the lamp or appliance into the module. You can then turn the device on by using the appliance's own power switch, by using your Mac, a control pad, or INSTEON switch. Additionally, a device module can be a sensor such as a motion detector or window sensor. For a less apparent automation system, instead of an external module, you can get a wall socket that will replace your current socket.
Other typical pieces of an automation system are switches, button controllers and control pads. These devices have the benefit of looking and operating like normal wall switches and power controllers while also hooking into your automation system. A control pad plugs into a wall socket via a cable, or communicates wirelessly. It is a good idea to have at least one control pad that provides direct control of your hardware devices. That way if your Mac is turned off, out of commission, or you need to debug your home automation system, you can use the control pad.
In addition to the basic devices discussed above, it is possible to tie in a HVAC (heating ventilation and air conditioning) controller, security systems, sprinklers, house sensors, theater systems, and cameras.
For wireless interface, it is possible to get a wireless transceiver. Utilizing a wireless transceiver, you can turn control devices or send commands to your Mac using key fobs and small control pads. Additionally, the wireless interface will detect commands from motion detectors and magnetic switches like the DS10A, and they will show up like X10 devices.
The W800-RF32 is a well-supported wireless interface that plugs into your Mac. Because the W800 is a serial device, you will need a Serial-to-USB converter. The Keyspan adapter is an affordable and very well supported option. Using the W800 you can receive signals from wireless door sensors, or wireless remotes inside and around a house or office.
Look at an online automation vendor for other device options. Also, X10 has been sold under a variety of other branding labels, and these devices are often found inexpensively online or local stores. In particular, the Black & Decker Freewire system provides outdoor X10 plugs, and a wireless remote interface that is great for controlling holiday lights or other external devices. Radio Shack also carries home automation devices that work with X10, and therefore INSTEON systems as well. This can be a great place to quickly pick up devices rather than waiting for that box in the mail.
Once you have your hardware in hand, you will need a way to control and read all your devices. Automation software runs on your Mac computer and allows you to setup triggers, groups, and scripts to give some intelligence to your automation system. Without a software controller you are limited to simple control of devices and small groups of devices.
There are currently 5 software options on the Mac: Perceptive Automation's Indigo, Sand Hill Engineering's XTension, AlwaysThinking's ThinkingHome, Findley Studios' HomeRun, and the open-source MisterHouse.
MisterHouse is an open-source option that is built on Perl. It runs on all the major OS's: MS Windows, Linux, and Mac OS X. The scriptability of MisterHouse is very powerful, and the entire underlying system is exposed for the user to tweak as desired. However, the learning curve is somewhat high, and INSTEON support is starting to emerge, but not solid yet.
Figure 1: MisterHouse offers a lot of features and configurability, but has a steep learning curve.
XTension has long been a well supported and very reliable Mac automation solution. It has been developed and supported for over 10 years, and includes many interesting features. In addition to the normal configuration and control of devices, XTension allows users to configure their own layouts and switches in the client views, and the ability for multiple XTension instances to communicate with one another over a network. It also offers a unique capability to utilize multiple controllers, which is useful for dealing with bridging different power legs in buildings. Lastly, XTension has a large AppleScript dictionary for users to write their own logic, and good integration with web cameras.
The developers of Xtension, Sand Hill, evaluate new technologies before necessarily implementing them. Their philosophy is that a critical component of the automation system is reliability. Therefore, their releases and feature updates are less frequent than other automation software options. Sand Hill also maintains a very extensive list of tutorials and information on automation systems and is definitely worth reading for learning more about the subject.
Perceptive Automation's Indigo was upgraded recently to a version 2.0 with a large list of new features, including, foremost, that it is a Universal Binary, so it will run natively on your new Intel-based Mac. Indigo supports X10 and INSTEON controllers, utilizes Client/Server architecture, so it's easy to control your automation system from a remote computer running just an Indigo client. For additional remote control, there is a very configurable web interface, and Dashboard widget, and very active community and forums to help you set it all up. Using the web interface, you can quickly control your automation system from anywhere in the world (disclaimer: the author developed the web interface and widget, and the source code is available under an open-source license). Indigo is available as an unrestricted 30-day demo available at Perceptive Automation's website.
ThinkingHome, and HomeRun all provide adequate interface to X10 controllers, with varying levels of scriptability, interface, and overall features. Unfortunately, these three options don't appear to be actively updated, though they're still available for trial. They're also only available for PPC and not as Universal Binaries.
This was a quick run down of the various automation software solutions available on the Mac. Due to the active development and support of Indigo, as well as the ease of use, support of Mac technologies, and impressive list of features, we will be discussing Indigo in more depth in our next article.
Putting it Together: Designing your Automation System
Now that we've covered the different pieces you will need to automate your place, lets design a system. For the purposes of this example, we will use a small office (homes are typically used, so lets turn it around). Besides, the example could easily be inverted and applied to a home, workshop, or home office.
First thing to do is to list the devices you will want to control with your automation system. Lets say: coffee maker, overhead lights, desk lamp, door and window closures, and a stereo system. Additionally, we want to integrate the system with our existing switches to keep the transition to an automation system transparent to other members of the office. Just like SAF (Spouse Approval Factor) there is such as thing as Co-worker Approval Factor (CAF). Based on this list, we will need to determine our "Bill of Materials" to order from an automation store. We will also use this list to record the device addresses of our modules for later programming into Indigo.
|Table 1: Components for a Sample Office Automation System
|Overhead light switch (2)
|Doors, windows (6)
||Powerflash or DS10A
This is just a suggested system, and you're free to choose and configure the devices as you see fit. Our example office is just a general example of a simple system that utilizes the principal parts of an automation system.
We just covered the basics and options of an automation system with your Mac. The automation software available for your Mac allows unlimited customization, and hardware and interfaces are plentiful for whatever you want to control or sense. In our next article, we will setup an automation system for a small office/workshop, setup modes, a web interface, and notifications.
SmartHome - http://www.smarthome.com
FunForGeeks - http://funforgeeks.com
Indigo - http://www.perceptiveautomation.com
XTension - http://www.shed.com/
MisterHouse - http://misterhouse.sourceforge.net/
ThinkingHome - http://www.alwaysthinking.com
HomeRun - http://www.findleystudios.com/homerun
XTension Mailing List - http://lists.shed.com/mailman/listinfo/xtensionlist
Indigo Forums - http://www.perceptiveautomation.com/phpBB2/index.php
comp.home.automation - http://groups.google.com/group/comp.home.automation
Andrew Turner is an independent software developer and technology integrator who has built robotic airships, automated his house, designed spacecraft, and in general looks for any excuse to hack together cool technology. You can read more about his projects at www.highearthorbit.com.