Atom Matrix M5 stack simple on/off

Hi! I’m looking for a simple config file that allows me to turn the leds red or green from Home assistant and pressing the screen would turn off the light. Anyone can guide me with this starting point? Been digging different config files online and i’m a bit lost.

Thanks!

Welcome to Home Assistant and ESPHome.

This was top of the Google search results:

May be a good place to start.

You can also start by simply doing a basic yaml for your device (no less, no sensors) to get a handle on ESPHome and YAML.

Finaly got something working, almost there! Using the code bellow, lights turn red for a second when i turn it on from HA and then it turns white. Any idea why it won’t stay red? Thanks!

# Define I2C interface
i2c:
  sda: 25
  scl: 21
  scan: true
  #frequency: 200kHz


binary_sensor:
  - platform: gpio # btn
    id: button
    name: "M5 Button"
    pin:
      number: 39
      inverted: true
    on_click:
      then:
        - light.turn_off: status_led


light:
  - platform: fastled_clockless # 5x5 RGB Matrix (WS2812C)
    name: "M5 Light"
    id: status_led
    pin: 27
    rgb_order: BRG
    chipset: WS2812
    num_leds: 25
    color_correct: [50%, 50%, 50%] # The LED's on the Atom Matrix should not be run at full power
    on_turn_on:
       - light.addressable_set:
          id: status_led
          #range_from: 0
          #range_to: 50
          red: 100%
          green: 0%
          blue: 0%

I would start by suspecting that HA is sending another message.

Good point but it does the same thing when I turn it on from the device’s web page.

I just made a once-a-day pill tracker using the Atom Matrix, and my template should at least give you enough starter code to get where you’re trying to go.

Disclaimers:

  • I just finished this yesterday and I haven’t gotten rid of the rough edges.
  • It could be more DRY.
  • There’s a debug mode & service that you prob won’t need at all.
  • I’m using custom glyphs/5x5 sprites instead of full-page indicators.
  • You’ll need to update it for binary sensors that fit your setup (and create the helpers)
  • I don’t really know what I’m doing with ESPHome but sometimes things work anyway
  • In the current state, it’s only on from 8AM til 2PM (HA-local time)
  • I’m only turning from red to green once with the button click (I’m not toggling between red & green), but it will also follow the input_binary helper (eg: goes back to red if you turn the helper to off)

In my case, I have an automation to reset my helper at midnight. At 8AM, my Atom pill tracker turns on, red, with the glyph for the current day of the week. It’ll stay red until I click it, once clicked it’ll turn the glyph green. At 2PM, if the helper is on, it turns the display off. If the helper is still off, it stays red until I click it.

It takes up to 5s for the state to change; that’s the part I’m still fighting with, and why I’m duplicating they glyph matrix so many times.

The image is Tuesday (Tu) before clicking the button; the box below it is just some Alexa device I had in that outlet, with a spare USB port on top. I’m only using it for the USB power, it has nothing to do with the functionality otherwise.

1 Like