Letting a Computer Assist My Home

Smart homes are all the rage nowadays. But I’ve really only stayed with the basics, some smart light bulbs, a smart clock with environmental sensors, and an internet connected air purifier. One issue though, is the fact that these things has their own separate apps. And that is where Home Assistant comes into play.
Despite it being released 11 years ago and watching a bunch of Youtube videos talking about home automation using Home Assistant. I’ve just never gotten around to setting it up and actually trying it out. But that changed just a few weeks ago when I decided to look into ESPHome, a really cool tool/framework that allows you to build custom firmware for building your own IoT device on espressif MCUs. But first, I of course needed to install Home Assistant.
Setting Things Up
Home Assistant is not just an application you can run, you have two options: Home Assistant Container and Home Assistant OS. Home Assistant Container would be simpler to deploy, but it lacks support for one important feature: Add-ons, which are based on containers itself. So of course, I went for Home Assistant OS.
My Home “Server” setup is just my PC that I leave running 24/7, it has all kinds of services running mostly in Docker. So to run Home Assistant I just setup a VirtualBox VM with the provided Home Assistant OS VDI Image. This turned out to be a huge mistake, using Hyper-V might’ve been the better option, I’ll talk about this later.
Setting up Home Assistant itself was very simple, I created a VM with it and set its networking to bridge with my physical network. After starting it, the VM just boots straight into Home Assistant OS and shows up on port 8123 for you to setup a new account. After I logged into my Home Assistant instance, I immediately went looking for the ESPHome addon.
Getting started with ESPHome is surprisingly extremely easy. I just had a random ESP32-S2 board laying around that I soldered some pins to connect my Neopixel strip onto. Now here is where I ran into my first issue. Normally you should be able to flash your ESP using WebSerial in the browser directly. But because I’m still connected by insecure HTTP, it seems that WebSerial isn’t available and caused weird issues. So I had to download the firmware image and flash it myself, luckily there are web versions of the ESPTool online, so I just used esptool-js to flash the image. As soon as I reset the board, it connects to my network and showed up as online in the ESPHome dashboard.
ESPHome is a low code platform, you can do most basic things without writing a single line of code. Even more complex features can be written with minimal code. In order to get started with my Neopixels, I just created a light component and configured it to my Neopixel pin.

And just like that, we can wirelessly flash the code to the ESP board and after adding the new ESPHome device to Home Assistant I have a smart controllable Neopixel strip.
Now understand why people loves Home Assistant so much.
The simplicity of everything was amazing, it was so quick to get this smart light setup. But now things start to become a bit of a mess. Using Home Assistant on a VM was starting to backfire and using a very old esp8266 on a DIY board was making this a huge mess.
After this I noticed more and more instability. Like Home Assistant not booting up properly after a host restart (Thanks Windows Update!) and also Home Assistant randomly failing to connect to my physical network. That combined with my unstable DIY boards makes my lights randomly turn off or disconnect.
In the end I decided move the Home Assistant instance to a random mini PC that I just have running doing nothing. This was easier said than done, because Home Assistant does not have a bootable installer, they only provide images of a preinstalled Home Assistant instance. So what I had to do was boot up a Live Ubuntu installer, this was a huge pain because this mini PC is so old that it struggles to run the desktop (I probably should have used something lighter). But anyways I downloaded the Home Assistant OS x86 disk image and wrote it to the main disk of the mini PC and it booted up Home Assistant.
In order to move the instance, I had to create a backup in my Home Assistant VM and then upload it to the new instance which will restore the backup. This was surprisingly easy and *it just worked*.
| Posted in English, Personal Projects | No Comments »