homA is a framework for building “smart homes” and adding automation to devices and software components. homA was created by Alexander Rust and Stephan Wypler who recently released the source code to the project. I’ve been waiting for that to happen for a while, and what with my love for “blinkenlights”, quickly peeked at what it has to offer.

homA architecture

homA consists of various independent components, some hardware, others software, which can easily be added to the system by connecting them to an MQTT broker. Individual devices are located in so-called “rooms”, and each device has one or more “controls” (currently: either a switch, a range slider, or static text).

Toggling a switch publishes a status (1 or 0) to the MQTT broker. A device (a lamp, for example), does something (i.e. turns it on or off respectively), and publishes its current status back to the broker, so that all subscribers can follow what state a device is in.

homA always uses retained messages, i.e. instructs the MQTT broker to store the last known value for a particular topic. This enables a “cold start” of the system with all components “booting” to their respective on or off state.

The homA Web interface talks to a Websocket server, which corresponds with the MQTT broker. It is snappy, and reacts immediately to status changes on the message bus.

homA Web interface

homA also has an Android app available via the Play store, which shows individual rooms (swipe left/right) and the devices available in those rooms. If I tap on a device, I see its controls.

Android app

Most of homA’s examples are in Node.js, but I feel more comfortable with Python, so I created a small program called lamp.py which creates or removes a file depending on the last toggle of one of the switches for the appropriate control. This could easily launch (or kill) a program, etc.

Here is an example from homA’s demo program, showing three different controls on a device. First the Android app, then the Web interface:

homA android demo

homA demo Web

What I now need, are little devices which “talk” MQTT. Lots of them. And what I would like, is a sexy-looking homA app for iOS. :-)

If you’re interested in homA, you may also want to join the homA community on G+.

MQTT and Automation :: 04 Jun 2013 :: e-mail