Introduction
This tutorial guides you through integrating the A02YYUW Waterproof Ultrasonic Sensor into HomeAssistant to monitor detection distances in real time.

Tutorial
Preparation
- Hardware
1.A02YYUW Waterproof Ultrasonic Distance Sensor
2.FireBeetle 2 ESP32-C6 IoT Development Board (Other FireBeetle boards are also compatible)
3.HomeAssistant host device - Software
1.Ensure the ESPHome plugin is installed in HomeAssistantOS
Wiring Diagram

Adding a New Device in ESPHome
-
Click the NEW DEVICE button on the ESPHome homepage
-
Click CONTINUE
-
Enter your device name and click NEXT
-
Select your development board model
-
Save the device's Encryption key and click SKIP
-
Click EDIT on the device card in ESPHome to view the auto-generated default program
Modifying the Code
Append the following code to the end of the auto-generated program, maintaining proper indentation and line breaks:
uart:
tx_pin: GPIO16
rx_pin: GPIO17
baud_rate: 9600
id: uart_a
sensor:
- platform: "a02yyuw"
name: "A02YYUW Distance"
uart_id: uart_a
Code explanation reference: Link
First Firmware Installation
-
After modifying the code, click INSTALL
-
For the first installation, select Plug into this computer. Subsequent updates can use Wirelessly (OTA).
-
After compilation completes, click Download project
-
Select Factory format (Previously Modern) to download the firmware locally
-
Connect the development board to your computer and click Open ESPHome Web
-
Select your device's serial port:
-
Select the firmware and flash:
-
Wait for the flashing process to complete
Connecting to HomeAssistant
Go to the HomeAssistant homepage and navigate to Settings > Devices & services to view your device information:

Click Add to complete integration (you may need to enter the Encryption key):

Sensor data will now appear in HomeAssistant's Overview page:
