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

Preface

Home Automation has been a popular subject for numerous years and is progressively growing in fascination, primarily due to the active involvement and introduction of innovative product launchings by prominent market leaders. In the middle of the huge amount of solutions and products available, you, as a Home Automation enthusiast, will have multiple questions. How can I start to automate my home? Can I build my own system? How can I manage it?

This book will help you to answer this and many other questions you have related to Home Automation. The central piece of the Home Automation technology discussed in this book is Home Assistant. This customizable software will allow you to understand how to connect all the dots of Home Automation technology by creating and managing your own system. Depending on your level of knowledge and skills, you could even be able to create your own electronic hardware devices and develop automations to control your day-to-day tasks.

In this book, I share all my knowledge learned and consolidated over more than 20 years of experience in this area dealing with Home Automation as a hobby activity. All the examples in the book are real and implemented in my home, so you can imagine that writing this book was a very pleasant adventure for me. I tried to provide as practical a guide as possible so you can implement the examples in a very straightforward approach according to your needs and interest.

This book will support you in creating your own ecosystem to automate your home using Home Assistant software. It will explain the components of a Home Automation system and how to create, hack, and configure them to operate seamlessly. You’ll learn how to set up Home Assistant on Raspberry Pi to work as a Home Automation server. Using practical examples and three hands-on projects, you’ll create and install your own IoT sensors and actuators based on ESP32/ESP8266 and set up real-life automation use cases. Other software tools, such as Node-RED, InfluxDB, and Grafana, will help you to manage, present, and use data collected from your in-house devices. Finally, you’ll gain insights into new technologies and trends in the Home Automation space to help you continue with your learning journey.

As the author of this book, I want to clarify that the content included within the pages of this book represents a careful selection of relevant information based on my personal experiences. It is important to note that not all content pertaining to the Home Automation and Home Assistant subject could be covered comprehensively. Nevertheless, I have striven to provide valuable insights and perspectives that I believe will be beneficial to you.

After reading this book, you’ll be able to build your own creative Home Automation IoT- based system using different hardware and software technologies.

Who this book is for

This book was written for students and professionals in the electronics, systems engineering, computer software, and programming areas. This book is also for engineers, technicians, teachers, and others who want to be updated about the different systems and technologies that exist related to Home Automation. All these professionals and also including the Do It Yourself (DIY) community composed of addicted and enthusiastic people passionate about the Home Automation subject will find this a practical guide of real examples to implement in their homes.

Prior knowledge of installing and configuring software in hardware devices, working with Raspberry Pi, creating hardware prototypes, and software programming will be beneficial for using this book.

What this book covers

Chapter 1, Understanding Home Automation Systems, will introduce the Home Automation system concept, giving an overview of it along the years, including architectures and configurations. The parts of the system will be listed and explained. The benefits of an automated home will be briefly discussed and an example of a real Home Automation system will be provided.

Chapter 2, Getting Started with Home Assistant, will explain Home Assistant in detail and a Home Automation server will be created using Raspberry Pi. A step-by-step guide will be presented to create and set up this server, which will be the first part of our Home Automation system.

Chapter 3, Hands-on Project 1 – Creating Your Own Sensor, will be where we create our first project in the book, which is a double measurement sensor, including motion and temperature sensors. Electronic parts will be connected and we will install and set up the sensor software to communicate with Home Assistant. We will also provide instructions on how to enclose and physically install the sensor in your home.

Chapter 4, Hacking a Commercial Actuator to Work with Home Assistant, involves a lot of hands-on work as well, where we will see how to get a commercial actuator and change (hack) its factory software by Tasmota. This will give us more control of the configuration and will provide the feature tobe handled by Home Assistant seamlessly. We will explore how to install and configure this and other devices in the chapter.

Chapter 5, Creating Automations Using Home Assistant, will explain what an automation in Home Assistant is by providing the main idea and steps to create it. Using the sensors and actuators from previous chapters, we will create and test useful automation examples. Scripts and scenes will also be explored here.

Chapter 6, Doing More Using Integrations and Customizations, is where we will learn how to add more devices to Home Assistant using integrations. With more devices included in our system, we will learn about and create dashboards and populate them using cards. We will customize the dashboards using different approaches. We will also understand what else we can customize in Home Assistant.

Chapter 7, Extending Home Automation Capabilities Using Add-ons, is where the main IoT software add-ons will be presented and installed using Home Assistant. Brief examples will be provided on how to set up and use these applications. You will learn other ways to program, store, and present data from the devices installed in your home.

