Book Image

Building Smart Home Automation Solutions with Home Assistant

By : Marco Carvalho
5 (1)
Book Image

Building Smart Home Automation Solutions with Home Assistant

5 (1)
By: Marco Carvalho

Overview of this book

Picture a home where you can adjust the lighting based on the time of day or when movement is detected. In this same home, you can also detect when a door is unexpectedly opened or an alarm is triggered in response to any suspicious activity. Such automated devices form part of a smart home, and the exciting part is that this book teaches you how to create and manage these devices all by yourself. This book helps you create your own ecosystem to automate your home using Home Assistant software. You’ll begin by understanding the components of a home automation system and learn how to create, hack, and configure them to operate seamlessly. Then, you'll set up Home Assistant on a Raspberry Pi to work as a home automation server, build your own IoT sensors based on ESP32/ESP8266, and set up real-life automation use cases using hands-on examples and projects. The chapters will also guide you in using software tools such as Node-RED, InfluxDB, and Grafana to manage, present, and use data collected from your Home Automation devices. Finally, you’ll gain insights into new technologies and trends in the home automation space to help you continue with your learning journey. By the end of this book, you’ll be able to build your own creative, IoT-based home automation system using different hardware and software technologies.
Table of Contents (19 chapters)
1
Part 1: Introduction to Home Assistant – Installation and Configuration
4
Part 2: Install, Create, and Hack Sensors and Actuators
7
Part 3: Automations, Customizations, and Integrations Using Home Assistant
10
Part 4: Expanding Home Assistant’s Capabilities
13
Part 5: Learn by Doing and Future Trends

Overview of home automation systems

Home automation became available and accessible to people when the industry started to provide devices that allowed some kind of sensor and actuator to be applied at home. The first devices of this kind I heard about were the X10 devices.

The X10 technology was created in 1975 by a company called Pico Electronics and became commercially available around 1978. Essentially, it uses the power line available in every home to turn lamps and appliances on and off. Initially, with the limited availability of computers, these so-called home automation systems used architecture that provided limited use. Limited because the control was not centralized and didn’t allow really smart automation to be created. Besides that, there was not much hierarchy in the system, meaning that controllers could communicate with actuators and sensors too. The diagram in Figure 1.1 shows more about the possible configuration used at that time:

Figure 1.1: Early automation systems configuration

As can be seen in Figure 1.1, there was not much hierarchy in the system, which meant that controllers could communicate with actuators, but sensors could also communicate with them too.

When computers became more popular, software such as HomeSeer, Xtension, and Indigo were created to support the X10 technology. Some X10 computer translators were created so that the architecture allowed more intelligence to be added by using a centralized system, as can be seen in Figure 1.2:

Figure 1.2: Recent configuration

Figure 1.2: Recent configuration

Even with a computer, the X10 system was still limited because it was wire dependent, and the number of addresses was limited to 256 devices, meaning 16 houses or rooms, each one with 16 units or devices. Each address is configured manually in the module using two rotatory switches, one from the module’s house varying from A to P and the other for the unit varying from 1 to 16. As an example, a house or room in a home can have the letter A to designate it, and a unit such as a coffee maker is assigned the number 1, so the rotatory switch for an X10 Appliance module will have the configuration A1. Other units in the same house A can have another number assigned to them, such as 4, so the rotatory switch in another appliance or lamp module will have the configuration A4. If the house or room is configured as the letter P, we can have a rotatory switch configured from P1 to P16 to represent 16 different units.

My first experience with the X10 protocol was around 2006 when I acquired a device set composed of two lamp modules (PLM03 and RLM20), an appliance module (PAM02), and a two-way power line interface (PSC05). At the same time, I saw an application note (AN-236 - X-10 Home Automation using the PIC16F877A) and decided to build a task controller using it, adding a temperature sensor and a local relay, and excluding the X10 controller/receiver which was replaced by the PSC05 module acquired. I was able to run my first home automation system, which just had actuators that were turned on and off based on pre-configured timer events embedded in the software application I created. The components of my first home automation system are presented in Figure 1.3:

Figure 1.3: My first home automation system using X10 technology

Figure 1.3: My first home automation system using X10 technology

Figure 1.3 presents the X10 task controller at the top showing a 16X2 LCD module, and underneath it (not shown in the picture) is the Programmable Interface Controller (PIC) microcontroller. The task controller connects to a two-way power line interface module (the white box in the middle) through the white cable, which is connected to a power line. This power line interface sends and receives commands to and from the lamp module (the white box on the left) or the appliance module (the white box on the right).

On top of this X10 task controller, I was able to hack a WRT-54G router from Linksys (seen in Figure 1.4) and add two serial ports to it. Later, I connected it to the X10 controller and turned it on, commanded by a Google Android application created specifically to do it:

Figure 1.4: Linksys router modified to be used as part of my home automation system

Figure 1.4: Linksys router modified to be used as part of my home automation system

Figure 1.4 shows the router with the two DB-9 standard connectors for the RS-232 serial port. One of these serial ports was used to connect to the other DB-9 connector located in the X10 task controller and allow my system to be accessible using wireless communication.

In 2012, I bought my first Wi-Fi module from Particle (https://www.particle.io/), where I was able to replace my original PIC-based X10 controller with a small and powerful piece of hardware. Looking at Figure 1.5, my most up-to-date and optimized system using X10 technology is presented:

Figure 1.5: Latest configuration of my X10 home automation system

Figure 1.5: Latest configuration of my X10 home automation system

Figure 1.5 shows the tablet with my Google Android application (HomeAutomationApp) running, the X10 modules presented previously, and the Particle Wi-Fi module board (former Spark Core).

As can be seen over the years with my X10 system, I had to create my own hardware initially, hack a router, and create an embedded software for the task controller (PIC and Particle) and an Android application so the system could work as desired. Even then, my home automation system was very limited, wire dependent, and hard to maintain.

Based on the evolution of my home automation system over the years as mentioned in the previous examples, and lots of hardware and software programming developed, I felt something else was missing. In 2020, I was interested in learning more about current home automation systems. And it was at that time that I discovered a configuration that changed and made my life easier. This configuration was based on the client-server architecture and is introduced in Figure 1.6:

Figure 1.6: Client-server architecture

Figure 1.6: Client-server architecture

As demonstrated in Figure 1.6, the client-server architecture is configured as clients connect to a server via wireless communication, and the server manages the communication requests by taking some actions, including sending commands back to clients. This is the architecture that I will explore in the remainder of this chapter.

Now that we have an overview of home automation systems and its architecture, let’s look at their benefits.