Allow Myself to Introduce... Myself to Home Assistant

After deciding to leave SmartThings, I decided to first try out HomeAssistant (henceforth to be known as HA). HA is an open source project that has the reputation of being compatible with hundreds (if not thousands) of devices and eco-systems with a large and powerful set of plugins. It sounds great, but it also has the reputation of being difficult to configure due to its reliance on text based yaml files. You also have to provide the hardware for it to run on which means that you need to know something about "computers" before getting started. Undeterred by what seemed to be minor technical hurdles, I dived right in.

My first task was to get a Raspberry Pi on which to run Home Assistant. The new Raspberry Pi 4 seemed to provide plenty of power so I ordered one along with a case and power supply. Being a tinkerer, I didn't want to dedicate this entire Pi to HA so I opted to install Raspbian (the Pi operating System) rather than the Home Assistant Operating System. Instructions on the web are thorough and plentiful.  I expected to install Docker and run HA in a container which would allow me to run other software on the same machine in other Docker containers. My plan was solid but I should have read the manual first - more on this in a future post.

Once my Pi was up and running, I installed docker and built a docker-compose file for easier management of the HA container. I also installed an nginx reverse proxy container  to provide access to HA from the internet and terminate TLS connections so they would be more secure. I needed this external access because all my smart devices were still running on SmartThings. I wanted to use HA to control SmartThings until I was comfortable with it at which point I would move my devices over to HA. Sounds like a good plan, right? We'll see. It took a bit of tinkering to get this set up with LetsEncrypt  (a free SSL certificate provider) but eventually was up and running. You can find a guide that I found to be helpful here.

One thing to keep track of is the number of times I say "tinker". Getting to this point was hours of work, some of it incredible frustrating. However, it felt great once the HA container came up properly and presented the login interface. After logging in, connecting HA to SmartThings, and lots more tinkering,  I was able to see all my devices in the HA user interface.

I then removed one light switch and added it to my Home Assistant's Z-Wave configuration directly. I wanted to get a sense for what local control would feel like compared to the multi-hop cloud setup that my HA -> SmartThings Cloud -> Z-Wave produced. To do this, I plugged my Zooz Z-Wave USB stick into the Pi, modified my docker-compose file to recognize the stick and rebooted the Pi. One tricky step here was figuring out what the name of the serial device used by the Zooz stick was called. After running a number of linux commands, dmesg | grep tty  showed me that my only USB device was ttyACM0 which I would need to enter into HA. If there had been more than one, finding the correct name would be much more tricky (this is called foreshadowing). After HA came back up, it was easy to add the Z-Wave integration via the UI using the serial device name I found earlier. Removing my first-gen Inovelli switch from ST was a little bit annoying; pressing the "magic" button sequence yielded no visual cue on the device so I couldn't tell if I had done it correctly until SmartThings finally acknowledged that the switch had been removed. It's not easy to press a button exactly six times in rapid succession! (This issue would replay itself over and over as I later swapped all my devices over to HA.)

Finally, I added Node-RED, a graphic-based rules engine that is popular with HA users. I had to modify my docker-compose file again to add the new container, restart HA and then add the Node-RED Integration via the UI. I then had to create an HA user for Node-RED and configure NR to use it to access my HA installation. It wasn't difficult but took a while before Node-RED would "see" HA and provide autocomplete for device names.

At this point, I had a fully functioning Home Assistant running in Docker on a Raspberry Pi4 and exposed to the internet via Nginx using a LetsEncrypt certificate. I had Node-RED up and running and ready to automate. Next steps? See how the system performs and how easy (or difficult) it was to maintain.

Popular posts from this blog

Please, Please, Please Do Not Disturb!

A Beginner's Guide to Presence Detection

A Beginner's Guide to Smart Switches