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

Getting Started with Home Assistant

This chapter will introduce you to the Home Assistant software. You will learn how it was created and maintained. You will also learn about the different Home Assistant resources available at present and ways you can access and contribute to the community of developers and makers.

Besides this, this chapter will also cover a brief introduction to YAML Ain’t Markup Language (YAML) so you will be familiar with how Home Assistant handles configurations and customizations using an interpreted language. We will see how to create a home automation server by guiding you to install Home Assistant on Raspberry Pi. Next, we will do some menu navigation to give you an overview of the resources available in Home Assistant. I will also guide you through the basic configurations, applications, and integrations required to set up the Home Assistant server to interact with sensors and actuators.

We will cover the following main topics in this chapter...

Technical requirements

In this chapter, you will need some familiarity with software installation done using a Secure Digital (SD) card. You will understand more about Home Assistant configurations if you have already configured some other kind of software before. Also, it will be easier for you to understand the YAML pseudo-code language if you have previously been exposed to some interpreted programming language.

You will understand the Raspberry Pi hardware specifications better if you know how a basic computer is configured, including its parts.

Learning about Home Assistant

In this section, the idea is to provide some background information about Home Assistant. This information will be useful in the next section when we talk more about the software installation.

Introduction and evolution

The Home Assistant is a software developed to be used as a home automation server. It was first released in 2013 and developed using the Python programming language by Paulus Schoutsen. It is free and open source software licensed under the Apache 2.0 license.

In 2017, in order to ease the installation in some compacted devices, an operating system called Hass.io was introduced allowing users to manage, back up, update the local installation, and add some extra functionality by including add-ons. Also in 2017, an optional subscription service was introduced to address questions related to secured remote access and extend Home Assistant access to work with Amazon Alexa and Google Home Assistant. A company called Nabu Casa was created...

YAML

YAML (www.yaml.org) is a data serialization language created to be used for programming languages. It is used to configure parameters for those who prefer to work with Home Assistant in a programming language style. You do not need to use YAML to do basic configuration, but if you need more complex configuration or if you like programming languages, it is good to know more about it.

The automations.yaml file is one of the most important files in Home Assistant. It is used to store the automation configured in the system. I will use this file so you can gain an understanding of what the YAML language looks like.

Important note

The automations.yaml file is managed by the user interface and should not be edited manually. If you want to manually create automation, the configuration.yaml file should be used instead.

The following YAML code is what is implemented in my home for my homemade motion sensor installed in my garage:

- id: '1634873959087'  ...

Raspberry Pi as a home automation server

In this section, we will explore some aspects of Raspberry Pi, and in the next section, install Home Assistant on it. The idea here is to focus on important aspects required for a hardware device when installing a home automation server software such as Home Assistant. We will not explain details about the Raspberry Pi hardware. For more information about Raspberry Pi, including all models currently available, please visit https://www.raspberrypi.org.

Hardware architecture

One of the popular hardware devices used for Home Assistant software installations is Raspberry Pi. This particular Single Board Computer (SBC) is the one chosen for the examples given in this book. The model I recommend is the Raspberry Pi Model B with 4 GB of RAM or above. I’ve been running this installation for my home automation system since mid-2021 without any problem. It has all the resources and peripherals needed for the home automation server, including...

Installing Home Assistant on a Raspberry Pi

To install Home Assistant on a Raspberry Pi, you will need the following material:

  • The hardware required to prepare the Home Assistant software in the SD card
    • An SD card reader used to prepare the SD card for installation using a computer
    • A desktop or laptop computer
  • Home automation server:
    • Raspberry Pi 4 Model B 4 GB (recommended, but others can be used)
    • A Raspberry Pi case
    • Raspberry Pi power supply (15 W minimum)
    • 32 GB SD card minimum
  • Peripherals used just for installation with the Raspberry Pi:
    • A router connected to the internet
    • An Ethernet cable

Preparing the SD card for Home Assistant installation

The installation type used in this chapter and in the first, second, and third parts of this book (up to Chapter 7) will be the recommended installation method, the HAOS. This includes the Supervisor software to manage the Home Assistant Core and to install the add-ons.

To prepare the SD card with the image software required...

Exploring a Home Assistant installation

In this section, we will explore the Home Assistant installation performed in the last sections by explaining the screen and menu disposal and then navigating through the menus explaining notable features, system functions, and options. This will help you to understand how Home Assistant is organized and where to find the resources and features to be used and configured.

Home Assistant default screen and menu disposition

If you just configured the system and are following this book sequence, you will not need to proceed with the initial login to the system. It will automatically access the system.

If you have not logged in to the system yet, logged out, or are logging in from your tablet or cell phone for the first time, you will need to fill in some information to initiate Home Assistant. The login process is straightforward: just input your username and password in the fields provided when accessing the http://homeassistant.local:8123...

Home Assistant basic configurations

In this section, we will explore some of the basic configurations to be done in Home Assistant to prepare it for use as our home automation server. We will learn about some other basic configurations to be done in the system so you can better manage and handle it. We will clean up the dashboard so that we can add sensors and actuators in the coming chapters.

These configurations are supposed to be done initially when you start to use the system, and you will not have to change them regularly unless you need to change your home location, change some personal configuration, or other major changes occur.

User preference configuration

User preference configurations are optional and help you to interact better with the system. They can be found by clicking on the last option presented in the sidebar, located at the bottom-left corner of the screen, which has the Username value configured when Home Assistant was installed. Here, the username is...

Summary

In this chapter, we started the journey to create a home automation system using Home Assistant. We learned more about the Home Assistant software by reviewing its history, development purposes, availability, and resources. We prepared an SD card and installed Home Assistant on a Raspberry Pi. We learned how to navigate the Home Assistant menus, submenus, and tabs and identified where to find different options available for configuring the system. Talking about configuration, we learned how to configure the basics of the system to prepare it to integrate the first sensors and actuators.

This chapter also gave you an idea about YAML and how to use it to do some configurations in Home Assistant.

Your home automation system now has the first component: the home automation server.

In Chapters 3 and 4, you will learn how to create your own sensor and hack a commercial actuator to be used with Home Assistant. Let’s continue the journey and add more devices to your...

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