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

Hacking a Commercial Actuator to Work with Home Assistant

In the previous chapter, we created our own sensor. If you are not interested in creating your own device, you can opt to buy a commercial model instead. One of the great challenges of the home automation industry is ensuring compatibility among the devices offered by each equipment manufacturer. Each manufacturer has its own way of configuring and managing sensors and actuators.

Fortunately, Home Assistant provides several Integrations that allow different devices to be used and controlled through it. Even then, for some devices, an integration to Home Assistant is not available. You may want a different configuration for your device where you can manage its firmware and even adapt it by including features you like that are not available in the original equipment manufacturer’s firmware.

This chapter addresses the challenges mentioned previously. The focus will be on guiding you to change the original firmware...

Technical requirements

You will need the same skills as for the previous chapter and be familiar with software deployment and configuration to configure the actuator we will be hacking. The core knowledge required for this chapter is familiarity with electronic circuits and devices by disassembling and soldering or connecting wires to them. Using electrical installation tool knowledge could be useful to do some installation-related tasks. Some informative videos will be provided on how to hack and configure actuators. The configuration for the actuator used in this chapter is available at https://github.com/PacktPublishing/Building-Smart-Home-Automation-Solutions-with-Home-Assistant/tree/main/Chapter%2004. Check out the following video to view the Code in Action: https://bit.ly/3KDhnDN

Understanding hacking a sensor or actuator

As mentioned previously, the hacking operation is accomplished by replacing the original device firmware with other firmware that has some integration with Home Assistant. You might have the following motivations to hack the firmware of a sensor or actuator:

  • Integration is not yet available in Home Assistant
  • To achieve better control or management than the original device manufacturer’s integration
  • To change or add features to an integration by changing the sensor or actuator firmware

The main motivation when I started to hack the sensors and actuators for my home was because initial Wi-Fi actuator plugs I purchased some years ago don’t have integration to work with Home Assistant. Nowadays, you probably would not need to hack the firmware of your device since most new devices have integration available to work with Home Assistant.

You might opt to hack a sensor or actuator so that it can be managed...

Using tools and hacking the firmware of a commercial actuator

In this section, we will teach you about the tools and materials required to hack a commercial actuator. We will also cover the main subject of this chapter, which is effectively hacking the firmware of an actuator. We will do this using an extremely popular actuator that’s available on the market.

Learning about the tools and materials used to hack an actuator

The materials we will be using to hack a sensor are as follows:

  • 3.3 V DC / 1 A (min) power supply
  • Power supply cables
  • USB-to-serial converter (+3.3 V option)
  • USB type A to USB mini type B cable
  • Jump wires
  • Soldering iron and solder
  • 4-way terminal bar
  • A computer with the Tasmotizer software installed

Note

Tasmota can also be installed using a web installer. I will provide more details about this firmware deployment tool in Chapter 10, in the Upload the ESP32 Tasmota firmware variant to the temperature hub...

Configuring your hacked actuator

The actuator with the new firmware needs to be configured to work as expected. We will do this configuration first on the actuator side. After configuring the actuator side, we will do the Home Assistant configuration so Home Assistant can handle it. After this section, your actuator will be ready to be managed by Home Assistant.

Configuring the Tasmota firmware in your actuator

To configure your actuator, you will need to follow Figure 4.11.

Figure 4.11 – Sequence to install the AC wires to the Sonoff Basic R2

Figure 4.11 – Sequence to install the AC wires to the Sonoff Basic R2

These steps will be required:

  1. First, according to item 1 in Figure 4.11, you will need to make sure the connector lid on the input side is open. If it is not, unscrew the lid of the Sonoff Basic R2 actuator.
  2. Second, according to item 2 in Figure 4.11, you will need to put wires in the actuator input. This is needed because we removed the DC power supply connected to the actuator and now...

Adding another commercial actuator to Home Assistant (non-hacked)

In this section, we will explore another Home Assistant resource, which I call applications. Applications are integrations provided by the device manufacturer or created by the development community. They allow you to easily integrate a commercial sensor or actuator into Home Assistant without the need to flash or hack your device. If you don’t want to change the firmware of your devices, before you buy the next one for your home, check if there is an application for it by searching the integrations available in Home Assistant at https://www.home-assistant.io/integrations/.

We will provide an example of how you can add a device to be managed by Home Assistant directly without any change to the hardware or firmware. The application for the device in the example is available in Home Assistant.

Using a Home Assistant integration to add a commercial device

The device we are going to use in the example is...

Installing actuator devices in your home

After we hacked and configured our actuator, we had to physically install it in our home. The other devices we have in our home, presented in Table 4.2, were installed in Chapter 3, in the case of the double-measurement sensor, or have a simplified installation, as in the case of the TP-Link Kasa plug. Therefore, we will not need to be concerned about them.

Let us get started with the installation, providing some valuable information prior to the work being done. Later, we will be installing and testing the devices. At the end of the chapter, we will give information about the installation of other types of devices.

Getting started with the actuator installation

Some of the most used devices in your home will be Sonoff actuators. The availability of these devices is high, from assorted brands. They can be used to control lights and appliances in your home, which is involved as part of all automation routines in a home automation system...

Installing other types of devices in your home

As I mentioned in Chapter 1, I have different devices installed in my home, including sensors and actuators. Some of them do not require proper installation, while others require minimal work to be installed. In the following subsections, I will briefly comment on and show some of the devices I have at home and how to install them.

Installing small actuators in electrical wall boxes

Some electrical wall boxes I have at home are small, and the size of the Sonoff Basic R2 was a problem for me to install an actuator inside it. The solution I found was to purchase small actuators for electrical wall boxes, such as the Sonoff Mini R2 model shown at the bottom of Figure 4.23.

Figure 4.23 – Sonoff Basic R2 x Sonoff Mini R2

Figure 4.23 – Sonoff Basic R2 x Sonoff Mini R2

The Sonoff Basic R2 at the top of Figure 4.23 is used as a reference to compare the sizes. The Sonoff Mini R2 model can also be hacked to install Tasmota, following a different procedure...

Summary

In this chapter, we enhanced our knowledge related to sensors and actuators by focusing on hacking a commercial device. This was accomplished by installing firmware that can be customized according to what is needed. We presented some motivations behind the hacking execution and highlighted how to choose a device to be hacked.

You learned about the tools required to perform the hacking process and the steps required to upload Tasmota firmware, and later, how to configure it from the actuator perspective and Home Assistant perspective.

We added more information to this chapter by explaining how to configure commercial integration in Home Assistant for an outlet plug device without the need to hack it.

We wrapped up the content by teaching you how to install the actuator we hacked in this chapter. This included the presentation of the common tools and materials used and a step-by-step sequence of physical preparation, installation, and testing. In addition to that, a...

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