This is something I had put off for a while. I won’t go into what Docker is or why it’s awesome, that’s an easy Google.
I moved to Docker so I could more easily add new programs to my Home Automation setup. In particular, I wanted to try out Zwave2Mqtt. And after realizing that I’d need to not only install the program, but also the Open-Zwave library.. which could only be done by downloading the source, compiling, and adding some paths to an environmental variable…
All that is completely possible, but it’s a lot of moving pieces. If I needed to update that library, I’d have to get the source and compile again. It’s just a very manual process.
Add that on top of updating the Zwave2Mqtt program itself, which has its own process. And that’s on top of every other piece of my HA setup, which are installed in various places across the system. It was just a lot of manual work, and I was getting tired of it.
Moving to Docker would simplify a lot of that. Each program lives in its own container and the container has everything it needs to run. To update, just get a newer version of the container.
I’m also going to use
docker-compose, which will allow me to define the configuration of many Docker containers, and bring them all up and down together.
Implementing this wasn’t too bad. There were definitely some snags and some learning that had to be done, but no major issues. See my post on getting PicoTTS installed.
I started with Zwave2Mqtt, and carefully moved each other HA piece to a container. This mostly involved stopping the existing service, and adding more lines to my
docker-compose.yml file, and tweaking it for my particular environment (and figuring out why the container didn’t start, or why it couln’t access some other container).
There’s not much to show you. Here’s my
docker-compose.yml file that I’m using.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ffffffffffff homeassistant-maxmods:latest "/init" 3 weeks ago Up 3 hours (healthy) homeassistant
ffffffffffff carldebilly/zigbee2mqttassistant "dotnet Zigbee2MqttA…" 3 weeks ago Up 3 hours 0.0.0.0:8092->80/tcp zigbee2mqttAssistant
ffffffffffff mariadb "docker-entrypoint.s…" 3 weeks ago Up 3 hours 0.0.0.0:3306->3306/tcp mariadb
ffffffffffff robertslando/zwave2mqtt:latest "docker-entrypoint.s…" 3 weeks ago Up 3 hours (healthy) 0.0.0.0:8091->8091/tcp zwave2mqtt
ffffffffffff koenkk/zigbee2mqtt "./run.sh" 3 weeks ago Up 3 hours zigbee2mqtt
The real advantage is how easily I can add and update my programs. All the dependency resolution and environment setup is handled by Docker (in the images). All I have to do is add new containers and configure them in my
This is best demonstrated with how I set up Zwave2Mqtt. All I had to do was add the
docker-compose lines, adjust the path to my USB Zwave stick, and then start the container. That’s it. Brand new application to do something new, set up just like that.
In a similar vein, after seeing Zwave2Mqtt’s nice web interface, I really wanted something similar for zigbee2mqtt. Turns out somebody already made one, Zigbee2Mqtt Assistant. Installation was literally just adding some lines to my
docker-compose file. Start the container you can access the web interface.
I’m really happy with how this turned out. My Home Automation stack is much simpler to set up and manage, and future growth will be much easier (NodeRED, I see you).