SUMMARY From breadboard to a sensor that runs for months untouched: ESPHome firmware, MQTT discovery into Home Assistant, deep sleep + OTA.
PREREQUISITES
- ESP32 devkit + sensor (BME280)
- a running Home Assistant with an MQTT broker
Firmware — the ESPHome config
The base is YAML with BME280 over I2C, a deep sleep interval and MQTT discovery. The first flash goes over USB, every later one over OTA.
COMMAND
esphome run senzor.yaml
Integrating into Home Assistant
The device shows up through MQTT discovery — check the entities and assign an area.
OTA and long-term operation
Deep sleep, watchdog and OTA updates — what actually keeps the sensor alive for months.
WARNING Deep sleep under 5 minutes shortens battery life sharply — waking costs more energy than the measurement itself.