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.