New Project! Home automation
(This is part 1 of my home automation blog series. See the automation category for the whole set)
Okay, okay, I said I’d blog more frequently and now it’s been over a year. Yikes, sorry, and other generic excuses. However, I do have a more exciting line of blog articles coming up! You see, I’ve been getting into home automation…
I’ve been looking into open source approaches to home automation, and to some of the tooling that can be used to handle parts of the house infrastructure. OpenHAB appear to be the standard, and I was excited to see that it support Nest. But that got me thinking… Nest itself is a closed platform, and has questionable requirements such as internet access. Why exactly does my thermostat need a ‘net connection? That way lies madness.
So, my first project is identified! Get an open source thermostat which is under my control, and control it with OpenHAB. Game on! Initially, my thoughts turned to the ever-present RaspberryPi… surely I could build a system using the GPIO pins that could switch the relays on the boiler? My Google-fu kicked in, and I started searching…
Enter HestiaPi Classic
Well, imagine my surprise (or lack of it, this is the internet…) when I discovered that my exact project idea had already been done. HestiaPi Classic is exactly what I was going to try and build, and in a lovely case to boot (NB the HestiaPi Touch was not released when I bought my Classic). An easy impulse purchase for my post-Christmas cash, and the folks at HestiaPi had it in my hands rapidly. Lovely.
So, now I had a lovely new open source thermostat, with a web interface and everything… but HestiaPi Classic only has a single on-board temperature sensor - which is now right next to the boiler. What I really wanted was to integrate this into OpenHab so that I could use more temperature sensors to monitor house conditions, and trigger heating changes as needed. Time to get my hands dirty…
In order to control HestiaPi Classic from OpenHab, I was going to need some way to interface with it, and there’s really two options. The first is write a HTTP binding that teaches OpenHab the exact API calls it can make to HestiaPi Classic to change things. That has limitations however, so the other option is Message Queue Telemetry Transport (MQTT), also known as the “Twitter-of-things”.
MQTT is a straightforward pub/sub system - a broker runs on the network somewhere, and clients connect to it. Clients can publish messages to topics (channels, effectively), and can subscribe to topics to receive messages. Since messages can (optionally) be queued for later delivery, this is ideal for low power devices such as sensors, which can stay in a low-power state for a while, then wake up, connect WiFi, check for new messages and publish their own, and then power down again.
MQTT is a perfect fit for my project, since OpenHab already has an MQTT binding we can use - we just need a small app on HestiaPi Classic to handle the MQTT stuff… and happily, I’ve already written it…
This has just been a general introduction to my aims for OpenHab, HestiaPi Classic and MQTT. In the next post, I’ll show you how to get MQTT working on HestiaPi Classic, and then in part 3 we’ll look at the OpenHab configuration. Stay tuned!