Sitemap

ESPHome for managing ESP32 Microcontrollers

3 min readMay 4, 2025
Generated by DALL-E

Ever wanted to build your own Wi-Fi-connected sensor, switch, or display for your smart home, but felt intimidated by complex programming? Meet your new best friends: the ESP32 microcontroller and the ESPHome framework.

  • ESP32: A tiny, affordable, yet powerful chip with built-in Wi-Fi and Bluetooth. It’s the perfect brain for countless DIY IoT projects.
  • ESPHome: A system that lets you configure your ESP32 devices using simple YAML files. You describe what sensors or switches are connected and what they should do.

This short post will check how to run ESP32home in Docker and connect your microcontroller.

Set up with Docker Compose

Docker and Docker Compose need to be installed on the machine where you want to host them. Below are the steps for the configuration:

  1. Create a folder for your ESPHome stuff (e.g., mkdir esphome32 && cd my-esphome32).

2. Create a subfolder for your configuration files: mkdir config.

3. Create a docker-compose.yml file with the following content:

version: '3.7'
services:
esphome:
container_name: esphome
# Use 'latest' or pin to a specific version like '2025.4.0'
image: esphome/esphome:latest
ports:
# Exposes the web UI on port 6052
- "6052:6052"
volumes:
# Mounts your local './config' folder into the container
# Your device YAML files will live here!
- ./config:/config
# Mounts localtime for correct time inside container (optional but good)
- /etc/localtime:/etc/localtime:ro
# Use host network mode for easier device discovery (mDNS)
# Essential for finding devices wirelessly!
network_mode: host
restart: unless-stopped

4. Start it up! Run docker-compose up -d in your terminal (in the esphome32 folder).

5. Access the UI: Open your browser to http://<your-docker-host-ip>:6052 (replace <your-docker-host-ip> With the IP address of the machine running Docker, often http://localhost:6052 if running locally).

Now ESPHome is up and running!

The next step is to add the configuration for the ESP32 microcontroller. I have connected ESP32-C6 to my laptop via USB(COM6) and it's detected in the browser as well.

Once you add the device, add the credentials like the Wi-Fi password. The configuration YAML file will be stored in the config folder of the container and will be persistent. Once finalized, install the configuration on the device

# Sample file
esphome:
name: abc
friendly_name: ABC

esp32:
board: esp32-c6-devkitc-1
variant: esp32c6
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y
version: 5.1.2
platform_version: 6.5.0
source: https://github.com/tasmota/esp-idf/releases/download/v5.1.2.240221/esp-idf-v5.1.2.zip

# Enable logging
logger:
level: DEBUG

# Enable Home Assistant API
api:
encryption:
key: "hidden"

That's all it requires to configure.

Conclusion

Making custom smart devices with powerful ESP32 boards is surprisingly easy, thanks to ESPHome. Instead of writing complex code, you simply describe what you want in plain text configuration files. Setting up ESPHome is quite manageable, especially using tools like Docker. So grab an ESP32, give ESPHome a try, and start bringing your creative smart gadget ideas to life!

References

In case of any queries, please feel free to connect with me via the social links below

--

--

Renjith Ravindranathan
Renjith Ravindranathan

Written by Renjith Ravindranathan

DevOps by day, dad and traveler by heart. I have a soft spot for breathing new life into old tech. Currently calling the Netherlands home.

No responses yet