HomeAssistantHQ
A pink network of connected nodes and small cubes radiates from a central glowing disc on a dark purple isometric platform, evoking a microcontroller's wireless mesh links.
esphome

How to Install ESPHome on ESP32: Setup and First Flash

Set up ESPHome as a Home Assistant app, in Docker, or with pip. Validate your ESP32 YAML, flash it over USB, and add the device to Home Assistant.

By HomeAssistantHQ Editorial · · 6 min read

To install ESPHome on a blank ESP32, use the ESPHome Device Builder or command line to turn a YAML configuration into firmware, then flash it over USB. Once the board joins Wi-Fi, add it to Home Assistant and send future firmware updates over the network. ESPHome getting started guide

Choose where to install ESPHome

Your setupWhat to install
Home Assistant OSInstall the ESPHome Device Builder app, also called an add-on in older guides. In Home Assistant, go to Settings → Apps → Install App, find ESPHome Device Builder, then choose Install, Start, and Open Web UI.
Home Assistant Container or a separate Docker hostRun the ESPHome container for the Device Builder dashboard. Use the browser installer below if the ESP32 plugs into a different computer.
A computer with Python 3.12 or newerUse pip to install the Device Builder and CLI together, or install only the CLI.

The official install guide also shows how to add the repository if the app is missing. If you are still choosing a Home Assistant host, see the OS vs Container comparison and the Home Assistant hardware guide. ESPHome installation guide

Docker. On a Linux Docker host, run this from the directory where you want to store your YAML files. The command mounts that directory at /config and enables mDNS discovery with host networking. ESPHome Docker guide

docker run --rm --net=host -v "${PWD}":/config -it ghcr.io/esphome/esphome

Open http://localhost:6052 on the Docker host. If host networking is unavailable, use the command below. With port publishing alone, use the device’s IP address if its .local name does not resolve. ESPHome Docker guide

docker run --rm -p 6052:6052 -v "${PWD}":/config -it ghcr.io/esphome/esphome

pip. In bash or zsh, create a virtual environment and start the Device Builder. Here config is the directory for the YAML files. On Windows Command Prompt, use python -m venv .venv and .venv\Scripts\activate.bat for the first two lines. Python virtual environments, ESPHome installation guide

python3 -m venv .venv
source .venv/bin/activate
pip install "esphome-device-builder[esphome]"
esphome-device-builder config

Open http://localhost:6052 for the dashboard. For a command-line-only setup, run pip install esphome inside the virtual environment and use the CLI commands below. ESPHome installation guide

Create and validate the ESP32 configuration

In Device Builder, choose Create device → New Device Setup. If your version says Create new project, choose that. Name the device office-sensor, select the board or matching ESP32 variant, and enter your Wi-Fi details. ESPHome getting started guide, Device Builder labels

The CLI equivalent is esphome wizard office-sensor.yaml. The example below gives a classic ESP32, such as the ESP32-DevKitC V4, Wi-Fi, serial logs, an encrypted Home Assistant connection, and encrypted over-the-air (OTA) updates. Select the matching variant for a different chip, such as esp32s3 for an ESP32-S3. Getting started, ESP32 platform, DevKitC V4 guide

esphome:
  name: office-sensor
  friendly_name: Office Sensor

esp32:
  variant: esp32

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "Office Sensor Fallback"
    password: !secret ap_password

logger:

api:
  encryption:
    key: !secret api_key

ota:
  - platform: esphome
    encryption:

esphome sets the name, logger enables logs, and wifi.ap starts a fallback hotspot if the device cannot join your network. The OTA configuration reuses the API encryption key. Core configuration, Logger, Wi-Fi, OTA updates

Use Open secrets in Device Builder if available, or create or edit secrets.yaml next to office-sensor.yaml. For the Home Assistant app, both files are in the esphome/ folder of your Home Assistant configuration. Add these four entries, keeping any Wi-Fi values the wizard already saved. ESPHome FAQ, ESPHome getting started guide, Device Builder labels

wifi_ssid: "REPLACE_WITH_WIFI_NAME"
wifi_password: "REPLACE_WITH_WIFI_PASSWORD"
ap_password: "REPLACE_WITH_FALLBACK_HOTSPOT_PASSWORD"
api_key: "REPLACE_WITH_GENERATED_API_KEY"

Each !secret reference pulls the value from its matching entry. Use your Wi-Fi name and password for the first two values and choose a separate password for the fallback hotspot. For api_key, copy a fresh 32-byte Base64-encoded key from the generator in the API docs. ESPHome FAQ, Wi-Fi settings, Native API key generator

