Introducing HA-Pen

In a previous post I wrote about my search for a cheaper home automation solution, where I explained how I used a Raspberry Pi and a cheap 433Mhz transmitter to control some RF sockets. I mentioned in that article how I was spurred to try again after reading about using the Pi-mote from a company called Energenie.

I wasn’t convinced I could get my simple transmitter working so, for the princely sum of £19.99, I ordered a Pi-mote starter kit as a backup. The kit comes with the Pi-mote (which you can buy separately) and a pair of RF sockets (which, again, you can buy separately).

Using the documentation on the Energenie site, and leaning on the work of the Pi Foundation’s Amy Mather, I was able to knock up a bit of Python to allow you to switch sockets on and off using the command line.

My existing home automation solution used a Telldus TellStick with a PHP web interface, which simply called a command line tool to toggle sockets on and off.

For reasons that are now lost to me, I decided to re-write that setup in Python, switch over to using the Pi-mote and integrate the calls into the app itself. I also improved the interface so you no longer needed to edit tables to add timers or sockets, moving everything into JSON config files for ease of reading and to lighten the overhead. It proved to be quite a journey, but finally HA-Pen was born.

HA-Pen web interface

The main interface of HA-Pen

The Rundown

The interface is a set of web pages pulling and pushing data into the JSON files. It’ll let you add as many sockets as you need, set timers for each socket and even allows you to use sunrise and sunset as triggers (which it’ll work out daily for you).

You can find out more about it, plus download the code, at the Github repository. I have also written some fairly extensive documentation that you can find on Read the Docs.

While it probably needs some polish, and I’ve already had least one additional feature request, it’s been running my home setup for a few months without issue. A modified version using my old Telldus stick has been running at my mum’s house for about as long. So it seems to be reliable.