DIY Electronics
— Building circuits, programming microcontrollers, and making things blinkESP32-S3 with camera module for a wildlife motion detector
Home Automation with MQTT and ESP8266
My whole house runs on a MQTT broker (Mosquitto on a Pi) and about 20 ESP8266 nodes. Here's the architecture that has been stable for two years without a single manual intervention.
Each node subscribes to a cmnd/<room>/<device> topic and publishes state to stat/<room>/<device>. All nodes use MQTT retained messages so a restarted broker immediately re-syncs all device states. OTA updates go through a separate ota/<device> topic — the node downloads a firmware binary URL and calls Update.begin(). Node-RED handles the automation logic and forwards to a Grafana dashboard for historical data via InfluxDB.
The key reliability pattern is MQTT last-will messages. If a node goes offline unexpectedly, the broker publishes OFFLINE on its status topic, which Node-RED uses to alert me. It has caught two flaky power supplies and one failing capacitor before I noticed anything manually.