ESPHome works on all kinds of devices based on the ESP8266 or ESP32 chips. I picked up a MagicHome RGB light strip controller device because it has that chip and I wanted the option to customize it. Mine actually has a ESP8285 chip, which is just a smaller/cheaper version of the ESP8266.
I have this old big metal “R” on the wall that I wanted to backlight and this turned out to be a perfect match for this project. The R was a birthday gift from my wife. She found it in an antique store and learned that it was originally part of a SEARS store sign.
Attaching the light strip
I constructed a spacer with foam core and duct tape to hold the R about 1 inch off the wall and give a place to stick the adhesive RGBW light strip. It was quick, easy to work, with and turned out pretty well being all hidden behind the R.Soldering required to access the serial port
Soldering is not really that hard but it’s a skill that can take a little practice. Removing components from an old circuit board is a good way to learn the basics. I’ve been using this cordless soldering iron and it’s super convenient.To flash the ESP chip you need access to the serial connectors. Once ESPHome is flashed to the chip you’ll never need it again so just go ahead and desolder the wires. These sites have good instructions on where the wires need to be soldered:
Be sure to notice the part about connecting GPIO-0 to Ground to put the chip into programming mode. I use this little USB ESP-01 programmer and it has a convenient switch to do that.
Now you are ready to flash new firmware.
Stock firmware backup/restore
This is optional but sometimes it’s nice to have the option to restore the device if needed.cd ~/esphome/ && python3 -m venv venv
source venv/bin/activate
pip install tornado esptool esphome
# backup
venv/bin/esptool.py --port /dev/cu.usbserial-1420 read_flash 0x00000 0x100000 original_firmware.bin
# erase
venv/bin/esptool.py --port /dev/cu.usbserial-1420 erase_flash
# restore
venv/bin/esptool.py --port /dev/cu.usbserial-1420 write_flash -fs 1MB -fm dout 0x0 original_firmware.bin
First time flashing ESPHome
Install ESPHome (see the getting started guides)cd ~/esphome/ && python3 -m venv venv
source venv/bin/activate
pip install tornado esptool esphome
Flash from the command lineesphome config/magichome_led_strip.yaml wizard
esphome config/magichome_led_strip.yaml run
Flash from the web interface at http://localhost:6052/:esphome config/ dashboard
After ESPHome is flashed everything can now be re-flashed OTA or over-the-air. You can desolder the extra wires and put away your USB programmer.The YAML file
To reconfigure the device with ESPHome you just change the YAML file and upload it.When you want to make changes start up the web interface at http://localhost:6052/
esphome config/ dashboard
Edit your YAML file and upload it. This is what my YAML file looks like:esphome:
name: magichome_led_strip
platform: ESP8266
board: esp01_1m
wifi:
ssid: "your-wifi-network-name"
password: "your-wifi-network-password"
api:
logger:
ota:
# https://esphome.io/components/mqtt.html
mqtt:
broker: "your-mqtt-server-ip-address"
username: "your-mqtt-username"
password: "your-mqtt-password"
light:
- platform: rgb
id: light_1
name: "LED Strip"
red: red_channel
green: green_channel
blue: blue_channel
effects:
- automation:
name: Fade
sequence:
- light.control:
id: light_1
brightness: 100%
- delay: 1s
- light.control:
id: light_1
brightness: 50%
- delay: 1s
output:
- platform: esp8266_pwm
id: red_channel
pin: GPIO5
- platform: esp8266_pwm
id: green_channel
pin: GPIO12
- platform: esp8266_pwm
id: blue_channel
pin: GPIO13
# https://esphome.io/components/remote_receiver.html
remote_receiver:
dump: all
pin:
number: GPIO4
inverted: True
binary_sensor:
- platform: remote_receiver
name: "on"
nec:
address: 0x00FF
command: 0xB04F
on_press:
then:
- light.control:
id: light_1
state: on
- light.turn_on: light_1
- platform: remote_receiver
name: "off"
nec:
address: 0x00FF
command: 0xF807
on_press:
then:
- light.control:
id: light_1
state: off
- light.turn_off: light_1
- platform: remote_receiver
name: "red"
nec:
address: 0x00FF
command: 0x9867
on_press:
then:
- light.control:
id: light_1
red: 100%
green: 0%
blue: 0%
- platform: remote_receiver
name: "green"
nec:
address: 0x00FF
command: 0xD827
on_press:
then:
- light.control:
id: light_1
red: 0%
green: 100%
blue: 0%
- platform: remote_receiver
name: "blue"
nec:
address: 0x00FF
command: 0x8877
on_press:
then:
- light.control:
id: light_1
red: 0%
green: 0%
blue: 100%
- platform: remote_receiver
name: "white"
nec:
address: 0x00FF
command: 0xA857
on_press:
then:
- light.control:
id: light_1
red: 100%
green: 100%
blue: 100%
- platform: remote_receiver
name: "brighter"
nec:
address: 0x00FF
command: 0x906F
on_press:
then:
- light.control:
id: light_1
brightness: 100%
- platform: remote_receiver
name: "dimmer"
nec:
address: 0x00FF
command: 0xB847
on_press:
then:
- light.control:
id: light_1
brightness: 50%
- platform: remote_receiver
name: "fade"
nec:
address: 0x00FF
command: 0x58A7
on_press:
then:
- light.control:
id: light_1
effect: Fade
- platform: remote_receiver
name: "r2"
nec:
address: 0x00FF
command: 0xE817
on_press:
then:
- light.control:
id: light_1
red: 100%
green: 30%
blue: 0%
- platform: remote_receiver
name: "r3"
nec:
address: 0x00FF
command: 0x02FD
on_press:
then:
- light.control:
id: light_1
red: 100%
green: 50%
blue: 0%
- platform: remote_receiver
name: "r4"
nec:
address: 0x00FF
command: 0x50AF
on_press:
then:
- light.control:
id: light_1
red: 60%
green: 40%
blue: 0%
- platform: remote_receiver
name: "r5"
nec:
address: 0x00FF
command: 0x38C7
on_press:
then:
- light.control:
id: light_1
red: 100%
green: 100%
blue: 20%
- platform: remote_receiver
name: "g2"
nec:
address: 0x00FF
command: 0x48B7
on_press:
then:
- light.control:
id: light_1
red: 0%
green: 100%
blue: 50%
- platform: remote_receiver
name: "g3"
nec:
address: 0x00FF
command: 0x32CD
on_press:
then:
- light.control:
id: light_1
red: 30%
green: 100%
blue: 100%
- platform: remote_receiver
name: "g4"
nec:
address: 0x00FF
command: 0x7887
on_press:
then:
- light.control:
id: light_1
red: 0%
green: 100%
blue: 100%
- platform: remote_receiver
name: "g5"
nec:
address: 0x00FF
command: 0x28D7
on_press:
then:
- light.control:
id: light_1
red: 0%
green: 50%
blue: 50%
- platform: remote_receiver
name: "b2"
nec:
address: 0x00FF
command: 0x6897
on_press:
then:
- light.control:
id: light_1
red: 30%
green: 0%
blue: 100%
- platform: remote_receiver
name: "b3"
nec:
address: 0x00FF
command: 0x20DF
on_press:
then:
- light.control:
id: light_1
red: 70%
green: 0%
blue: 100%
- platform: remote_receiver
name: "b4"
nec:
address: 0x00FF
command: 0x708F
on_press:
then:
- light.control:
id: light_1
red: 100%
green: 0%
blue: 100%
- platform: remote_receiver
name: "b5"
nec:
address: 0x00FF
command: 0xF00F
on_press:
then:
- light.control:
id: light_1
red: 100%
green: 0%
blue: 50%