TheDocumentation 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.
esp8266: component provides platform-specific configuration for the ESP8266 microcontroller family — Espressif’s original Wi-Fi SoC that still powers a huge number of smart home devices. While the ESP8266 is significantly more limited than the ESP32 (single core, ~40 KB usable RAM, no Bluetooth, fewer GPIOs), ESPHome supports it fully with the Arduino framework. If you’re starting a new project, consider the ESP32-C3 as a modern, pin-compatible replacement that uses the same RISC-V UART-based programming workflow.
Minimal Example
Configuration Variables
The PlatformIO board identifier for your ESP8266 module. This affects pin aliases, flash size defaults, and some internal settings. Choose from the ESPHome ESP8266 board list. When in doubt, use
esp01_1m (generic 1 MB module) or nodemcuv2 for NodeMCU v2 boards.Options for the underlying Arduino framework version.
- version (Optional, string): Arduino ESP8266 framework version.
recommended(default),latest,dev, or an explicit release tag from esp8266/Arduino releases. - source (Optional, string): Custom PlatformIO package or git repository URL for patched framework versions.
- platform_version (Optional, string): Version of the platformio/espressif8266 PlatformIO platform package.
When
true, persistent component state (lights, switches, globals) is stored in flash memory and survives power cycles. Required for the preferences: flash_write_interval feature to function on ESP8266. Defaults to false.SPI flash access mode. The OTA process automatically detects and switches to the optimal mode. Defaults to
dout (compatible with all chips).Options: qio, qout, dio, doutWhether pins are driven to their initial values immediately at boot (before any ESPHome code runs). Set to
false when controlling switches or relays to prevent them from toggling briefly during firmware updates or restarts. Defaults to true.Force-enable the Arduino
Serial object (UART0) for use in lambdas or external libraries. Most configurations do not need this — the logger and uart components handle UART initialization automatically. Defaults to auto-detection.Force-enable the Arduino
Serial1 object (UART1, TX-only on ESP8266) for use in lambdas. Defaults to auto-detection.Enable full
FILE*-based printf support. Saves ~1.6 KB of flash when disabled (default). Only set true if an external component requires FILE*-based printf. Defaults to false.Enable float support in
sscanf(). Disabled by default to save ~8 KB of flash. Set to true only if you use sscanf() with %f in lambda code. Defaults to false.GPIO Pin Reference
On generic ESP8266 boards, useGPIO<n> notation (e.g. GPIO4) to avoid confusion with board-specific silk-screen labels. Many NodeMCU boards use D0–D8 labels that do not match the internal GPIO numbers.
Special and Reserved Pins
| Pin | Function | Notes |
|---|---|---|
GPIO0 | Boot mode + general IO | Must be HIGH at boot (boot from flash) |
GPIO1 | UART0 TX | Used by logger by default |
GPIO2 | Boot mode + general IO | Must be HIGH at boot; secondary UART TX |
GPIO3 | UART0 RX | Used by logger by default |
GPIO6–GPIO11 | Flash SPI bus | Do not use — connected to internal flash |
GPIO12 | SPI MISO | |
GPIO13 | SPI MOSI | |
GPIO14 | SPI CLK | |
GPIO15 | Boot mode + SPI CS | Must be LOW at boot |
GPIO16 | RTC / Deep-sleep wakeup | Only pull-down, no pull-up |
GPIO17 / TOUT | ADC input only | 0–1.0 V range |
Safe General-Purpose Pins
GPIO4, GPIO5, GPIO12, GPIO13, GPIO14 are the safest pins for general use — they have no boot-mode restrictions and no special hardware connections on most modules.
Complete Example with State Persistence
Boot Mode Detection
The ESP8266 reads three strapping pins at reset to determine its boot mode:GPIO0 | GPIO2 | GPIO15 | Mode |
|---|---|---|---|
| HIGH | HIGH | LOW | Normal — boot from flash |
| LOW | HIGH | LOW | Download mode (UART flashing) |
| ANY | ANY | HIGH | Boot from SD card |
boot mode:(X,Y) where the first number indicates the selected mode.
Crash Detection
ESPHome automatically captures crash data (exception cause, fault PC, stack return addresses) from the previous boot and logs it atERROR level on startup. No configuration is required.
Electrical Characteristics
| Parameter | Min | Typical | Max | Unit |
|---|---|---|---|---|
| Operating temperature | -40 | — | 125 | °C |
| Supply voltage (V_IO) | 2.5 | 3.3 | 3.6 | V |
| Max GPIO current | — | — | 12 | mA |
| Deep sleep current | — | 20 | — | µA |
| Active mode current | — | 120 | — | mA |
Set
early_pin_init: false on any device that controls a relay or switch. The default true value drives pins to their initial state before ESPHome code runs, which causes a brief unwanted toggle during firmware updates and restarts.