The plug-and-play style of smart home devices is convenient but expensive. ESPHome is monumental in helping you save costs and build your own smart devices to pair with Home Assistant. All you need is an ESP32 microcontroller board and a bunch of sensors — no soldering or traditional code writing required.

With ESPHome, you mostly describe and declare how the hardware behaves depending on how you plan to use it. To use sensors with the ESP32 board, you can buy DuPont jumper cables to connect sensors and program them using ESPHome. Make sure you have your ESP32’s schematics ready to use the correct GPIO pin and also define them in ESPHome. The idea is to use minimal hardware to start. Here are some easy ESPHome projects to get you started.

Building a Bluetooth proxy for your BLE devices

Setting up a bridge for low-power devices

You only need an ESP32 board to set up a Bluetooth Proxy to connect your Bluetooth Low Energy devices to Home Assistant. As a medium, you only need to define the ESPHome code to build an ESP32-based Bluetooth Proxy instead of buying expensive adapters. The Bluetooth proxy sends data to Home Assistant over Wi-Fi, but it also talks to other proxies and devices over Bluetooth. Defining boilerplate configuration code in five lines can get you started with using ESPHome quickly. Further, you can build a Bluetooth-based presence sensor that works with an ESP32 board and your phone. How about pairing it with a PIR motion sensor?

Setting up a motion sensor for your home

Elevate presence-based automations

Setting up a custom motion sensor that reports when someone passes in front of it is another easy interaction with ESPHome. Connecting three wires of a PIR motion sensor (HC-SR501) to an ESP32 board and hooking it up to ESPHome can get you started quickly. Declare the binary sensor with the device class as motion and the GPIO PIN to start. That’ll report any motion detected in a 120-degree field of view and up to seven meters. But this basic sensor is prone to false positives; it’s a good idea to add a few milliseconds of delay to the YAML. Use this sensor in tandem with your phone to detect your presence in your home (or room) and improve the accuracy of your automation triggers.

Door and window sensor with a magnetic reed switch

Smart, simple way to know the open or closed state

For about $2, you can get a wired window and door sensor that easily tells whether it’s closed or open. Monitoring a sensor with two simple states — ON/OFF and Open/Close — requires declaring a binary sensor in the ESPHome’s YAML configuration. Next, you’ll need to define the GPIO pin you want the device to monitor. To get a proper ON or Open output, apply the Internal Pullup setting — this ensures accurate readings without throwing in false positives. Finally, define the device class based on its usage (door or window) so that Home Assistant displays the appropriate icon on your sensor card.

Using a vibration sensor for different devices

Don’t go around whacking

Before you build a home security system, take the SW-420 vibration sensor module for a spin for distinct projects. For example, you can use it on your work desk to wake your PC from sleep mode, or install it on a washing machine to report when the wash cycle ends. In the ESPHome’s YAML, all you need to do is define the GPIO pin to read the sensor data from and set the device class as vibration. Then add a delay in milliseconds before the sensor goes off so it can also measure the idle time between the spin and dry cycles.

Ambient light sensor to support smart lighting

Refine your lighting experience

You can set your smart light’s brightness to increase in steps rather than just on/off, depending on the light outside the home. A BH1750 light sensor is suitable for a smart home setup and can provide accurate light data. Note that this requires the I2C protocol, and you’re safe using these pins: GPIO21 for Serial Data and GPIO22 for Serial Clock. After defining the I2C bus in the YAML, define the sensor components to measure light in lx and the update interval. Or you can opt for the LM393 Light-Dependent Resistor module for a simple YAML configuration. Still, you’ll need to adjust the potentiometer on the module to ensure the sensor detects and reports light data more accurately.

ESPHome leads the road to liberation

With the ESPHome platform continuously evolving, you’ll be amazed at the level of customizations and personalizations you can achieve without writing code traditionally. You get to learn basic hardware and wiring skills, as well as work a bit on software fundamentals and networking protocols. Sure, the indentation can be tricky at times. You can build custom firmware using YAML configuration files in just a few minutes, without worrying about breaking anything. In the end, ESPHome integrates directly into Home Assistant, and you don’t have to jump through hoops.

ESPHome