Chapter 8, Installing and Setting Up Home Assistant Container, is where you will learn how to safely back up your Home Automation server before moving to a new type of installation. Then, we will understand, install, and configure a Home Automation stack where a new Home Assistant installation approach is included.

Chapter 9, Hands-On Project 2 – Creating an LED Strip Controller and Adding It to Home Assistant, is the second hands-on project, which will teach you how to create an LED strip controller using a Wi-Fi microcontroller module and an LED strip light. We will learn how to deploy the software to control this project and provide fun examples to incorporate it into your home. We will also learn how to integrate and control this project in Home Assistant.

Chapter 10, Hands-On Project 3 – Creating a Five-Zone Temperature Logger for Your Home part of the knowledge learned in Chapter 7. We will go deep into the creation of a 5(five)-zone temperature logger using Bluetooth thermometers connected to a Wi-Fi microcontroller module, which provides data to the Home Automation server. This data is acquired, stored, and presented using IoT software tools. You will learn how to build and set up this system in your home.

Chapter 11, The Road Ahead in Home Automation Technologies, will present the possible new technologies and trends in the Home Automation area. A frequently asked questions section for Home Automation and Home Assistant will be provided. The chapter will inform you how to get insights and project ideas to automate your home. Links to internet resources will be presented.

To get the most out of this book

To better follow the content of the book, you should have some prior basic knowledge of electronic systems, including soldering and hardware assembly skills. You also should be familiar with software deployment and programming logic. The configuration and other home Assistant files are provided in YAML code.

To build your own minimum automation system using Home Assistant, besides the sensor and actuators that you can buy off the shelf in the market, you will need a Single-Board Computer (SBC) at least. The book uses Raspberry Pi 4 with 4 GB of RAM. Please check in the book what other hardware resources can be used.

The Home Assistant version used in the book varies since it started to be written in November 2022 when was installed the available version which was the 9.3. Along the book, I updated the Home Assistant and now in August 2023 it is in the 2023.8.0. Also the Tasmota version used when the book started to be written was the 12.3.1.3. As I’m writing this part of the book, Tasmota is in its 13.0.0 version. All these changes in versions and releases could imply in differences in the menus, command sequences, button names, and screen names, from what is presented in the book. I tried to overcome this issue by providing different options to access configurations in Home Assistant and also present screenshots to make easier the navigation in the examples provided across the book. If the example sequence in some chapter is different from what you have in your current Home Assistant installation try to get the idea of what is being introduced in the example and guide yourself in the available options or seek for help about the related subject issue using the resources area in Chapter 11.

Software/hardware covered in the book

Operating system requirements

Raspberry Pi 4

Home Assistant Operating System (HAOS)

ESP8266, ESP32

Raspberry Pi OS, Docker, Home Assistant Container

Home Assistant, Node-RED, InfluxDB, Grafana, TasmoAdmin, Duck DNS, Tasmota, WLED

When making changes to the electronics and installing the software, make sure you know what you are doing and follow the instructions in the book. In some situations, you will need to install software in plugs. Do not install them while connected to the outlet. There is an electric shock hazard. Do not install Sonoff actuators in outlets if you’ve never done it before. Call an electrician instead.

Install Home Assistant, Tasmota, and any other software installation mentioned in this book at your own risk. The author will not take any responsibility for any lost factory software not previously backed up before the installation of the software in this book.

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Building-Smart-Home-Automation-Solutions-with-Home-Assistant. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Code in Action

The Code in Action videos for this book can be viewed at https://bit.ly/3QGbKc7

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “You can configure some attributes of the entities, such as friendly_name, to better serve your needs.”

A block of code is set as follows:

- id: ‘1676691530760’  name: ALL OFF
  entities:
    switch.desk_outlet:
      friendly_name: Desk outlet
      state: ‘off’
    light.garagelights:
      supported_color_modes:
      - onoff
      friendly_name: GarageLights
      supported_features: 0
      state: ‘off’
  icon: mdi:home-off
  metadata:
    switch.desk_outlet:
      entity_only: true
    light.garagelights:
      entity_only: true

Any command-line input or output is written as follows:

Rule1 on Switch1#state=1 do publish sensor/%topic%/PIR1 ON endon on Switch1#state=0 do Publish sensor/%topic%/PIR1 OFF endon

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “After the Write bar completes loading, if everything goes well, another window will present the message Process successful! Power cycle the device.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read Building Smart Home Automation Solutions with Home Assistant, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781801815291

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
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 AU $19.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