M5 Matrix Device - Help On Making Matrix Turn-On

Through some searching and help I have managed to get this hardware running via hassio and I can display on the matrix and also use the button on the device to trigger events.

What I am struggling with is trying to get the ‘display’ to be identified in hassio where I can trigger the display to be turned on when another event triggers. Right now I cant find the light or display entities below in hassio.

First esphome setup so appreciate some help.

esphome:

  name: esphome-web-0dec48

  friendly_name: M5 Matrix

esp32:

  board: m5stack-atom

  framework:

    type: arduino

# Enable logging

logger:

# Enable Home Assistant API

api:

  encryption:

    key: "xxx"

ota:

wifi:

  ssid: !secret wifi_ssid

  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails

  ap:

    ssid: "Esphome-Web-0Dec48"

    password: "xxx"

captive_portal:

binary_sensor:

  - platform: gpio # btn

    name: "Timer Button"

    id: button1

    pin:

      number: 39

      inverted: true


light:

  - platform: neopixelbus

    type: GRB

    variant: WS2812x

    pin: 27

    num_leds: 25

    id: led_matrix_light

    color_correct: [30%, 30%, 30%]

    restore_mode: ALWAYS_OFF

   

display:

  - platform: addressable_light

    id: led_matrix_display

    addressable_light_id: led_matrix_light

    width: 5

    height: 5

    rotation: 180

    update_interval: 16ms

    lambda: |-

          // Draw a bulls-eye pattern

          Color red = Color(0xFF0000);

          Color green = Color(0x00FF00);

          Color blue = Color(0x0000FF);

          it.rectangle(0, 0, 5, 5, red);

          it.rectangle(1, 1, 5, 5, green);

          it.rectangle(2, 2, 4, 4, blue);

          it.rectangle(3, 3, 2, 2, red);

You need t give the light a name. With an ID only it is treated as internal.

  • internal (Optional, boolean): Mark this component as internal. Internal components will not be exposed to the frontend (like Home Assistant). Only specifying an id without a name will implicitly set this to true.

The actual LEDs are treated by ESPHome as a display. Displays don’t appear as entities in HA. All your display work has to be done on the ESPHome side. Create a select component on the ESP, use changes to that to select pages on your display. Depending on what you want to do you may need to create a few… :slight_smile:

1 Like

You may be interested - I have been fiddling around with an ESPHome service to change display pages. Unfortunately I can’t pass the page id directly, so you only save a bit of yaml from using a select or similar to trigger the change. Defined under api (I haven’t added all pages yet):

api:
  services:
    - service: weather_change_page
      variables:
        page: int
      then:
        - display.page.show: !lambda |-
            if (page == 1) {
              return id(page1);
            } else { 
            if (page == 7) {
              return id(page7);
            } else {
              return id(page1);
            } }

Then in HA just call the service with the parameter:

service: esphome.weather_weather_change_page
data:
  page: 7

Works well for my purpose - may help with yours.

1 Like

This works!

I feel there should be a more intuitive way to control the display on the esp devices in hassio like I can do via python … but … this can work for my use case so thanks vm!

@monkeydust I used your esphome yaml however only 1 LED shows up, instead of all 25. Did you do anything special to get them all working?
I have the same hardware. I went to https://web.esphome.io/ and flashed it. Then used ESPHome Adddon in Home Assistant and ran the yaml code.

That’s how addressable lights work.

All of them show up. Here is the code esphome: name: esphome-web-0dec48 friendly_name: M5 Matrixesp32: bo - Pastebin.com