Reader small image

You're reading from  Building Smart Home Automation Solutions with Home Assistant

Product typeBook
Published inSep 2023
PublisherPackt
ISBN-139781801815291
Edition1st Edition
Right arrow
Author (1)
Marco Carvalho
Marco Carvalho
author image
Marco Carvalho

Marco Carvalho is an experienced home automation hobbyist engineer, electrical engineer, and technician. Pursuing his passion for electronics and embedded systems, he created an embedded home automation task scheduler using X10 Home Automation devices in 2006. Nowadays, he uses wireless electronic devices and the Home Assistant software to build different smart home automation applications. As an MSc in Computer Science, Marco has worked with several well-known companies such as IBM, Jabil, Phillips, and Hexagon where he extended his support in development and manufacturing of electronic products. At the time of this publication, he is the Director of Engineering for Apex Microtechnology, where he is involved in the development of high power, high precision analog components.
Read more about Marco Carvalho

Right arrow

Installing and Setting Up Home Assistant Container

We will try another Home Assistant installation approach in this chapter. We will first learn how to create backups of Home Assistant installations. We will then learn how to back up and keep the data and information for the work done until now safe before we go ahead and learn how to do a new type of installation.

The chapter will provide instructions on how to use IOTstack, which will allow you to understand how to handle a new type of installation for Home Assistant: Home Assistant Container. The pros and cons of this type of installation will be presented and evaluated. The IOTstack software architecture will be explained and details about how to run each software application will be provided.

By the end of this chapter, you will be able to create and restore backups of your Home Assistant installation. You will also know how to set up automation to create backups automatically for you. The main content of the chapter will...

Technical requirements

You will make faster progress through this chapter if you are familiar with the concept of Docker containers. Also, if you have read the previous chapter about add-ons, you will be able to better understand some of the software installed with IOTstack. If you are used to using Linux or Raspberry Pi OS commands, you will easily be able to manage the configuration of IOTstack. The resource information needed for this chapter is located at https://github.com/PacktPublishing/Building-Smart-Home-Automation-Solutions-with-Home-Assistant/tree/main/Chapter%2008.

Creating backups in Home Assistant

By this point, since we started creating our Home Automation system in Chapter 2, a lot of configuration, setup, and customizations have been made to Home Assistant. You never know when things can go wrong, so it is best to be safe and back up your system regularly so you don’t lose the work done up to this point, as well as saving future changes we make to the system. In this section, we will cover how you can manually create Home Assistant backups, how to retrieve them, and how you can automate backup creation.

Creating and retrieving manual backups using Home Assistant

You can create and retrieve backups manually using a Home Assistant built-in backup tool. Follow these steps:

  1. From the sidebar, go to Settings | System | Backups. Click on the + CREATE BACKUP button on the bottom right.
  2. The pop-up window shown in Figure 8.1 will be presented. Include a backup name in the Backup name field. Choose the option you need for backup...

Understanding the architecture of IOTstack

In Chapter 2, we mentioned ways to install Home Assistant. We were using the Home Assistant OS, which is the most common one in use. Another type of installation used by Home Assistant is the Home Assistant Container. A Container is a lightweight and standalone package that contains what is needed to run an application, including code, libraries, dependencies, and system tools. Docker (https://www.docker.com/) is an open source platform that allows developers to build, ship, and run applications in containers. Docker provides a way to manage containers using Docker Compose (https://github.com/docker/compose), which is a tool for defining, managing, and running multi-container Docker applications.

In this section, and until the end of this chapter, we will explore the Home Assistant Container installation using Docker Compose. This type of installation was the first one I tried and was how I discovered how to use Home Assistant and other...

Installation of IOTstack

In this section, we will cover how to install IOTstack. As mentioned in the last section, IOTstack runs on Raspberry Pi OS. So, you have to install the Raspberry Pi OS prior to installing IOTstack. I will not explain how to install the Raspberry Pi OS since it is very well covered on the internet; you can find installation instructions by visiting this link: https://www.raspberrypi.com/software. You have to do some basic configuration to use the system, such as setting up your cable or wireless network. The next procedure will assume you have internet access in your Raspberry Pi.

If you already have the Raspberry Pi OS installed, you will need to make sure you have the latest software version. You can do that by running the following commands on the Raspberry Pi terminal console:

  1. Update the list of repository packages using the Advance Package Tool (APT) command:
    sudo apt update
  2. When the preceding command is done, run the update command to get...

Configuring the IOTstack

We will have to do some configurations to put IOTstack to work as a Home Automation Stack. The following configurations will be required:

  • Raspberry Pi static IP configuration
  • Accessing and configuring the container software applications
  • MQTT server configuration in Tasmota devices
  • Configuring Home Assistant in IOTstack

We will discuss each of them in the next subsections.

Raspberry Pi static IP configuration

The first configuration we will have to do to run the Home Automation Stack properly is to set up a static IP in Raspberry Pi. We will see that making the IP static on Raspberry Pi will help with accessing the software applications and also configuring the MQTT server address for sensors and actuators. To configure the static IP, you have to execute the following steps:

  1. Open a terminal console in your Raspberry Pi and find the IP address of your router by using the following command and hitting Enter:
    ip r | grep...

Running and managing the applications in IOTstack

As explained in the last section, some applications can be accessed and run using the web browser by pointing to the static Raspberry Pi IP address and adding the port number to the end of it using a colon (:) in the middle. The applications we installed in the last section that have access using the web browser can be found in the last column of Table 8.1. The other applications, such as Duck DNS, which cannot be accessed using a web browser, will need to follow a specific configuration process, which will mostly consist of changing or adding a parameter to the docker-compose.yml configuration file. I will not go over the configurations for running applications that are not accessible using a web browser since they are well explained on the IOTstack website. You can understand more about how to run the IOTstack container installations by accessing the following address: https://sensorsiot.github.io/IOTstack/Containers/AdGuardHome/...

Summary

In this chapter, we covered a very helpful topic, which is how you can create backups for Home Assistant using the Home Assistant operating system installation.

After learning how to do backups, we guided you through how to explore a new type of Home Assistant installation, which is the Home Assistant Container. We did that by using a pre-formatted installation tool called IOTStack. IOTStack is an open source project that not only includes Home Assistant Container installation but also many other types of software that can be used with IoT devices. In our case, it was used to install software to handle Home Automation applications.

We understood how the IOTStack architecture is configured, how to install container applications, and how to configure, use, and manage them.

In the next chapter, we will cover another hands-on project, which is a fun idea to support you during the festive holiday season. I hope you enjoy it!

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Building Smart Home Automation Solutions with Home Assistant
Published in: Sep 2023Publisher: PacktISBN-13: 9781801815291
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Marco Carvalho

Marco Carvalho is an experienced home automation hobbyist engineer, electrical engineer, and technician. Pursuing his passion for electronics and embedded systems, he created an embedded home automation task scheduler using X10 Home Automation devices in 2006. Nowadays, he uses wireless electronic devices and the Home Assistant software to build different smart home automation applications. As an MSc in Computer Science, Marco has worked with several well-known companies such as IBM, Jabil, Phillips, and Hexagon where he extended his support in development and manufacturing of electronic products. At the time of this publication, he is the Director of Engineering for Apex Microtechnology, where he is involved in the development of high power, high precision analog components.
Read more about Marco Carvalho