Posted on

#24: Home automation system architecture

I’ve been lucky enough to have worked with an electrician to totally rewire my house for home automation, so it works in a very different way to a normal house. This episode traces through how power arrives at my house, is distributed to a pair of sub-switchboards, and from there goes out to loads such as lights. It also covers the important pieces of the system including MQTT and OpenHAB.

General information about MQTT is available at the official MQTT site. The site doesn’t get many updates because the protocol standard itself is fairly stable and well established, but it’s a good reference site with links to many MQTT-related projects. See mqtt.org.

There are many MQTT broker implementations available, written in various programming languages and with different features and levels of performance. I use Mosquitto, which has been around for many years and has never let me down. Note that your MQTT clients won’t care what broker you use or what language it’s written in, provided it supports the features they need. Mosquitto is written in Java, but I typically connect to it from Arduino-based devices. See mosquitto.org.

OpenHAB is currently the main rules engine that I use, which also takes care of state management and provides an app for iOS and Android. I’m still running the v1.x release series, but v2 is out now which is a major rewrite. See openhab.org.

For a general purpose rules engine that communicates using MQTT, check out Node-RED. With a drag-and-drop editor based on Node.js, you can create rules right in your browser. I don’t currently use this, but I’ll probably replace my current home-brew rules engine with Node-RED some time in the future. See nodered.org.

3 thoughts on “#24: Home automation system architecture

  1. Thank you for a series of completely inspirational videos. They have really cleared up the way forward for me. I’ve been dabbling with all sorts of off the shelf items for a few years, but this is the way to go. I have have poked a bony finger at Raspberry PI and Arduino for years but never managed to actually do something useful with them. I do run Openhab (fairly recently).
    Now, I have two questions:
    1) How do you do the MQTT stuff on the Arduino? I see it in the video, but I can’t see anything on the site, ie links to code or explanation of how it connects together. I get how it works in theory, just seem to have a mental jam on putting it into practise.
    2) Why do you need your custom rules engine or NodeRed AND Openhab? Could it not all be done in OpenHab?
    thanks again for being inspiring. (Looking forward to the updated workshop tour).
    Gavin

  2. I have figured out the Switch Controller end of the MQTT stuff. Man, these videos are inspiring!

  3. I’ve been thinking about your setup. I really love it but most people cannot or will not want to rewire their entire house in order to do home automation. Also if I wanted to sell the house in the future it would complicate things or more than likely I’d just have to rewire the house back to normal. So I figure there could be some compromises that can be made to get close to your setup. One of the first things that came to mind was the ability to move from a central relay system to a distributed relay configuration. So if you take your light switch and short the two cables together in the light switch box then it essentially forces the light to be powered all the time. Then use light bulbs that are intelligent (and will work when the internet is out) such as hue or lifx. From that point the rest of your configuration will work like you have it configured. I know you have an aversion to wireless so you may prefer smart switches like Insteon or zwave. I have just been finding them more of a pain than its worth lately as most require the 3rd common wire which many houses don’t have. I’m interested in your thoughts on the matter.

Leave a Reply

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