Linux Home Automation

Neil Cherry

My first home automation (HA) project included an Atari 800XL, a Heathkit X10 interface, and the “Build the Home Run Control System” article series from Steve Ciarcia’s Circuit Cellar column (BYTE, 1985). I was forever hooked on HA. Eventually, I built Circuit Cellar’s HCS II (Circuit Cellar Ink, 1992). I still provide support for it at The Open Source HCS Project (http://hcs.sf.net.).

One day, while reading the Usenet comp.os.minix newsgroup, I saw a post about Linux, a Unix-like operating system (OS) for the Intel Inboard 386-AT. A short time later, I picked up a used Compaq 386SX PC, loaded Linux on it, and I had a multitasking, multiuser OS on my home computer. I wrote some software, connected my HA interface, and started a webpage with all the information. I eventually became the librarian of all things Linux and HA. Since then,  Linux has been ported to several different systems from small, yet powerful, Raspberry Pis (RPis) to IBM mainframes, and from bare-bones systems to every service, tool, and language imaginable. And, at the base of everything, is a common interface and toolset. While a distribution may put things together a bit differently, at the heart of the system, the tools and interfaces are the same.

Currently, I have several Linux systems in my home including laptops, Wi-Fi routers, network storage, media players, and servers. I also have one Windows computer for testing and support, but I mainly run an X server on it to access my Linux resources. And, of course, I have my HA system, my main Linux server, and MisterHouse (MH), an open-source HA program written in Perl (http://misterhouse.sf.net). In addition to my Linux resources, I have a mix of X10, INSTEON, Z-Wave, ZigBee, 1-Wire, web-based controllers, serial, USB, and Ethernet I/O. My home is more like a lab, but my wife has strict rules: It must work and must look professional. The web-based controllers and the HCS II can operate as a stand-alone system, but they lack certain features I want. Most of the components are tied together by Linux and MH, which supply the missing features. The rest of the components are controlled by programs and scripts, which have been added to cron or run as Unix services. The Linux and MH environments enable me to easily pull together disparate technologies and seamlessly combine them.

MH has been my main HA program since 2000. Its flexibility has made it an extremely useful program. In addition to using Perl for the main code and device interface, I also use Perl for user code. The Wiki site includes examples and a mail to help new users. I’m currently integrating the web-based controllers into MH. I’m surprised at how easy this has been. Some have mistaken MH for dead due to project administrative problems. However, the community seems to have fixed that and has been quite busy updating everything. Version 2.200 became available on March 2.

In addition to MH, my main Linux server also runs my home’s dynamic host configuration protocol (DHCP), which supports Internet Protocol version 4 (IPv4) and IPv6 and a local domain name system (DNS). My Linux server also includes print, file, media sharing, revision control, my development system, syslog, Network Time Protocol (NTP), web server, and other standard Unix services. A 2001 1-GHz Advanced Micro Devices Athlon microprocessor with 512 MB RAM and a 1-TB hard drive (soon to migrated to a RPi) manages the system. The only limitation is that I may need more I/O ports. My MH system has 12 serial ports, so I need to resolve that. I say this to illustrate that Linux can be light on resources when a complex set of services is required.

To take advantage of today’s newer software technologies, I’ve begun looking at HTML5, Scalable Vector Graphics (SVG), JavaScript Object Notation (JSON), and Asynchronous JavaScript and XML (AJAX) for use with MH. Adding AJAX extends the user experience. No more refreshing the page (polling) every 60 s. Instead, the client-side JavaScript code enables us to push the data to the client’s browser and update the webpage as the events occur.

A more recent technology, node.js, which is event-driven, server-side JavaScript, enables you to create new web services with little effort. I believe it can be used to provide the glue between services and MH. For example, I could use a RPi, node.js, and my sprinkler controller. While Linux and the RPi are definitely overkill, the speed at which I can write the code and develop the services combined with the total cost (in time and money) make this attractive.

Future plans include refactoring MH. Fifteen years of cruft need thinning and, amazingly, it hasn’t affected MH’s performance. A bit more object-oriented programming (OOP) would be nice, as it makes it easier to handle complex things. Additionally, I’d like to add many of the lessons learned using HCS II. A simple user language would be a great help to users (it’s not always about the developer).

Neil Cherry (ncherry@linuxha.com) is a Professional Technical Architect at AT&T. He has been active in computers since 1978. Neil has a degree in Computer Science and Electrical Engineering Technologies and has maintained the Linux Home Automation pages since 1995. Neil has been active in home automation with Unix since 1988, and has been using Linux since 1992.

2 thoughts on “Linux Home Automation

    • I do understand and we’re hoping to see more interoperability with the various HA hardware that is available. Many of the DIY projects are DIY friendly (flexible but user confusing). There are a few projects other projects that have just come out and I’m hoping to get some time to spend on them. Hopefully the document will be user friendly.

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA Image

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>