M5stack Echo with a hex light
With all my playing around with home assistant, I've bought myself a M5stack Echo. The echo is the variant of choice for home assistant's "Year of the voice". The other day, I did come across a 37 led array in the shape of a hexagon on Aliexpress.
Curious, I bought the device. My original aim was to plug it in to my other M5stack device, which is currently configured to be a matter device. The main reason I didn't was because the echo was already programmed in to home assistant via the esphome add-on. All the code was in the right place. With a bit of digging, I found a code block that was close, but needed a bit of tweaking. I ended up with this code:
light:
- platform: esp32_rmt_led_strip
chipset: SK6812
pin: GPIO21
num_leds: 1
rgb_order: GRB
name: "Onboard Light"
rmt_channel: 0
id: built_in
- platform: esp32_rmt_led_strip
chipset: SK6812
pin: GPIO26
num_leds: 37
rgb_order: GRB
name: "Hex ring"
rmt_channel: 1
id: hexring
When added to my echo's configuration, this exposed 2 lights to home assistant, the on board LED and the hex display. I did make a mistake when I initially set it up, and set the rmt_channel to both to be '0'. The practical side of this was that I could control an individual led on the hex display. More information about esp32_rmt_led_strip can be found here.
The board did take a bit of debugging to get right. I did try other libraries, which don't work with the esp-idf framework (I'm looking at you FastLED). Finding the data pin was as simple as looking at the back of the echo.
The last part that required debugging was the rgb_order. This is simply the way to do this, is set the order to RGB at the start (unless known!). In the controls of home assistant, set the light to red. In my case this glowed green. Next I set it to green, and got red. Lastly, I confirmed that blue was indeed blue. From this, I was able to tell the order was green, red, blue - GRB.