Domotizing our house with Home Assistant

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 was born with the concept of creating an Open Source control system that bears the banner of privacy and local service.

Home Assistant

Home Assistant

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.

Type of installation

Before we get to the point and since it is usually quite confusing… Let’s distinguish the most common ways to run Home Assistant.

  • Home Assistant (former Hass.io) in addition to the name of the application is an all-in-one that includes a Linux distribution optimized to run Home Assistant on Docker and a supervisor with several Docker containers already included. 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 of the host that runs the Home Assistant (Hass.io) container. It is the installation option that we will see in this post and more stable.
  • Home Assistant Core as we have mentioned is the software itself and as such, it can be installed in any Linux distribution (even if you dare in Windows), the usual 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. Its installation is through Python environments. It does not have Add-ons and Snapshots as it is only the application.
  • Home Assistant Core on Docker is the most advantageous option for some, but also the most advanced. It consists of using a Docker container with Home Assistant, in such a way that we have a total control, and at the same time isolated from all the Home Assistant system with the advantages that it entails. On the other hand, it does not have the options of Add-ons and Snapshots because it is Home Assistant Core.
  • Home Assistant Supervised, is a mixture of the complete installation of Home Assistant and Home Assistant Core on Docker. It allows to use a main operating system with Docker and Home Assistant Core, and also to have Add-ons and Snapshots with the Supervisor. Its use is currently maintained by the community and requires advanced knowledge to avoid problems with its use and maintenance. I personally do not recommend this method of installation.

Installing Home Assistant

As we have mentioned, let’s see how to install the complete Home Assistant (Hass.io) system, the reason, it has the easiest and fastest installation. You can try Home Assistant after a few minutes and as you gain knowledge, move on to the other more advanced installation types.

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.

  1. Download the latest image from for your device. At the time of writing, Hassos 4.12 for Raspberry Pi 3 B / B+ 32bit.

  2. Download and install on your computer a SD card image burner software. I like balenaEtcher.

  3. 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.

    balenaEtcher

  4. 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.

    1. Open the directory of the newly created SD card and create the directories CONFIG and inside network. Finally, the file my-network inside this last one, without extension. This will leave X:\CONFIG\network\my-network.

    2. Edit the file my-network and include the following code:

       [connection]
       id=my-network
       uuid=d55162b4-6152-4310-9312-8f4c54d86afa
       type=802-3-ethernet
      
       [ipv4]
       method=manual
       address=192.1.1.4/24,192.168.1.1
       dns=8.8.8.8;8.8.4.4;
      
       [ipv6]
       addr-gen-mode=stable-privacy
       method=auto
      

      Change the address field to the desired IP and gateway, and the dns field to those DNS we still use. Write down the IP that you are going to assign to the device because it is quite important.

  5. 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.

    Installing Home Assistant

  6. 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://homeassistant.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).

Basic configuration

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.

Log-in Home Assistant

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.

Conclusion

Main page of Home Assistant

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.

Leave a comment