In Device Builder, use Edit and Save for any YAML changes. Open the device’s three-dot menu and select Validate. On the CLI, run esphome config office-sensor.yaml from the configuration directory. Fix any missing secrets or board configuration errors before flashing. ESPHome getting started guide

Flash the ESP32 over USB

Connect the ESP32 with a USB data cable. On its Device Builder card, choose Install. Select Plug into this computer for USB attached to the computer running your browser, or the server option if the Device Builder host can see the serial port. Follow the prompts and select your board’s port. Physical connection guide, Device Builder labels, Waveshare first-flash guide

For the CLI, plug the ESP32 into the computer running ESPHome and run this from the YAML directory. Choose the USB serial port if prompted. The command validates the config, builds the firmware, and uploads it. ESPHome CLI reference

esphome run office-sensor.yaml

ESPHome Web: flashing without the add-on

Use ESPHome Web when the board plugs into another computer or the Device Builder page cannot access your browser’s serial port. Open the installer in a desktop browser with Web Serial support, such as Chrome or Edge. ESPHome FAQ, Device Builder labels

  1. From the device’s three-dot menu in Device Builder, select Install → Manual download. Some versions call this Download firmware binary.
  2. After the build, choose Factory format or Factory image to download the full .bin for a blank ESP32. The OTA update image is for a device that already runs ESPHome.
  3. Open ESPHome Web on the computer connected to the ESP32.
  4. Click Connect and select the board’s USB serial port. Click Install and select the downloaded .bin. The browser processes the file locally. ESPHome FAQ

Device Builder download labels, Waveshare first-flash walkthrough

When it will not connect

SymptomWhat to check
No USB serial port appearsTry a known USB data cable. Reconnect the board and look for the port that appears. If your board has a USB-to-serial bridge, check the driver for that chip. ESPHome physical connection guide, ESPHome FAQ
Upload stays at Connecting....____.... or stalls during transferRecheck the selected port after reconnecting and close any serial monitor using it. For a connection timeout, try download mode. If transfer starts and then stalls, try a shorter cable and check for unstable power. ESPHome FAQ, Espressif esptool troubleshooting
Flash succeeded but Home Assistant shows no discoveryCheck serial logs for a Wi-Fi connection and an IP address. If there is no connection, verify the Wi-Fi details in secrets.yaml and flash again over USB. If the board has an IP address, use it in Home Assistant’s manual setup. ESPHome getting started guide, Waveshare pairing walkthrough

ESP32-DevKitC V4 download mode. Hold BOOT, press and release EN, then release BOOT and retry the upload. When flashing this board over USB, use USB as its only power source. Espressif DevKitC V4 guide

Check Wi-Fi, add the device, and update it wirelessly

  1. Confirm Wi-Fi. Keep the ESP32 connected by USB and open the device card’s Logs. Choose the serial connection and look for a successful Wi-Fi connection and the assigned IP address. If USB is on another computer, choose Plug into this computer when available and use the serial logs in the browser installer. On the CLI, run esphome logs office-sensor.yaml. ESPHome getting started guide, Device Builder log options, Waveshare pairing walkthrough
  2. Add it to Home Assistant. Go to Settings → Devices & services and select the discovered ESPHome device. If it is missing, choose Add Integration → ESPHome and enter office-sensor.local or the IP address from the logs. If prompted for a Noise PSK, use the same key you stored as api_key. Home Assistant ESPHome integration, ESPHome getting started guide
  3. Reinstall over the network. With the ESP32 online, save your YAML changes and select Install → Wirelessly or Install → On the network. On the CLI, run esphome run office-sensor.yaml again and select the network target if prompted. If Device Builder cannot resolve the hostname, set use_address under wifi: to the board’s IP address. ESPHome getting started guide, Device Builder install options, Waveshare OTA walkthrough, ESPHome Wi-Fi settings

Evidence and limits. This guide is based on the ESPHome 2026.11.0 documentation, the Device Builder interface labels, and hardware and integration documentation. The steps were not run on a board. ESPHome getting started guide

Sources

  1. Install ESPHome
  2. Getting Started with ESPHome
  3. Running ESPHome in Docker
  4. Python venv documentation
  5. ESPHome Device Builder labels
  6. ESPHome FAQ
  7. ESPHome Core Configuration
  8. ESP32 Platform
  9. ESPHome Logger Component
  10. ESPHome WiFi Component
  11. ESPHome Native API Component
  12. ESPHome OTA Updates
  13. ESPHome Command Line Interface
  14. ESPHome Web firmware installer
  15. Waveshare guide to a first ESPHome device
  16. ESPHome Physical Device Connection
  17. Espressif esptool Troubleshooting
  18. Espressif ESP32-DevKitC V4 User Guide
  19. Home Assistant ESPHome integration

Related