Monday, December 24, 2012

Belphanior Home Automation System


I've been playing around with home automation as a hobby for quite a long time now. One thing I found frustrating was the lack of flexibility in the central controllers I've worked with. To that end, I'm pleased to introduce Belphanior, my own automation-oriented remote signalling and scripting system.

Belphanior is intended for a standard household setup (multiple computers and automaed systems behind a local intranet). Key to its design is a multi-process approach; the core of Belphanior is a communications protocol built atop HTTP and JSON, which allows a single "butler" process to coordinate and control multiple "servant" processes. This allows you to run the servants locally on the machines with the hardware that needs to be controlled. It's also designed to be self-documenting; "roles" (specific types of tasks servants can perform) are first and foremost human-readable, with the details of implementation left up to the creators of the servants. So an "output" role can be handled by a text-to-speech servant, a logger, a marquee-display controller, etc.

Belphanior's jumping-off point is at belphanior.net. There, you'll find a "getting started" guide and a list of the currently-implemented servants. Servants and the butler are available as open source under the MIT license, so if you wish to create your own, you are free to do so (and if you'd like to provide me a link to them, I'd be happy to post them on belphanior.net!).

A short list of things I've used Belphanior to do:

  • Turn the main lights off in the house at the end of the day (I'm terrible about leaving basement lights on when I go to bed).
  • Control Christmas tree lights and other seasonal home decorations to save power.
  • Drive the train under the Christmas tree every two hours (see "Making the Train Run On Time").
I'll be continuing to extend Belphanior and the home automation system as I go, and I'll be updating this blog with any fun developments.

Have fun, and happy hacking!

Thursday, December 20, 2012

Ten-minute Hack: Temporary Remote View

This one may not even require a whole ten minutes. I considered refraining from posting about it, but I've found it so useful in so many circumstances that I felt the need to share it.

While doing home automation work, I frequently find myself needing to control a process from one floor while observing it on another floor, or needing to observe events on multiple floors at once. For instance, I have a command that switches off all the lights in the house; I need to observe the basement and first floor simultaneously to verify it's worked. That's quite a bit of dashing up and down the stairs.

If you have two computers with embedded cameras (smartphone and desktop PC, laptop and tablet, smartphone and tablet), it's ridiculously simple these days to set up a simple video chat to remotely observe another room in the house. My tool of choice is Google+ Hangouts, but other applications with clients on all of your computers of choice would work just as well.

To set this up in Hangouts, all you need to do is start a hangout with nobody (I have an empty circle named "Nobody" for this purpose). Once the hangout is established on your first device, use the Google+ client on your second device and select your profile. You will see an entry for "hangout with 1 person." Join that hangout, and your two devices will be video-linked (you can add more if you so choose).

It's a pretty straightforward trick, but it's convenient if you have spare devices sitting around the home. In addition to using it to monitor home automation clients on different floors, I've used it to monitor a kitchen timer while I worked in a room too far from the kitchen to hear it (world's most expensive baby monitor, but I have a laptop and smartphone and no baby, so there you go!).

I hope you find this useful! Happy holidays.

Saturday, December 15, 2012

Making The Train Run On Time

I have a few INSTEON modules and a 2412N controller. I've been experimenting with home automation for awhile, and this year I thought I'd do something fun.

I unpacked the model train that goes under our family tree and connected the power box to an INSTEON lamp module. Using Belphanior, my not-quite-yet-fully-released home automation core, I wrote a short script that drives the train for a few seconds (timing is a little sloppy, as it takes several seconds for the 2412N to respond to HTTP requests from the 2412n servant, but it does the job).

"cycle train" script
"cycle train" script

With the script written, all I had to do was fire it every two hours. Fortunately, there is a Belphanior servant that can monitor an iCal-formatted calendar and notify the butler to run scripts in response to calendar events. I pulled up a Google Calendar that I keep for this purpose and populated it with a cycle of the train every two hours (except at night, to save power).

Belphanior calendar, showing "cycle train" command
Belphanior calendar, showing "cycle train" command


The result is shown below. I'm pretty satisfied with it; simple, but effective!