ESP32 with ESPHome and Home Assistant: where to start

The shortest route from a blank ESP32 to sensors in Home Assistant, and when plain Arduino code or MQTT is the better choice.

There are three ways to make an ESP32 talk to Home Assistant. Pick by how much you want to write.

ESPHome

You describe the board and the sensors in a short YAML file, and ESPHome builds the firmware. The device shows up in Home Assistant by itself. It is the quickest path for common sensors and relays.

Arduino with MQTT

You write the code and publish values to a broker. It is more work, but it suits custom logic, and the device keeps running with no Home Assistant at all.

Your own HTTP or Telegram interface

Fine for a single device. It does not scale to a dashboard of many.

First flash and updates

The first upload must go over USB, and the web flasher on this site can do it from Chrome or Edge. After that you can update over the air.

Habits that save pain

  • Give each device a fixed address or a reservation in the router.
  • Keep the logic that protects things, such as turning off a heater, on the device rather than in Home Assistant, so it still works when the server is down.
  • Add a sensor that reports uptime and Wi-Fi signal. It shows resets and weak links at once.
  • Remember that the server also needs power during an outage.

Tools that help

  • Sketch generator — Pick a board and sensors (DHT22, BME280, DS18B20, relay, INA219, OLED, MQ-2) and get a working Arduino sketch, wiring table and parts list.
  • Web flasher — Flash ESP32 over USB right from Chrome or Edge using Web Serial: pick a ready firmware or upload your own .bin file.

Projects related to this guide

⛔ High risk

High-current battery: a short circuit can start a fire. Put a fuse next to the battery plus, use thick enough wires and respect the BMS limits.

Battery BMS over Bluetooth bridge

A bare ESP32-C3 reads a JK or Daly BMS over Bluetooth and publishes cells, current and charge to Home Assistant, with nothing else to buy.

  • Board ESP32-C3 SuperMini
  • Level ●●○ Intermediate
  • Build time 1–2 h
Pick parts / kit
⚠ Caution

Batteries: watch polarity, use protected cells and a charger with protection, never charge damaged cells unattended.

ESP-NOW sensor network with one gateway

Several battery nodes send readings over ESP-NOW without joining Wi-Fi, and one gateway forwards them to MQTT or Home Assistant.

  • Board ESP32-C3 SuperMini
  • Level ●●● Advanced
  • Build time 2–4 h
Pick parts / kit

Presence-based lighting with mmWave

A mmWave sensor notices even a person sitting still, a light sensor keeps the lamp off in daylight, and the light fades out after the room is really empty.

  • Board ESP32-C3 SuperMini
  • Level ●●○ Intermediate
  • Build time 2–3 h
Pick parts / kit

Read next

← All guides

Comments

No comments yet. Share your experience or ask a question.

Comments are moderated.