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.
Resources
- Relays in the switchboards
- DIN rail mounts for the relays
- Mosquitto MQTT broker
- OpenHAB home automation software
- Node-RED visual programming system
- Fantastic guide by forum member @aspork42, with extra resources and a cost calculator if you want to build something like this yourself: Light Switches – How Jon does it
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
I have figured out the Switch Controller end of the MQTT stuff. Man, these videos are inspiring!
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.
Hi Jon,
I’ve been wathcing a number of your episdoes on your site. I’m completing a whole house renovations and am keen to follow your HA example.
Quick question on this video: Would/could you replace the S4190D relays with Sonoff Basic relays? (with provision of external switching from GPIO14 as explained in episode #21 Sonoff Secrets)?
Thanks for the series. What relays did you use in your power sub-panels (the link is broken)?
Hi there.
I stumble on your videos and have been stuck watching them since, I´m rebuilding my house and small electric and programming have been my interest for a while. But I´m mechanic for a living.
One question from this video? What if the thief turns off the main switch.
In my country the cable comes up inside the house and into the main table.
I wanna thank you for your effort on those videos. They are really helpful. I´ll probably go all the way and create my own simple board when I have the knowledge to do so.
Sincerly Eirikur
Awesome Jonathan! Thanks for pointing me to this video. I learned so much from it.
I already have a Pi Zero that I bought when I first thought of doing this stuff. I figured it was enough to be the central element for my home smarts, but knew roughly a fifth of fuggall what to do with it. Now I know exactly what to do with it, & also have much clearer ideas for the architecture of my systems.
Ho Jon,
Can you please share your latest software which you are running on your relay controller, you have the old one on github (https://github.com/SuperHouse/OutputControllerRelay8x2), but it is configured with WEB interface. Or maybe it’s a good Idea for one of your next videos.
Thank you.