
by Sean Adams
Download | Browse SVN
Automogator is a collection of free software for home automation. While many software packages already exist for lighting control and scheduling purposes, I found that there were few good solutions for controlling devices with infrared and serial interfaces. Such products include home theater equipment, pool and spa controls, thermostats, alarm systems, energy monitors, and weather stations. In addition, there is a wide variety of simple transducers and I/O devices which may have applications in home automation.
The intended audience for this project is the perl-speaking automation enthusiast. At the moment, Automogator is presented as a collection of examples and software modules for devices which I am using myself. Although it is not yet ready for "point and click" use, it is a suitable starting point for anyone with scripting experience to solve some of the more interesting problems that often arise in home automation.
It's Event Driven
My overriding requirement for this software was that it had to be FAST, because some of the tasks I wanted to implement included turning on lights when doors were opened, controlling various things in response to IR commands, and handling frequent updates from things like utility meters. After kicking around a few ideas of my own, I came across POE, the Perl Object Environment, which turned out to be an excellent framework for what I wanted to do. Besides being a robust platform for implementing any sort of "reactive" behavior, POE includes several components especially suited for home automation, including web servers/clients and protocol parsing tools. Most importantly, it abstracts all the tedium of multitasking, network IO, and buffering that you just shouldn't have to reinvent before being able to implement your automation logic.
If you are new to event-driven programming or perl, you may find that POE is a tough nut to crack. It has a steep learning curve, but once you get the hang of it, it is very rewarding. The modules I have already developed touch on most of the common home automation problems you might encounter, and should serve as helpful templates for any new device you might want to add. You don't need to know what POE is doing under the hood to get started, but once you become comfortable with it you will be amazed by how quickly you can get stuff done.
Components
Each supported device or protocol is a separate module, or "component" in POE parlance. A component implements general support for a particular hardware or software product with which Automogator might communicate. Any custom home automation logic needed by a particular user is implemented in their main perl script, which is where each component is instantiated. More on that later... without further ado here are the components that exist so far:
- Indigo
Indigo is a delightful piece of software for the Mac that makes it easy to implement sophisticated lighting controls, scripts, schedules, and triggered behaviors. One of its most exciting features is the "control pages", which offer a very simple way to create custom user interfaces to control your home using your iPhone or web browser.
This component communicates with Indigo over its control port (TCP 1176), which is the same interface used between the Indigo client and Indigo server. This means it has a complete view of everything we might want to access, including a live feed of events for all device state changes, variable changes, and logging. A current copy of Indigo's entire state is maintained by this client, using the incremental updates which are sent by the server.
- Global Caché GC-IRE Infrared receiver (incomplete)
The GC-IRE is a little adaptor which translates IR signals from a remote control into an ASCII encoding over RS232. It is quite a versatile product in that it transmits the raw timing of the signals and even supports different modulation frequencies. This means it is able to work with nearly any IR remote. It also works with Xantech IR repeater systems, which you may already have if your home theater equipment is installed in a cabinet.
The GC-IRE is quite "bare bones" in that it provides nothing more than a serial stream of data which represents the IR carrier timing. Automogator provides a parser which converts this data into the hex codes that are specific to a particular manufacturer's format. So far I have only implemented a handful of codes for the handful of devices that I'm using. It's easy to add more, but there is an opportunity here to leverage the LIRC database for example to support all of their codes.
IR input, combined with hardwired RS232 connections to your AV equipment, allows you to solve some problems which even the best programmable remotes still have trouble with. The problem with macros is they take a long time, and often fail to maintain consistency between the remote and the actual state of your devices. Also, universal remotes never seem to have a button layout that is perfectly compatible with all of your devices. However, by executing RS232 commands in response to IR input, these problems become tractable because you can trigger commands to any device based on IR codes destined to any other device. You can also use IR to control Insteon devices, or anything else you can imagine.
- Elk M1 Alarm System
The Elk M1 is an expandable security system which is both full-featured and DIY-friendly. It also incorporates some home automation features including Insteon compatibility and a macro language, although the Elk-RP configuration software is painful to use and its ethernet/IP support is primitive. Despite some shortcomings, it works very well as a conventional alarm system, and by integrating it into a larger home automation system using Automogator, you can do many useful things such as turning on lights in response to doors being opened, triggering occupancy heuristics using motion detectors, shutting down lights and HVAC when the system is armed, and so on. Elk's hardware zone expanders and output modules also provide a relatively inexpensive way to add general purpose IO.- Aprilaire 8870 thermostats
I inherited a bunch of these with the house, and can't say I would have chosen them. They are overpriced and clumsy to use and install, and I have to imagine there are better products available for home automation. However, they do include an RS422 control bus, which is all I need to make them suck less!
Once the thermostats are connected through Automogator, some of the features that can be implemented include intelligent scheduling as well as automatically inhibiting heat/AC when nobody is home, or when the alarm system reports that any window is open. If the HVAC is divided into zones (using motorized dampers or separate valves in a radiant floor system) it becomes possible to do fine-grained occupancy sensing on a room-by-room basis, saving significantly on energy costs.
- Rotel receivers, DVD players, and radio tuners (incomplete)
Rotel products have a serial interface which allows you to do anything that is possible from the front panel of the device, including discrete power and input selection as well as being able to grab the information that is being displayed on its VFD. Having a serial cable connected to each device in the stack allows commands to be sent rapidly, reliably, and in parallel. For example, when I hit the power-on button on my DVD player remote, it automatically turns on the receiver and television and sets everything to the correct inputs. This happens practically instantaneously, and does not require holding the remote for any extra period of time that would be required for an IR macro. By monitoring the state of each device over the serial port, you can also trigger actions on other devices as a side effect.
Most mid- to high-end A/V equipment now includes such a serial interface. The Rotel component should be a good template for any other brand.
- NEC Television
This just does power on/off and input selection. It is an example of a minimal component that only transmits outgoing commands.
- Pentair pool/spa controls
The Pentair IntelliTouch system uses an RS485 bus for communication between the "personality module", the indoor control, the spa-side remote, and the IntelliFlow pump(s). There is also an adaptor called "iLink" which is a bridge between this protocol and an ASCII command set. You can do anything that is possible from the indoor controller, including reading the temperature and controlling heat setpoints, lights, variable speed jets, and accessories. Automogator can be used to bridge these functions to Indigo, allowing you to control everything from an iPhone control page.- CAT 2000 pool chemistry controller
This device is used to automatically control pool/spa chemistry by feeding the correct amounts of acid and chlorine, based on continuous feedback from pH and ORP sensors. The controller features an RS232 port which periodically outputs the pH and ORP measurements and the status of the feeders. This information can then be used for monitoring and graphing purposes, and to trigger a text message alert when the reading go outside an allowed range.
This is an example of a minimal component that only receives incoming data.
- Utility monitoring (incomplete)
This is still a work in progress, requiring some custom hardware. Although TED is a popular product for this purpose, I am interested in something that does much more. The plan is for a hardwired adaptor that can monitor not only electric usage (on any number of circuits) but also pulse outputs from water and gas meters. There is already pulse-output instrumentation available for many models of utility meters, although you are probably not allowed to modify yours if they are owned by the utility. However, you can install your own meter on your side of their meter. Electric is easier, only requiring a current transformer (donut shaped device) to be fitted around the hot conductors. More information about utility monitoring is coming soon...