ESPHome Smart LED Candles

I recently picked up a set of four realistic LED wax candles – they flicker nicely and really look like the real thing. Cost? A whopping €9 for the set of four. The downside: they aren’t smart, and each candle runs on 2 × 1.5 V AA batteries – that’s 8 batteries in total for my set.

A friend got me thinking: why not make them smart? I decided to give my candles a smart upgrade for the Advent season. Here’s a quick run-through of how I did it.

Turning Candles Smart with D1 Mini and ESPHome

To make the candles controllable from your phone, I used a D1 Mini with ESPHome integrated into Home Assistant. This setup lets you:

  • Switch each candle individually without touching them
  • Avoid handling 8 batteries every time
  • Control brightness and even create a sequence – light one candle per Advent, if you like

Each candle gets its own GPIO pin. The D1 Mini handles the logic, while ESPHome exposes each candle as a switch in Home Assistant.

Wiring and Voltage Calculation

Each LED candle runs on 2 × 1.5 V AA batteries in series, giving 3 V. The D1 Mini GPIO pins supply 3.3 V, slightly higher than the candle’s rated voltage. To prevent stress on the LEDs, a small series resistor is recommended.

Calculation:

  • Voltage difference: 3.3 V−3 V=0.3 V
  • Estimated current per candle: ~25 mA
  • Required resistor: R=V/I=0.3 V/0.025 A≈12 Ω

A 12–15 Ω, 0.25 W resistor in series with each candle works perfectly.

Wiring:

  1. Connect each candle’s positive lead to the resistor.
  2. Connect the other end of the resistor to a GPIO pin of the D1 Mini.
  3. Candle ground goes to the D1 Mini ground.

This allows safe switching of each candle while keeping the LEDs happy. With this setup, your candles are fully smart, individually controllable, and battery-safe.

ESPHome Code for Smart LED Candles

The ESPHome configuration for this project is straightforward. For a detailed explanation of the basic structure, check out my blog post on Smart Aquarium with ESPHome, where the setup, Wi-Fi, and general device configuration are covered.

For the LED candle project, we only need to focus on the switch section, as each candle will be controlled individually via its GPIO pin. Using ESPHome switches makes it easy to turn each candle on or off from Home Assistant or any ESPHome-supported interface.

Here’s the basic approach:

switch:
  - platform: gpio
    pin: D1   # GPIO5
    name: "Candle 1"
    id: led_1
    restore_mode: RESTORE_DEFAULT_OFF
    inverted: false
    icon: "mdi:candle"

  - platform: gpio
    pin: D2   # GPIO4
    name: "Candle 2"
    id: led_2
    restore_mode: RESTORE_DEFAULT_OFF
    inverted: false
    icon: "mdi:candle"

  - platform: gpio
    pin: D5   # GPIO14
    name: "Candle 3"
    id: led_3
    restore_mode: RESTORE_DEFAULT_OFF
    inverted: false
    icon: "mdi:candle"

  - platform: gpio
    pin: D6   # GPIO12
    name: "Candle 4"
    id: led_4
    restore_mode: RESTORE_DEFAULT_OFF
    inverted: false
    icon: "mdi:candle"

Each switch corresponds to a candle, allowing you full control over your smart Advent setup. You can integrate these switches into Home Assistant, create automation sequences, or even control the brightness with PWM if desired. This keeps the ESPHome configuration minimal while giving you full individual control of all four candles.

And the best part? You can now enjoy your Advent candles without ever fighting over who has to change the batteries. Santa would definitely approve of this smart, lazy – and slightly nerdy – approach to holiday cheer!