ESP string lights
An MQTT-enabled controller for string lights with several effects, designed for the ESP32.

At a glance
- C++, ESP32, MQTT
Tags
An MQTT-enabled controller for string lights with multiple effects and a physical button, designed for the ESP32, compatible with Home Assistant, and keeping its state across power cycles.
What it does
The lights are plugged into a relay, and the original controller of the string stays in the loop through a transistor, which lets the ESP32 trigger its effects. The board can be driven in two ways:
- From the network: one MQTT topic switches the lights on and off, another selects the effect.
- From the wall: a push button cycles through the effects, and the lights blink a pattern to say which one is now active.
The available effects are in waves, sequential, slow glow, chasing, fade, twinkle, static and a combination of them.
Hardware
- An ESP32 development board.
- A relay module that switches the mains supply of the lights.
- A push button.
- A transistor that stands in for the original controller's effect button.
- A small mains adapter that powers the board.
Software
Built with PlatformIO. On start-up the board connects to Wi-Fi, then to the MQTT broker, subscribes to its two topics and keeps the connection alive, trying ten times to reconnect before giving up. Wi-Fi and broker settings live in a configuration file that is kept out of the repository.


