Sonoff L1 & Home Assistant
Recently I bought a bunch of new Sonoff IoT devices, among them was the Sonoff L1: a WiFi connected LED strip. Like all of the other Sonoff equipment I figured it would be supported by ESPHome for easy integration with Home Assistant. As it happens, this wasn't the case. The whole project ended up being far more complicated than I expected.
Flashing the Controller
The L1 doesn't expose any headers, so you'll need to solder wires to the UART pads. Luckily this only requires a few minutes of soldering and you're good to go.
Flashing the ESP8285 proves a little more difficult as there's no exposed
GPIO0 pin. The Tasmota guide has a good illustration showing which pin on the chip itself needs to be shorted to ground. While this seems like it might be tricky, you get the hang of it.
Once the ESP is booted into programming mode it's an easy matter to flash ESPHome which provides OTA updates for future changes.
I'd initially followed some guides for a similar LED controller which used PWM to controll the RGB channels, however, the L1 uses a Nuvoton N76E003 to drive the LEDs. The ESP comunicates over serial to the Nuvoton. Some clever people over on the Home Assitant forums managed to figure out how the board works. Everything from serial protocols to commands.
After several rounds of "I don't know enough to make this work" I eventually started looking at the Tasmota implementation along with the ESPHome custom light docs and began coding up a custom component. Eventually I managed a basic, but working, implementation which parsed Home Assistant's input and passed it along to the LED strip.
I would like to figure out how to support some of the other modes in the UI. The music sync mode has parameters for both sensitivity and speed. There are also severl "DIY" modes which allow the user to specify colors for the controller to cycle through.
Putting It All Together
I've uploaded the custom component and an example config on GitHub. All you need to do is download the
sonoff_l1.h into your ESPHome directory and update
led_strip_1.yaml with the specifics of your installation and you should be off to the races.
There are some limitations, at time of writing. While Home Assistant can send changes to the L1, the remote won't push changes back to Home Assistant. Additionally not all of the L1 modes are fully supported yet.