Explorations in Home Automation
December 22, 2025
We have various Christmas decorations that use mini-LED strings powered by AA batteries (typically 2xAA= 3v). I did not want to manually turn these on and off, nor replace batteries every few days. A D1 mini (at about $3) seemed like a good way to integrate something with very low power needs into Home Assistant (HASS).
These are dumb strings (not addressable such as you’d use with a more sophisticated project with WLED).

Left: a typical mini-LED set powered by 2xAA batteries (white enclosure). Right: D1 minigadget in action.
I wanted this to fit neatly into a small enclosure, so I used a 60x36x25mm project box like these. I notched one end for the micro-USB plug, drilled a small hole at the other end to run the wires to the mini LED strip, and drilled a hole in the side for the button switch.
I have soldered up boards before only to accidentally fry the D1 mini, so I used headers. This was also handy because I had to cut the strip board small enough to fit in the project box, so the only place for connections was under the D1 mini (between the headers).

Above: Packaging (L to R: View of strip board; with D1 mini plugged in; finished project.
Wiring is straightforward as shown in the schematic and breadboard images below. We are using an NPN transistor and refer to the pins by their functions (Collector, Base, Emitter – C, B, and E). Your transistory data sheet will also number them 1-3 but the numbering is not consistent across brands.
D1 mini 3v3 ------------------------> LED string(+)
NPN Collector (C) ------------------------> LED string (-)
NPN Emitter (E) ------------------------> D1 mini GND
D1 mini Pin D5 ---> [1k resistor] -----> NPN Base (B)
NPN Base (B) ---> [100k resistor] ---> D1 mini GND
D1 mini Pin D1 ---> [switch] ----------> D1 mini GND

Above: How to wire this up. (L to R: Physical view; schematic; implemented with stripboard).
The steps below cover setting up a fresh Wemos D1 Mini to control a mini LED string using ESPHome and Home Assistant.
This setup process has two distinct parts. First, we use ESPHome to configure and securely flash the D1 Mini with a custom firmware — this includes setting up Wi-Fi, logic, and encryption keys. At this point, we have a device that powers the mini-LED strip with a push button toggle for on/off. But we want to remotely control and automate the mini-LED strip, so we need to integrate it into Home Assistant. Thus, we link the configured device into Home Assistant using the (ESPHome Integration) so that it becomes a manageable asset (with a UI card, device ID, and assignable area).
This entire procedure will be done with the D1 mini connected via USB to your computer. Make sure you have a cable that is for data and not just power (not all USB cables are equal). If your computer can’t see the device this is the most likely explanation.
Before Home Assistant can manage the device, you must install the base ESPHome firmware.
snowman) andsnowman card..bin file (if you named your string snowman the file will be snowman.bin).
You can CLOSE the log window and the yaml edit page to return to the ESPHome Buidler dashboard..bin file you downloaded, then hit INSTALL..# --- Snowman Logic ---
# Output: LED control via transistor on D5 (GPIO14)
switch:
- platform: gpio
pin: 14
name: "Snowman Lights"
id: snowman_lights_switch
restore_mode: ALWAYS_OFF
# Input: Physical Push Button on D1 (GPIO5)
binary_sensor:
- platform: gpio
pin:
number: 5
mode: INPUT_PULLUP
inverted: true
name: "Snowman Button"
id: snowman_btn
filters:
- delayed_on: 20ms
on_press:
then:
- logger.log: "Snowman Physical Button Pressed!"
- switch.toggle: snowman_lights_switch
Once the device reboots after flashing, it will join your Wi-Fi as snowman.local.
It may take a couple of minutes to be discovered by ESPHome.
You’re done!
| Component | D1 Mini Pin | GPIO | Function |
|---|---|---|---|
| LED String | D5 | 14 | Connect to Transistor Base |
| Push Button | D1 | 5 | Connect to Pin and GND |
snowman.yaml file in the api: and ota: sections.Once your Snowman is running, you may want to move the auto-generated security keys into your secrets.yaml file. This keeps your main configuration clean and prevents accidental sharing of your private keys.
Open /config/esphome/secrets.yaml and add these three lines:
snowman_api_key: "PASTE_KEY_FROM_YAML_HERE"
snowman_ota_password: "PASTE_PASSWORD_FROM_YAML_HERE"
snowman_fallback_password: "9KPSOTp0serw"
snowman card.encryption: key: and paste it into your secrets.yaml next to snowman_api_key.ota: password:.Now, update your api: and ota: blocks in the Snowman editor to look like this:
api:
encryption:
key: !secret snowman_api_key
ota:
- platform: esphome
password: !secret snowman_ota_password
Click INSTALL and choose WIRELESSLY. ESPHome will verify that the “secret” matches what is already on the chip.