Skip to content

ESPHome on Wemos D1 Mini

This guide covers the installation and configuration of ESPHome for the Wemos D1 Mini, a popular and affordable ESP8266-based development board.

  • Hardware: Wemos D1 Mini (or clone), Micro-USB cable (ensure it supports data, not just charging).
  • Software: Python installed (for CLI) or a browser with Web Serial support (Chrome/Edge) for the web dashboard.
Section titled “Option 1: Web Dashboard (Recommended for Beginners)”
  1. Connect your Wemos D1 Mini to your computer via USB.
  2. Go to web.esphome.io.
  3. Click Connect and select the COM port associated with your device.
  4. Follow the on-screen instructions to prepare your device for the first time.

If you prefer the terminal, you can install ESPHome via pip:

Terminal window
pip install esphome

Create a new YAML file (e.g., living-room.yaml) with the following basic configuration for a Wemos D1 Mini.

esphome:
name: living-room-sensor
friendly_name: Living Room Sensor
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
# Enable Over-The-Air updates
ota:
- platform: esphome
wifi:
ssid: "YourWiFiName"
password: "YourWiFiPassword"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Living-Room-Sensor Fallback Hotspot"
password: "fallback_password"
captive_portal:

The Wemos D1 Mini pins map to ESP8266 GPIOs as follows:

LabelGPIOFunction
D0GPIO16Wake
D1GPIO5I2C SCL
D2GPIO4I2C SDA
D3GPIO0Flash
D4GPIO2TX1 / LED
D5GPIO14SPI CLK
D6GPIO12SPI MISO
D7GPIO13SPI MOSI
D8GPIO15SPI CS

Never hardcode passwords in your main configuration files, especially if you commit them to Git. Use a secrets.yaml file.

secrets.yaml:

wifi_ssid: "MyHomeNetwork"
wifi_password: "SuperSecretPassword"

living-room.yaml:

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

Assigning a static IP can make connections faster and more reliable, although mDNS (.local address) usually works well.

wifi:
# ... existing config ...
manual_ip:
static_ip: 192.168.1.50
gateway: 192.168.1.1
subnet: 255.255.255.0

Always keep the captive_portal and ap (Access Point) configuration. If your WiFi credentials change or the device cannot connect, it will spawn its own WiFi network that you can connect to and upload a new configuration.

The Wemos D1 Mini has a small 3.3V regulator.

  • Do not power high-current devices (like motors or long LED strips) directly from the 3.3V pin.
  • Use the 5V pin (connected to USB power) for relays or sensors that support 5V, or use an external power supply.

Keep the logger: component enabled. When debugging, you can view logs wirelessly:

Terminal window
esphome logs living-room.yaml

Connect a DHT11 sensor to pin D2 (GPIO4).

sensor:
- platform: dht
pin: D2
temperature:
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
update_interval: 60s