Table of Contents
ESPHome is a system for controlling ESP32 and ESP8266 devices using simple YAML configuration files. Write what you want in YAML, and ESPHome generates optimised C++ firmware, compiles it, and uploads it — all without writing a single line of Arduino code. Combined with Home Assistant, it is the most seamless smart home development experience available.
What is ESPHome
ESPHome was created by Otto Winter and is now maintained by Nabu Casa (the company behind Home Assistant). Key features:
- YAML-based: No C++ or Arduino coding required
- 1,000+ components: Sensors, displays, LEDs, motors, and more
- Native API: Direct integration with Home Assistant (faster than MQTT)
- OTA updates: Update devices wirelessly — no USB cable after first flash
- Web server: Built-in web UI on each device for standalone control
- Bluetooth proxy: ESP32 as Bluetooth LE proxy for Home Assistant
Installing ESPHome
Install ESPHome using one of these methods:
# Method 1: pip install (any machine)
pip install esphome
# Method 2: Docker
docker pull esphome/esphome
docker run -d -p 6052:6052 -v /path/to/config:/config esphome/esphome
# Method 3: Home Assistant Add-on (recommended)
# Go to Settings > Add-ons > ESPHome > Install
For Indian users running Home Assistant on Raspberry Pi, the add-on method is the easiest — one click and you are ready.
Your First ESPHome Configuration
Create a file named weather_station.yaml:
esphome:
name: weather-station
friendly_name: Weather Station
esp32:
board: esp32dev
wifi:
ssid: "YOUR_WIFI_SSID"
password: "YOUR_WIFI_PASSWORD"
# Fallback hotspot if WiFi fails
ap:
ssid: "Weather-Station-AP"
password: "fallback123"
# Enable Home Assistant API
api:
encryption:
key: "auto-generated-key"
# Enable OTA updates
ota:
password: "your-ota-password"
# Enable web server for standalone access
web_server:
port: 80
# Logging
logger:
# DHT22 sensor on GPIO4
sensor:
- platform: dht
pin: GPIO4
model: DHT22
temperature:
name: "Temperature"
unit_of_measurement: "°C"
accuracy_decimals: 1
humidity:
name: "Humidity"
unit_of_measurement: "%"
accuracy_decimals: 1
update_interval: 30s
# Compile and upload
esphome run weather_station.yaml
# For first flash via USB:
esphome run weather_station.yaml --device /dev/ttyUSB0
# Subsequent updates happen OTA automatically
Components for ESPHome Weather Station
Sensor Integration Examples
ESPHome supports a vast library of sensors. Here are popular examples:
# BME280 (I2C) - Temperature, Humidity, Pressure
sensor:
- platform: bme280_i2c
address: 0x76
temperature:
name: "BME280 Temperature"
humidity:
name: "BME280 Humidity"
pressure:
name: "BME280 Pressure"
update_interval: 60s
# Ultrasonic distance sensor (HC-SR04)
- platform: ultrasonic
trigger_pin: GPIO5
echo_pin: GPIO18
name: "Water Tank Level"
update_interval: 10s
# DS18B20 waterproof temperature
- platform: dallas_temp
address: 0x1234567890ABCDEF
name: "Water Temperature"
update_interval: 30s
Sensors Supported by ESPHome
Home Assistant Auto-Discovery
ESPHome devices appear in Home Assistant automatically:
- ESPHome device connects to your WiFi network
- Home Assistant discovers it via mDNS
- Click Configure in the notification
- Enter the API encryption key
- All sensors and controls appear as Home Assistant entities
The native API is faster and more efficient than MQTT — updates arrive in milliseconds with minimal overhead.
Automations on the Device
Run automations directly on the ESP32 — they work even without Home Assistant:
# Turn on LED when temperature exceeds threshold
binary_sensor:
- platform: gpio
pin: GPIO13
name: "Motion Sensor"
on_press:
- light.turn_on: status_led
- delay: 60s
- light.turn_off: status_led
light:
- platform: binary
name: "Status LED"
id: status_led
output: led_output
output:
- platform: gpio
id: led_output
pin: GPIO2
# Interval-based automation
interval:
- interval: 5min
then:
- if:
condition:
sensor.in_range:
id: temperature
above: 40
then:
- switch.turn_on: cooling_fan
Advanced Features: Display, Bluetooth, OTA
ESPHome’s advanced features make it suitable for complex projects:
- Displays: Drive OLED, TFT, and e-Paper displays with YAML configuration
- Bluetooth Proxy: ESP32 acts as a Bluetooth LE relay for Home Assistant, extending Bluetooth range
- Voice Assistant: ESP32-S3 with microphone for local voice control
- Custom components: Write C++ lambdas when YAML is not enough
- Packages: Share common configurations across multiple devices
Frequently Asked Questions
Is ESPHome better than Tasmota?
For Home Assistant users, ESPHome is generally better due to its native API integration, YAML-based configuration, and deeper HA integration. Tasmota is better for standalone use with its web UI and for pre-built commercial devices.
Can I use ESPHome without Home Assistant?
Yes. ESPHome devices include a built-in web server for standalone control. You can also use MQTT for integration with other platforms like Node-RED or OpenHAB.
Does ESPHome support ESP32-S3?
Yes, ESP32-S3 is fully supported. Use esp32: board: esp32-s3-devkitc-1 in your YAML configuration.
How many sensors can one ESP32 handle with ESPHome?
An ESP32 can comfortably handle 20-30 sensors with ESPHome. The limit depends on available GPIO pins (34 on ESP32), memory (520 KB SRAM), and the update interval of each sensor.
{“@context”: “https://schema.org”, “@type”: “FAQPage”, “mainEntity”: [{“@type”: “Question”, “name”: “Is ESPHome better than Tasmota?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “For Home Assistant users, ESPHome is generally better due to its native API integration, YAML-based configuration, and deeper HA integration. Tasmota is better for standalone use with its web UI and for pre-built commercial devices.”}}, {“@type”: “Question”, “name”: “Can I use ESPHome without Home Assistant?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Yes. ESPHome devices include a built-in web server for standalone control. You can also use MQTT for integration with other platforms like Node-RED or OpenHAB.”}}, {“@type”: “Question”, “name”: “Does ESPHome support ESP32-S3?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “Yes, ESP32-S3 is fully supported. Use esp32: board: esp32-s3-devkitc-1 in your YAML configuration.”}}, {“@type”: “Question”, “name”: “How many sensors can one ESP32 handle with ESPHome?”, “acceptedAnswer”: {“@type”: “Answer”, “text”: “An ESP32 can comfortably handle 20-30 sensors with ESPHome. The limit depends on available GPIO pins (34 on ESP32), memory (520 KB SRAM), and the update interval of each sensor.”}}]}
Ready to Build Your IoT Project?
Browse our complete collection of ESP32 boards, sensors, and IoT components. Fast shipping across India with technical support.
Add comment