Skip to main content

ESPHome

ESPHome is a powerful open-source framework for creating custom firmware for ESP8266, ESP32, and similar microcontrollers. It allows you to easily configure sensors, switches, lights, and other devices using simple YAML files, and integrates seamlessly with Home Assistant for smart home automation.

Features and Possibilities

  • Easy Configuration: Define device behavior and integrations using YAML, no coding required for most use cases.
  • Wide Device Support: Works with ESP8266, ESP32, and a huge variety of sensors, actuators, displays, and modules.
  • Home Assistant Integration: Automatic device discovery, entity creation, and control from the Home Assistant dashboard.
  • OTA Updates: Update firmware wirelessly from your browser or Home Assistant.
  • Custom Components: Extend ESPHome with custom sensors, switches, and logic using C++ or Lambda expressions.
  • Low Power: Suitable for battery-powered sensors and devices with deep sleep and power management features.
  • Secure: Supports encrypted connections, authentication, and API passwords.
  • Automation: Trigger automations locally or via Home Assistant, including sensor thresholds, button presses, and more.
  • Logging and Debugging: Real-time logs and diagnostics via web or serial connection.
  • Community Add-ons: Large ecosystem of community-contributed components and examples.

Typical Use Cases

  • Smart temperature, humidity, and air quality sensors
  • Wireless light switches and dimmers
  • Relay modules for controlling appliances
  • Door/window sensors and motion detectors
  • LED strips and RGB lighting control
  • Energy monitoring and power metering
  • Display panels and status indicators

Example: ESPHome YAML for a Temperature and Humidity Sensor

esphome:
name: livingroom_sensor
platform: ESP8266
board: nodemcuv2

wifi:
ssid: "your_wifi_ssid"
password: "your_wifi_password"

sensor:
- platform: dht
pin: D2
temperature:
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
model: DHT22

api:
password: "your_api_password"

ota:
password: "your_ota_password"

Example: ESPHome Switch Configuration

switch:
- platform: gpio
pin: 5
name: "Desk Lamp"

Example: ESPHome Binary Sensor for Door

binary_sensor:
- platform: gpio
pin:
number: D1
mode: INPUT_PULLUP
inverted: true
name: "Front Door"

Example: ESPHome Automation (Turn on Light When Motion Detected)

binary_sensor:
- platform: gpio
pin: D2
name: "Motion Sensor"
on_press:
then:
- switch.turn_on: relay

switch:
- platform: gpio
pin: D5
id: relay
name: "Relay"

Example: ESPHome LED Strip Control

light:
- platform: neopixelbus
type: GRB
pin: D4
num_leds: 30
name: "Living Room LED Strip"

Example: ESPHome Display Integration

display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
lambda: |-
it.print(0, 0, id(font1), "Hello, ESPHome!");

ESPHome makes it easy to build custom smart devices and integrate them into Home Assistant. With simple configuration, powerful features, and a vibrant community, you can automate and monitor your home exactly