ESPHome has a full-featured command-line interface that lets you create configurations, compile firmware, flash devices, and stream logs — all from your terminal. This guide is ideal if you prefer scripting, want to integrate ESPHome into a CI pipeline, or simply like staying in the command line. If you’d rather use a web UI, see the Home Assistant add-on guide.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/esphome/esphome.io/llms.txt
Use this file to discover all available pages before exploring further.
Install ESPHome
See Installing ESPHome for the full platform-by-platform walkthrough. The quick versions are below.Docker Compose
If you prefer Docker Compose, create adocker-compose.yml in your project directory:
docker compose up -d. The ESPHome Device Builder web interface is then available at http://localhost:6052.
If you back your Docker config volume with an NFS share, mount it with the
nolock option. Without it, PlatformIO (used internally by ESPHome) may hang on startup. See platformio-core#3089.Connect Your ESP Device
For the very first firmware install, you need to connect your ESP32 or ESP8266 to your computer via a USB data cable.Initial installation via USB is the most involved step for new users — especially picking the right serial port. Later updates happen wirelessly over OTA. Follow the Physical Device Connection guide for step-by-step serial port identification on each OS.
/dev/ttyUSB0 or /dev/ttyACM0. You may need to add your user to the dialout group:
/dev/cu.usbserial-* or /dev/cu.SLAB_USBtoUART.
On Windows, check Device Manager for a COM port (e.g., COM3).
Create a Configuration
ESPHome’s setup wizard interactively creates a new configuration file. Run it with the name you want to give your config:- Your board type (ESP32, ESP8266, etc.)
- Your specific board variant
- Your Wi-Fi SSID and password
livingroom.yaml is created in the current directory. It will look roughly like this:
Add Components
Openlivingroom.yaml in your editor and add components. For example, a GPIO switch and a GPIO binary sensor:
D1 on a NodeMCU) to the correct GPIO number, so you can use either format.
Compile and Flash
Once your configuration is ready, compile and flash it with a single command:- Validate the configuration YAML
- Generate C++ source code
- Compile the firmware via PlatformIO
- Detect a connected serial device and flash it
- Switch to streaming live logs once the device boots
Alternatively, you can download the compiled
.bin and flash it manually using ESPHome Web or esptool. See the FAQ for details.View Logs
After the first flash, you can stream logs over Wi-Fi (no USB required) at any time:livingroom.local) via mDNS and connects automatically. If your network blocks mDNS, pass --device <IP_ADDRESS> to specify the IP directly.
OTA Updates
After the initial USB flash, every subsequent update is delivered over the air. Just run the samerun command — ESPHome detects that the device is already on the network and performs a wireless OTA update automatically:
Home Assistant Discovery
Once your device is on the network, Home Assistant will discover it automatically (within about 5 minutes). Go to Settings → Devices & Services and you should see the ESPHome integration offering to add your new device. To add it manually, click Add Integration, search for ESPHome, and enterlivingroom.local (replace livingroom with your device name) or the device’s IP address.
Bonus: ESPHome Device Builder
The ESPHome Device Builder web UI (the same interface available in the Home Assistant add-on) can also be run standalone:http://localhost:6052 in your browser. Log level can be controlled with the ESPHOME_LOG_LEVEL environment variable (default: INFO).
Where to Go Next
- Component Reference — explore all available sensors, outputs, displays, and integrations
- CLI Reference — full documentation for all
esphomesubcommands and flags - Home Assistant Guide — if you’d prefer the web UI experience
- Security Best Practices — harden your devices for production use
- FAQ — solutions to common problems