In my previous article Why automating my home?, I explained what brought me in the home automation world. Before getting into more details in future articles, I wanted to share my current stack to show you an example of what to except.

To be clear, when I’m referring to a stack, I mean a set of softwares working together to achieve what I need to do. You can find some all in one (AIO) solutions, but they might be more limited depending on your situation.


All the tools and applications I’ll mention in this article are running containerized in my Kubernetes cluster. This way I can easily share / reproduce and backup my stack, and Kubernetes will make sure it’s always running properly for me.

If you want more information, you can check my series about Kubernetes where I’ll post more detailed articles.


Before starting, here is a simplified reference diagram to summarize my setup:

Zigbee

As I mentioned in my previous IoT article, I chose Zigbee as the main protocol to communicate with my IoT devices around the house. Other exists like Z-Wave, EnOcean or even basic RF, but looking at products availability, prices and compatibility, I felt like Zigbee was the right choice for my situation.

1. The Zigbee dongle

In order to communicate using Zigbee, you’ll need a device doing the radio communication - usually a USB dongle, and some devices you can talk to.

I started my Zigbee journey with a cheap CC2531 dongle (the name of the chip taking care of the actual Zigbee communication). This device is perfect for starting and you can buy it for less then CAD 10. It will easily work with a dozen of devices, maybe even more.

Later, as I bought more Zigbee devices, this dongle became less stable, crashing or getting slower adding new devices. I switched to the well known SONOFF Zigbee USB Dongle you can find on Amazon for about CAD 30.

You can find many other USB dongles online, but you should read some reviews and make sure it is compatible with your software stack.

2. The software driver

You can find a couple of softwares to connect your Zigbee devices to other application, for example Zigbee2MQTT, ZHA or deCONZ for some devices.

I started with Zigbee2MQTT and never really had issues with it, it has regular updates adding new devices and if you ever come up with a fancy custom device, it is fairly easy to add support until it makes its way to an official release. I didn’t really try the other products, but I know ZHA is very well integrated in Home Assistant.

Technically, Zigbee2MQTT is a translation layer, exposing all communication with your Zigbee devices as MQTT messages. It comes with a nice web interface and good integration with Home Assistant. If you prefer using other applications, you just need it to work with MQTT and everything should work just fine.

To perform the install manually, you’ll need a separate MQTT server to handle the messages. I’m using Mosquitto as they provide an easy to use, no configuration and stateless container for my cluster.

Zigbee2MQTT showing a mesh network of Zigbee devices

Home Assistant

Great, we have the physical and driver part sorted out, now let’s focus on the actual Home Automation part!

As mentioned previously, I have tried multiple Home Automation software but I decided to stick with Home Assistant, being very well supported by the community with regular updates and MANY plugins to do pretty much everything you want.

It is a very complete solution, offering device communication, human interface with customizable dashboards and even automation with basic scripting. The solution is very interesting by itself, but may lack some advanced automation capabilities if you want to create more complex scenarios.

I personally see Home Assistant as a very good and comprehensive abstraction layer for all my devices. It provides integrations with many brands, physical devices and cloud services, and abstract them behind well defined interfaces. Once connected, you don’t need to know if your devices are connected to the cloud or using Wi-Fi, local or remote any more. All this abstraction is available through an API accessible by HTTP calls or WebSockets, allowing integration of more tools and automation from other softwares 🙂

The Home Assistant dashboard I use at home

Node-RED

With a dongle to connect your devices and Home Assistant to abstract them and to provide a easy to use dashboard, let’s now focus on the automation part.

As mentioned, Home Assistant provides a way to create simple scripts and automations. For more complex scenarios, you can use the official Home Assistant HTTP API to manually develop your own autoamtion, but if you prefer an easy to use UI to quickly iterate and debug your “scripts”, Node-RED is the way to go.


Node-RED is a node-based event-driven automation engine with a plugin for deep Home Assistant integration. You can easily automate actions on any device and reactions to any event with an easy to use interface.

Here are some working examples:

It might take some time to get used to, but it is relatively easy to use and a very good way to start programming in general.


At the time of writing this article, I’ve used Node-RED and its Home Assistant integration for more than 2 years without any issue. You can create virtual devices, sensors or have HTTP webhooks to integrate with other tools if needed.

Here are some examples of automatically I implemented in my system:


Conclusion

To me, those are the 3 main components you need to create your own Home Automation stack, wether you are a hobbyist or an expert creating crazy complex automations.

If you’re new to this, setting up everything to work together might not be the easiest task but I think it’s definitely worth it. Luckily, Home Assistant provides multiple installation paths, whether you have a computer and you want to install it directly, or you want to install everything manually.

If you prefer, they also provide an all-in-one kit, Home Assistant Yellow with an integrated Zigbee module.

There are many tutorials out there to cover the well know installation paths, but I’ll focus my future technical articles on the way to integrate evertyhing on a Kubernetes cluster as I personally think it offers many great advantages.


Additional setup

I added some additional components in my setup to accomodate some specific needs. Here is a short list for reference if you face a similar situation.


USBIP - A solution to plug a USB device on one device and use it from another device connected to the same network. I use it to extend my IoT network using a Zigbee dongle from an outbuilding of my house while keeping all the processing on my main server.


Frigate - A very nice home NVR solution. It can connect to multiple video feeds and handles motion detection, AI-based object recognition and video recording from a simple web interface. There are many free NVR solutions out there, but many of them are not well supported or lacks features. Frigate definitely brings some fresh air in home NVR space. I plan on writing a dedicated article on this topic.


ESPEasy / ESPHome - If you like to build everything yourself, you can use components like ESP8266, ESP32 or RPI2040 controllers. They are very inexpensive, and you can find some great free firmwares / softwares. ESPEasy is one of them, offering a web interface to configure everything and many components to interact with many other devices and services. ESPHome is a project from the creators of Home Assistant, allowing you to build a custom firmware based on your needs from a simple YAML file. I used both solutions personally, I’ll try to cover them in future articles.