Single light switch
Toggling all lights at home with a single switch using Home Assistant, ESPHome, and ESP8266s
I have a bunch of cool lights or decorations at home that need power to function. I would love to have these on more often but for whatever reason I barely ever go through the effort of turning them on. Thus, I would love to be able to toggle all of these using a single switch! So this is what I’m trying to do here.
The general plan is to hook all my things to be toggled up to home assistant, as well as the single switch or button that will toggle all of the things. Then I’d set up an automation which would toggle all the things when the switch or button is pressed.
To hook up my things and the switch I used ESPHome, for no other reason than that this is what I found and seemed to work upon testing.
-
I used the following instructions to install ESPHome and add devices: Getting Started with ESPHome and Home Assistant — ESPHome
-
Then I configured my button to be a binary sensor based on this documentation: GPIO Binary Sensor — ESPHome
binary_sensor:
- platform: gpio
name: "train_blue"
pin: D2
- platform: gpio
name: "train_yellow"
pin: D5
- And configured my LED strip based on the following documentation: NeoPixelBus Light — ESPHome
light:
- platform: neopixelbus
type: GRB
variant: WS2812
pin: D1
num_leds: 89
name: "Window LED strip"
-
Then I added the devices to Home Assistant
-
And finally, I made an automation that would toggle the LED strip when the button was pressed.
Ta-da! Done.