Installing in a virtual machine

For quite some time I’ve been playing around and testing home assistant thoroughly. I’ve been running it as a docker container as well as its embeded flavor on a raspberry pi. Each method has its ups and downs and it has become time to decide which way to use for production.

Rasppi 3 vs virtual machine

The raspberry pi v3 seems to be the ideal device for home automation. It’s cheap, resonably fast and doesn’t consume a lot of power. For a few devices and automations this is definitely true. However, the more devices, automations, scripts and addons you add to your setup the slower everything will become. While this might be not so bad for the web ui, it certainly doesn’t add to the comfort (and the wife acceptance factor) when lights do turn on and off with a noticable delay. The virtual machine on my home server has a lot more power of course. Adding zwave and bliuetooth capabilities is a bit difficult as the hardware needs to be shared from the host to the virtual machine and further to the docker container. As my server machine is existing and running there is no financial or energy impact from this solution.

Home Assistant vs

Basically isn’t anything else than home assistant running on docker. But different from a classical docker install it also provides a basic host system running docker on a raspberry. And more importantly allows installing and controlling other docker containers as addons to provide additional functionality. Of course these services can also be provided as classic docker containers (and tied together in a docker-compose). But adding services from inside home assistant is a lot more convenient and also easier to configure and maintain.

Installing in a virtual machine

Combining the advantages of aproaches would be ideal to. And furtunately it is possible to install in a virtual machine. This solution does only have one little drawback: presence detection using bluetooth low energy is not possible. I already had a docker host up and running so there wasn’t much left to do. First I’ve installed some dependecies for as mentioned in the install script:

sudo apt-get install jq curl dbus socat bash avahi-daemon
sudo apt-get install apt-transport-https ca-certificates wget software-properties-common 

Some of these packages had already been installed.

To install hassio itself (i.e. homeassistant and a supervisor container) download the installer and run it using the correct machine type: Installing hassio:

curl -sL | bash -s -- -m qemux86-64

Due to my setup of docker I had to download the file first, remove the check for avahi and then run the install script manually.

The web interface is now accesible at <HOSTIP>:8123 and your homeassistant is (more or less) ready for configuration.

Installing ssh addon

Although is ready to run it makes sense to add at least an SSH addon so you can easily access the instance and your config files. Installation is pretty easy, go to > Add-on Store and choose the SSH server addon. After installation you’ll need to configure it. I’ve added my ssh public key to the list and changed the port to 222 before starting the addon. Changing the port still allowss me to ssh into the virtual machine on port 22. To make login easier, I’ve added a host entry to the ssh config file on my laptop:

Host hassio
	HostName <HOSTIP>
	User root
	Port 222
	IdentityFile ~/.ssh/<NAME_OF_PRIVATE_KEY>

This enables me to use the shortcode

ssh hassio

to log into the instance

Windows users might prefer to install the samba addon to access the config files on a network share. You could also use the configurato addon for online editing.

Leave a Reply

Your email address will not be published.