ESPHome Troubleshooting Guide
Comprehensive error message lookup table with solutions for compilation errors, runtime issues, configuration problems, and hardware failures.
Quick Error Lookup
| Error Message | Category | Quick Fix |
|---|---|---|
| "Unknown platform" | Config | Check component name spelling |
| "GPIO already in use" | GPIO | Check pin assignments for duplicates |
| "Could not compile" | Compilation | Check YAML syntax, indentation |
| "WiFi connection failed" | Network | Verify SSID/password, check signal |
| "Sensor not found" | Hardware | Check I²C address, verify wiring |
| "OTA upload failed" | OTA | Check device reachable, restart |
| "Invalid pin" | GPIO | Use valid GPIO for platform |
| "YAML syntax error" | Config | Check indentation (2 spaces, no tabs) |
| "API connection timeout" | Network | Check firewall, API encryption key |
| "Flash size too small" | Platform | Reduce features or use larger flash |
Compilation Errors
Error: "Unknown platform"
Full Error:
Platform 'xyz' doesn't exist
Unknown platform: xyzCause: Misspelled platform name or unsupported platform
Solutions:
- Check platform spelling in ESPHome documentation
- Ensure platform exists for component
- Update ESPHome to latest version (platform may be new)
Example Fix:
# WRONG
sensor:
- platform: dht11 # Wrong platform name
# CORRECT
sensor:
- platform: dht
model: DHT11 # Specify model insteadError: "GPIO already in use"
Full Error:
Pin GPIO21 is already in use by component 'i2c'
GPIO21 already usedCause: Same GPIO pin assigned to multiple components
Solutions:
- List all GPIO usage in config
- Find duplicate assignments
- Reassign one component to different pin
- Check I²C/SPI default pins not conflicting
Example Fix:
# WRONG - GPIO21 used twice
i2c:
sda: GPIO21
scl: GPIO22
switch:
- platform: gpio
pin: GPIO21 # CONFLICT!
# CORRECT - Use different pin
i2c:
sda: GPIO21
scl: GPIO22
switch:
- platform: gpio
pin: GPIO23 # Different pinError: "Could not compile"
Full Error:
Failed to compile firmware
Compilation failedCauses:
- YAML syntax error (indentation, missing colon)
- Invalid configuration values
- Missing required fields
- Incompatible component versions
Solutions:
- Run
esphome config device.yamlto validate YAML - Check indentation (use 2 spaces, not tabs)
- Verify all required fields present
- Check ESPHome version compatibility
- Review compilation error logs for specific issue
Common YAML Syntax Fixes:
# WRONG - Tab indentation
sensor:
→ - platform: dht # Tab character
# CORRECT - 2 space indentation
sensor:
- platform: dht # 2 spaces
# WRONG - Missing colon
sensor
- platform: dht
# CORRECT - Colon after key
sensor:
- platform: dhtError: "Invalid pin for platform"
Full Error:
GPIO34 cannot be used as output on ESP32
Pin GPIO1 is not available on ESP8266Cause: Using input-only pin for output, or unavailable pin
Solutions:
- Check GPIO pinout reference for platform
- Use output-capable pins for switches/LEDs
- Use input-only pins (GPIO34-39 ESP32) only for sensors
- Avoid flash pins (GPIO6-11)
Example Fix:
# WRONG - GPIO34 is input-only on ESP32
switch:
- platform: gpio
pin: GPIO34 # Cannot be used as output
# CORRECT - Use output-capable pin
switch:
- platform: gpio
pin: GPIO23 # Output-capableRefer to: references/gpio-pinouts.md for complete pin capabilities
Error: "YAML syntax error"
Full Error:
expected <block end>, but found '-'
mapping values are not allowed hereCause: Invalid YAML syntax (indentation, structure)
Solutions:
- Validate YAML with online validator
- Check indentation (2 spaces per level)
- Ensure no tabs (use spaces only)
- Verify list items start with
- - Check quotes around special characters
Common YAML Fixes:
# WRONG - Incorrect indentation
sensor:
- platform: dht
pin: GPIO4
# CORRECT - Consistent 2-space indentation
sensor:
- platform: dht
pin: GPIO4
# WRONG - Missing dash for list item
sensor:
platform: dht
pin: GPIO4
# CORRECT - Dash for list item
sensor:
- platform: dht
pin: GPIO4Error: "Flash size too small"
Full Error:
Firmware is too large (1234567 bytes), maximum is 1048576 bytes
Sketch too bigCause: Firmware exceeds available flash memory
Solutions:
- Reduce features (remove unused components)
- Disable logger or reduce log level
- Disable web_server if not needed
- Use framework: arduino instead of esp-idf (smaller)
- For ESP8266: Use larger flash size in board config
Example Fixes:
# Reduce logging
logger:
level: WARN # Instead of DEBUG or VERBOSE
# Disable web server
# web_server: # Comment out if not needed
# Use minimal logger
logger:
baud_rate: 0 # Disable serial loggingRuntime Errors
Error: "WiFi connection failed"
Full Error:
WiFi: Can't connect to network 'SSID'
Connection failed
WiFi: Not connectedCauses:
- Incorrect SSID or password
- Weak WiFi signal
- 5GHz network (ESP8266/ESP32 only support 2.4GHz)
- MAC filtering on router
- DHCP exhausted
Solutions:
- Verify SSID and password in secrets.yaml
- Check WiFi signal strength (move closer to AP)
- Ensure using 2.4GHz network (not 5GHz)
- Check router MAC filter allow list
- Use static IP if DHCP issues
- Verify WiFi credentials are in quotes if contain special characters
Example Fixes:
# Use static IP to avoid DHCP issues
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.1.100
gateway: 192.168.1.1
subnet: 255.255.255.0
# Quote special characters
# secrets.yaml
wifi_password: "P@ssw0rd!" # Quote if contains special charsError: "API connection timeout"
Full Error:
Connection timeout
Can't connect to ESPHome API
API client connection timeoutCauses:
- Firewall blocking connection
- Incorrect API encryption key
- Device not reachable on network
- mDNS not working
- Port 6053 blocked
Solutions:
- Verify device IP address (check router DHCP table)
- Use IP address instead of .local hostname
- Check API encryption key matches Home Assistant
- Disable firewall temporarily to test
- Verify port 6053 not blocked
- Restart device and Home Assistant
Example Fixes:
# Ensure API encryption key matches Home Assistant
api:
encryption:
key: !secret api_encryption_key # Must match HA integration
# Use static IP for reliability
wifi:
manual_ip:
static_ip: 192.168.1.100Check connectivity:
# Ping device
ping 192.168.1.100
# Check logs
esphome logs device.yaml
# Connect via IP instead of hostname
# In Home Assistant: 192.168.1.100 instead of device.localError: "Sensor not found"
Full Error:
I2C: Device not found at address 0x76
Sensor 'xyz' not responding
No sensor detectedCauses:
- Incorrect I²C address
- Wiring issue (loose connection, wrong pins)
- Sensor not powered
- Pull-up resistors missing (for I²C)
- Incompatible voltage (3.3V vs 5V)
Solutions:
- Use
scan: truein i2c config to detect devices - Check wiring connections
- Verify correct I²C address (common: 0x76, 0x77 for BME280)
- Add pull-up resistors (4.7kΩ) on SDA/SCL if needed
- Check sensor power supply voltage
- Try different I²C pins
Example Debugging:
# Enable I2C scan to detect devices
i2c:
sda: GPIO21
scl: GPIO22
scan: true # Shows detected I2C addresses in logs
sensor:
- platform: bme280
address: 0x76 # Try 0x76 or 0x77
# ...Check logs:
I2C: Found device at address 0x76 # Sensor detected
I2C: Found device at address 0x77 # Sensor detected
I2C: No devices found # Check wiringError: "OTA upload failed"
Full Error:
OTA update failed
Upload failed
Connection lost during uploadCauses:
- Device unreachable on network
- Incorrect OTA password
- Insufficient flash space
- Device rebooted during upload
- Weak WiFi signal
- Firewall blocking connection
Solutions:
- Verify device reachable (ping IP address)
- Check OTA password matches
- Restart device before OTA update
- Move device closer to WiFi AP
- Use wired upload (USB) if OTA keeps failing
- Clear flash and re-upload via USB
Example Fixes:
# Ensure OTA configured correctly
ota:
- platform: esphome
password: !secret ota_password # Must match
# Increase safe_mode boot timeout
ota:
- platform: esphome
safe_mode: true
reboot_timeout: 10min # More time for unstable connectionsRecovery steps:
# 1. Try OTA update with verbose logging
esphome upload device.yaml --device 192.168.1.100
# 2. If OTA fails, use USB upload
esphome upload device.yaml --device /dev/ttyUSB0
# 3. Last resort: factory reset
# Hold BOOT button, press RESET, release BOOT
# Then upload via USBConfiguration Errors
Error: "Missing required field"
Full Error:
Required option 'name' not specified
Missing required field: 'pin'Cause: Required configuration field not provided
Solutions:
- Check component documentation for required fields
- Add missing field to configuration
- Verify field name spelling
Example Fixes:
# WRONG - Missing name
sensor:
- platform: dht
pin: GPIO4
# CORRECT - Name required
sensor:
- platform: dht
pin: GPIO4
temperature:
name: "Temperature" # Required
humidity:
name: "Humidity" # RequiredError: "Invalid configuration value"
Full Error:
Invalid value for 'update_interval': '10'
Value must be a time periodCause: Configuration value has wrong type or format
Solutions:
- Check expected value type (string, number, boolean)
- Use correct units for time periods (s, min, h)
- Quote strings if needed
- Use correct format for enums
Example Fixes:
# WRONG - Missing time unit
sensor:
- platform: dht
update_interval: 60 # Missing 's'
# CORRECT - Include time unit
sensor:
- platform: dht
update_interval: 60s # Correct
# WRONG - Incorrect enum value
sensor:
- platform: adc
attenuation: 11 # Should be 11db
# CORRECT - Use correct enum
sensor:
- platform: adc
attenuation: 11db # CorrectError: "Conflicting ID"
Full Error:
ID 'sensor_id' is already in use
Duplicate ID: 'my_sensor'Cause: Same ID used for multiple components
Solutions:
- Ensure each component has unique ID
- Search config for duplicate ID names
- Use descriptive, unique ID names
Example Fixes:
# WRONG - Duplicate ID
sensor:
- platform: dht
id: temp_sensor # Duplicate!
temperature:
name: "Room Temp"
- platform: bme280
id: temp_sensor # Duplicate!
temperature:
name: "Outside Temp"
# CORRECT - Unique IDs
sensor:
- platform: dht
id: room_temp_sensor # Unique
temperature:
name: "Room Temp"
- platform: bme280
id: outside_temp_sensor # Unique
temperature:
name: "Outside Temp"Hardware Issues
Issue: "Sensor readings are incorrect"
Symptoms:
- Temperature reads 0°C or -127°C
- Humidity reads 0%
- Distance sensor reads infinity
- Readings jump erratically
Causes:
- Sensor not connected properly
- Pull-up resistors missing (I²C, 1-Wire)
- Voltage mismatch (3.3V vs 5V)
- Sensor failure
- Interference from other devices
- Update interval too fast
Solutions:
- Check all wiring connections
- Add pull-up resistors (4.7kΩ) for I²C/1-Wire
- Verify sensor voltage requirements
- Increase update_interval (>2s for DHT, >30s for BME280)
- Add filters to smooth readings
- Move sensor away from interference sources
- Test sensor with different ESP device
Example Fixes:
# Add filters to smooth noisy readings
sensor:
- platform: dht
pin: GPIO4
temperature:
name: "Temperature"
filters:
- sliding_window_moving_average:
window_size: 5
send_every: 5
- filter_out: nan # Filter out invalid readings
humidity:
name: "Humidity"
filters:
- sliding_window_moving_average:
window_size: 5
send_every: 5
- filter_out: nan
update_interval: 60s # Slower = more reliable
# For 1-Wire sensors (DS18B20)
dallas:
- pin: GPIO4
update_interval: 60s
sensor:
- platform: dallas
filters:
- filter_out: 85.0 # Filter out sensor error value
- filter_out: nanIssue: "Device keeps rebooting"
Symptoms:
- Device reboots every few seconds
- Boot loop
- Cannot connect to device
Causes:
- Power supply insufficient
- Brownout detector triggered
- Watchdog timeout (infinite loop in lambda)
- Memory overflow
- Bad flash
- Incorrect GPIO state at boot
Solutions:
- Use adequate power supply (5V 1A minimum, 2A recommended)
- Disable brownout detector (ESP32)
- Check lambdas for infinite loops
- Reduce memory usage (remove unused components)
- Reflash firmware via USB
- Check strapping pins not pulled wrong at boot
Example Fixes:
# Disable brownout detector (ESP32 only)
esp32:
board: esp32dev
framework:
type: arduino
version: recommended
variant: esp32
# Add this to disable brownout:
# platformio_options:
# board_build.f_cpu: 240000000L
# board_build.f_flash: 40000000L
# board_build.flash_mode: dio
# board_build.partitions: default.csv
# Increase watchdog timeout if needed
ota:
- platform: esphome
safe_mode: true
reboot_timeout: 10min # More time before rebootPower supply recommendations:
- ESP32: 5V 1A minimum (2A recommended with peripherals)
- ESP8266: 5V 500mA minimum (1A recommended)
- Use dedicated power supply (not USB from computer)
- Add decoupling capacitors (10μF, 100nF) near ESP module
Issue: "Relay not switching"
Symptoms:
- Relay clicks but load doesn't switch
- No relay click at all
- Relay switches opposite direction
Causes:
- Insufficient drive current
- Inverted logic
- Wrong GPIO pin configuration
- Relay powered from wrong voltage
- Relay coil voltage mismatch
Solutions:
- Use transistor/MOSFET driver for relay coil
- Check inverted configuration
- Verify GPIO is output-capable
- Power relay from external 5V (not ESP)
- Check relay coil voltage rating
- Use relay module (has built-in driver circuit)
Example Fixes:
# Check inverted setting
switch:
- platform: gpio
pin:
number: GPIO23
inverted: false # Try true if relay switches opposite
name: "Relay"
# For active-low relay modules
switch:
- platform: gpio
pin:
number: GPIO23
inverted: true # Active-low relay module
name: "Relay"
restore_mode: RESTORE_DEFAULT_OFF # Ensure off at bootWiring check:
ESP32 Relay Module
GPIO23 --> IN
GND --> GND
VCC not connected (relay module powered externally from 5V)Network Issues
Issue: "Device keeps disconnecting"
Symptoms:
- WiFi disconnects every few minutes
- API unavailable intermittently
- Logs show reconnection messages
Causes:
- Weak WiFi signal
- Power supply insufficient
- Router DHCP lease timeout
- WiFi power saving mode
- Network congestion
- ESP32 Bluetooth interference (if enabled)
Solutions:
- Move device closer to WiFi AP
- Use better power supply
- Configure static IP
- Disable WiFi power saving
- Disable Bluetooth on ESP32
- Use 2.4GHz-only WiFi network
Example Fixes:
# Disable WiFi power saving
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: NONE # Disable power saving (ESP32)
# or
output_power: 20db # Increase TX power (ESP32)
# Use static IP for stability
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.1.100
gateway: 192.168.1.1
subnet: 255.255.255.0
# Increase reboot timeout
api:
reboot_timeout: 15min # More time before reboot on disconnectDebugging Techniques
Enable Verbose Logging
logger:
level: VERBOSE # DEBUG, VERBOSE, or VERY_VERBOSE
logs:
component: VERBOSE # Log specific componentUse Serial Logging
# Monitor serial output
esphome logs device.yaml
# Or use platformio
pio device monitorEnable I²C Scan
i2c:
sda: GPIO21
scl: GPIO22
scan: true # Shows detected I2C devicesCheck WiFi Signal
sensor:
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60sMonitor Uptime
sensor:
- platform: uptime
name: "Uptime"Use Safe Mode
ota:
- platform: esphome
safe_mode: true # Boots without sensors if errors occurRecovery Procedures
Factory Reset
- Hold BOOT button
- Press RESET button briefly
- Release BOOT button after 2 seconds
- Device enters flash mode
- Upload firmware via USB
Clear Flash
# Erase entire flash
esptool.py --port /dev/ttyUSB0 erase_flash
# Then upload firmware
esphome upload device.yaml --device /dev/ttyUSB0Safe Mode Recovery
If device is stuck in boot loop with OTA enabled:
- Device will boot into safe mode after failed boots
- Connect via OTA (device will have .safe suffix)
- Upload working firmware
Common Error Patterns
Pattern 1: Boot Loop After OTA
Symptoms: Device reboots continuously after OTA update
Solution:
- Wait for safe mode (automatic after ~10 failed boots)
- Upload previous working firmware
- Fix issue in new firmware
- Verify GPIO states at boot
Pattern 2: I²C Device Not Found
Symptoms: scan: true shows no devices
Solution:
- Check SDA/SCL connections
- Add 4.7kΩ pull-up resistors
- Try different I²C pins
- Verify sensor power supply
- Test sensor with Arduino first
Pattern 3: GPIO Conflict
Symptoms: Device boots but feature doesn't work
Solution:
- List all GPIO usage
- Check I²C/SPI default pins
- Avoid strapping pins (GPIO0, 2, 12, 15)
- Use gpio-pinouts.md reference
Pattern 4: Memory Issues
Symptoms: Random crashes, heap warnings in logs
Solution:
- Reduce features
- Disable web_server
- Lower logger level
- Remove unused components
- Use framework: arduino (smaller than esp-idf)
Summary of Quick Fixes
- YAML errors → Check indentation (2 spaces, no tabs)
- GPIO conflicts → List all pins, check for duplicates
- WiFi issues → Verify credentials, use static IP
- I²C not found → Enable scan, check wiring, add pull-ups
- Sensor errors → Increase update_interval, add filters
- OTA fails → Restart device, use USB upload
- Boot loops → Check power supply, disable brownout
- API timeout → Verify encryption key, use IP not .local
Always check:
- Logs with
esphome logs device.yaml - GPIO pinout reference
- ESPHome documentation for component
When stuck: Start with minimal config, add components one by one to isolate issue