Let’s admit something, we humans are really lazy, but computer scientists are even more so. That’s why we try to automate as much as possible, sometimes too much. A very common phrase is:
If you do something more than twice, automate so you don’t have to do it a third time.
We can extrapolate this phrase to our home. How many times have we forgotten a light on? How many times have we lost the remote control? What if we leave the house for a few days and we get robbed?
Disponible en español aquí.
Solving all these “problems” is more accessible today than ever, but if we start buying “gadgets”, we would find a mobile full of third-party applications, and many services in danger of being spied on or that at some point stop providing that service, and with no interconnection between all systems.
Home Assistant is a home automation management software for our home capable of integrating a large number of devices and services, both from third parties and our own. The best thing is that, although slowly evolving, it is a very lively open source software, with a huge community, powerful and with a very good learning curve.
You can try a DEMO here
Being a software developed in python is compatible with a multitude of operating systems and devices. It is distributed in different ways to delight beginner and more advanced users.
Hass.io vs. Home Assistant vs. Docker
Before we go into matter and since this is usually quite complex. Let’s distinguish the most common ways to run Home Assistant.
Hass.io is a Linux distribution optimized to run Home Assistant on Docker. That is, a custom distribution has been created so that everything is ready to install and run. As an advantage, it is simple and has a very powerful Add-ons system. As a disadvantage, we do not have real access to the operating system running the Hass.io container. This is the installation option we will see in this post.
Home Assistant as we have mentioned is a software and as such, can be installed in any Linux distribution (even if you dare in Windows), the normal thing is to install a simple Linux distribution, like Hassbian for Raspberry Pi for example, and then Home Assistant as “application”, having all the power and control.
Docker is the most advantageous option for some, but also the most advanced. It consists of creating a Docker container with Home Assistant, so that we have total control, and at the same time isolated from any Home Assistant with the advantages that this entails.
Despite all these differences, you can then combine, for example, install Home Assistant with Docker and put Hass.io on top.
As we have mentioned, let’s see how to install Hass.io, the reason, has the simplest and fastest installation. You can try Home Assistant after a few minutes and as we learn, move on to the other systems.
The recommended way to start, given the quality-price, is to use a Raspberry Pi 3 B+ with a MicroSD of at least 32Gb. Of course, you can use a wide variety of hardware, but I think this is one of the best options.
Download the latest Hass.io image for your device. At the time of writing this article, Hass.io 2.12 for Raspberry Pi 3 B / B+ 32bit.
Download and install on your computer a SD card image burner software. I like balenaEtcher.
Burns the image on the SD card. To do this, simply open the previously installed program, insert the SD card into the reader, select the downloaded image in step 1 and click Flash. Do not remove the card yet.
Optional, but that I strongly recommend is to create a file to configure the network connection of the device, is a somewhat complicated step, let’s go in parts.
My personal recommendation is to assign a static IP to our Raspberry Pi. Although IPs can be reserved in the Router, I think a better option is to create a range of dynamic IPs (DCHP) from a high number of devices, for example,
192.168.1.128-255, so that all IPs less than 128 can be used for devices with static IP. All this by connecting a Ethernet cable between the server device and the Router.
Open the directory of the newly created SD card and create the directories
network. Finally, the file
my-networkinside this last one, without extension. This will leave
Edit the file
my-networkand include the following code:
[connection] id=my-network uuid=d55162b4-6152-4310-9312-8f4c54d86afa type=802-3-ethernet [ipv4] method=manual address=18.104.22.168/24,192.168.1.1 dns=22.214.171.124;126.96.36.199; [ipv6] addr-gen-mode=stable-privacy method=auto
addressfield to the desired IP and gateway, and the
dnsfield to those DNS we still use. Write down the IP that you are going to assign to the device because it is quite important.
Eject the SD card from the computer and insert it into the Raspberry Pi. Plug it into the power supply and wait, depending on the device the download of the latest version and installation can take up to 20 minutes.
In the meantime, we can search our Router manual and see if it has mDNS available, in which case, we will be able to access the Home Assistant graphical interface from any other device by accessing the following address with the browser:
http://hassio.local:8123, otherwise, and since we have configured a static IP on our server, we can access the interface with the address:
http://192.168.1.4:8123(IP being the one previously set in the network configuration file).
Once installed, a couple of screens will be displayed to perform the basic configuration of Home Assistant, such as the user and the location of the device. Finally, log in and the main Home Assistant screen will appear.
Note that during installation, Home Assistant will look for smart devices on the network with which it has auto-integration to include them directly in its configuration. Don’t worry, we can add them later. In fact, more advanced Home Assistant users tend to avoid these automatic integrations.
At this point, we’ll have our own Home Assistant running on a local server. And with it, a whole range of possibilities that we will discover in next articles. It took just a few minutes to get started, but soon we’ll discover all the potential Home Assistant has in store for us.
This and other articles complement the explanation of the GitHub repository where the configuration of the domotization of my house is available.