The ESPHome command-line interface (CLI) is the primary tool for compiling, uploading, and debugging firmware on ESP32, ESP8266, and RP2040 devices. Every operation — from first-flash to daily OTA updates — flows through a consistent command structure, and all commands accept one or more YAML configuration files as input.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.
Base Usage
Global Options
Global options appear betweenesphome and the command name and apply to all commands.
Print available commands and their arguments. You can also append
--help to any specific command to see its flags:Enable verbose ESPHome log output. Equivalent to setting the environment variable
ESPHOME_VERBOSE=true.Suppress all ESPHome log output. Useful in CI pipelines where only exit codes matter.
Define or override a substitution variable at the command line. May be specified multiple times. See Command-line Substitutions for details.
Select the toolchain used to compile the project. Accepted values:
platformio(default) — uses PlatformIO to manage the ESP-IDF/Arduino layers.esp-idf— uses ESPHome’s native ESP-IDF integration with automatic framework installation.
esp32.toolchain is also set in YAML, the CLI option takes precedence. See ESP-IDF Toolchain for details.Commands
run
The most commonly used command. It validates the configuration, compiles the firmware, uploads it to the device, and then streams logs.
Specify the port or IP address to use for upload and logging. Accepts:
- A serial port path, e.g.
/dev/cu.SLAB_USBtoUARTorCOM3 - An IPv4 or IPv6 address for OTA, e.g.
192.168.1.176or2001:db8::1 - The keyword
OTAto auto-resolve the address via MQTT, DNS, or mDNS
Serial upload baud rate. Defaults to
460800 or the value of ESPHOME_UPLOAD_SPEED. Can also be set per-config in platformio_options.Skip opening the log view after a successful upload. Useful in scripts where you only need to flash the device.
Override the MQTT topic used for log streaming.
MQTT username for log streaming.
MQTT password for log streaming.
MQTT client ID for log streaming. Defaults to a random value.
Host port for legacy Over-the-Air upload connections.
Force a specific OTA platform. By default ESPHome uses whatever is configured in YAML. Use
web_server when the native OTA password is lost but web server credentials are still known.Reset the device before the log view starts. Also configurable via
ESPHOME_SERIAL_LOGGING_RESET=true.compile
Validates the configuration and compiles the firmware without uploading it. Useful for CI checks or pre-building before deploying to a remote location.
Only generate the C++ source files; do not run the actual compiler. The generated code lands in
<NODE_NAME>/src/main.cpp.Any command that accepts a YAML
<CONFIG> also accepts a .esphomebundle.tar.gz bundle file produced by esphome bundle. The bundle is automatically extracted before the command runs.upload
Uploads the most recently compiled firmware to a device without recompiling. Run esphome compile first.
Serial port or IP address to upload to. Supports fallback addresses when repeated. See
run --device for full details.Baud rate for serial upload. Defaults to
460800.Host port for legacy OTA upload connections.
Force a specific OTA platform for this upload. See
run --ota-platform for details.logs
Streams log output from a device. ESPHome automatically selects the log transport — native API, MQTT, or serial — based on the configuration.
Serial port, IP address, or
OTA. When using the native API for logs, multiple addresses are passed to the API client which uses the Happy Eyeballs algorithm (RFC 8305) to connect via the fastest available path.MQTT topic to subscribe to for log messages.
MQTT username.
MQTT password.
MQTT client ID.
Reset the device before streaming logs. Also set via
ESPHOME_SERIAL_LOGGING_RESET=true.Suppress entity state-change lines (
[S] prefix) from the native API log stream, showing only firmware log messages.config
Validates the YAML configuration and prints the fully-resolved output, including all substitutions and packages. No compilation occurs.
config-hash
Loads the configuration, calculates a hash, and prints it. Compare the hash against the Version Text Sensor on a running device to confirm it is running the expected firmware.
dashboard
Launches the ESPHome web dashboard — a browser-based UI for managing all your devices. This command accepts a directory of YAML files rather than a single configuration file.
HTTP port for the dashboard server. Defaults to
6052.Network address to bind to. Defaults to
0.0.0.0 (all interfaces).Unix socket path to bind to instead of a TCP port. Cannot be combined with
--open-ui.Optional username to require for HTTP Basic Auth on the dashboard.
Optional password for HTTP Basic Auth.
Automatically open the dashboard in a browser once the server is ready. Does not work with
--socket.clean
Removes all build artifacts for a configuration. Run this when switching frameworks or resolving stubborn build errors.
clean-all
Removes all build files, PlatformIO platform and package files, and the PlatformIO core directory. Unlike clean, a configuration file is optional — if none is provided, ESPHome cleans the .esphome directory in the current working directory.
Storage files (
.json files and the storage directory inside .esphome) are preserved so the dashboard continues to function correctly.clean-mqtt
Clears retained MQTT discovery messages from the MQTT broker. Useful when renaming or removing a device that was previously using MQTT discovery with Home Assistant.
The MQTT topic to clear retained messages from. Defaults to the device’s configured MQTT discovery topic.
MQTT username.
MQTT password.
MQTT client ID.
bundle
Packages a YAML configuration and all its local dependencies into a self-contained .esphomebundle.tar.gz archive. Transfer the bundle to another machine for compilation with esphome compile device.esphomebundle.tar.gz.
!include files, secrets.yaml (filtered to referenced keys), fonts, images, certificates, and local external_components directories. Remote git-based resources are not bundled — they are fetched during compilation on the target machine.
Custom output path for the bundle archive. Defaults to the config file path with
.esphomebundle.tar.gz extension.List all files that would be bundled without creating the archive.
update-all
Compiles and uploads firmware to all devices in a directory via OTA. Prints a summary of successes and failures at the end.
esphome run <CONFIG> --no-logs --device OTA for each device found.
analyze-memory
Compiles a configuration and analyzes flash and RAM usage by component. Useful for identifying memory bottlenecks, especially on memory-constrained devices like the ESP8266.
This is an advanced command primarily intended for developers and contributors debugging memory issues.
wizard
Starts an interactive configuration creation wizard that guides you through setting up a new ESPHome node.
version
Prints the current ESPHome version and exits.
Shell Auto-completion
ESPHome’s CLI supports tab-completion in Bash and ZSH viaargcomplete. Register it by adding the following to your ~/.bashrc:
Discovering Devices on the Network
Useaioesphomeapi-discover (bundled with ESPHome) to find all online ESPHome devices on the local network:
Status | Name | Address | MAC | Version | Platform | Board