Running Home Assistant on a Raspberry Pi

Home Assistant is now all set up and working at Kuamka HQ. It’s currently running in a Docker container on a Mac Mini - this isn’t ideal as it means the relatively power-hungry Mac needs to be on all the time and can’t sleep. It would be much better to run Home Assistant on something much smaller that uses almost no power, for instance a Raspberry Pi.

We ordered an 8 GB Raspberry Pi 4 - in retrospect this is probably overkill and the 2 GB version would have been fine. We also ordered a really nice case that will double as a heat sink, and the official Pi power adapter.

Installing Home Assistant on the Pi is very straightforward. Instead of using the standard Raspberry Pi OS and then running Home Assistant as a Docker container, we can instead use Hass.io. This is an integrated OS image available for many machines (including the Pi) that uses Docker to manage Home Assistant and other services with a nice UI. Transferring our Home Assistant config from the Mac Docker instance to the Pi was less straightforward. Hass.io has a built-in backup and restore system, however this isn’t available on the standalone Docker image. In the end, some manual copying and pasting of config files between the two was required to get it working.

Hass.io can do much more than just run Home Assistant. Now we have the Raspberry Pi set up as a server, we can run other services on it including:

  1. Unifi controller - we use Unifi access points for our network, we can now move the controller software off the Mac and into a Docker image running on the Pi (managed completely by Hass.io)
  2. DuckDNS - this allows us to access Home Assistant from outside our home network, using Lets Encrypt to generate SSL certificates so we get a secure connection
  3. NGINX reverse proxy - this uses NGINX to proxy the connection to Home Assistant for additional security (NGINX is a hardened web server)

Now we can access Home Assistant securely from anywhere using a phone, and also manage our Unifi network.

Home Assistant running on Android