ESPHome LED Matrix max7219digit brightness control from HA

Hello,

I am trying to get a setup working where I can have a slider on the HA frontend to adjust the brightness of a LED Matrix in its range from 0-15 where 0 is the lowest brightness but not off and 15 the brightest. I have found a forum post that explains that with sensor for the brightness already working on a HA system as far as I understand it.

However I don not have a brightness sensor and I prefer using a slider as shown here:

I assume I have to create that entity 1st in HA where the slider changes a value between 0-15, I am not clear how I can do that. Ideally I like to implement that “on foot” in the configuration.yaml file rather than importing blueprints or such just to understand it in the most minimalistic way possible. Could anybody help me, I am not even sure what it would be called in HA lingo what I am looking for.

Kind regards
Jan P

I have found “Input Numbers” which appears to be what I am looking for but I am still failing to make this work. In configuration.yaml I have the lollowing:

input_number:
  brightness_led_matrix:
    name: LED Display Brightness
    initial: 0
    min: 0
    max: 15
    step: 1

In ESPHome I have the lollowing

sensor:
  - platform: homeassistant
    name: "LED Display Brightness"
    id: "esp8266_d1_mini_0001_brightness"
    entity_id: "input_number.brightness_led_matrix"
    filters:
      - calibrate_linear:
          - 0.00 -> 0
          - 15.00 -> 15
		  
display:
  - platform: max7219digit
    cs_pin: D8
    num_chips: 12
    num_chip_lines: 2
    rotate_chip: 0
    chip_lines_style: zigzag
    intensity: 0
    lambda: |-
     
      it.set_intensity(id(esp8266_d1_mini_0001_brightness).state);
	  it.strftime(33, 0, id(digit_font), TextAlign::TOP_CENTER, "%H:%M", id(homeassistant_time).now());

The LED Matrix will only set the brightness as its set in the intensity value in the display definition, not according to the value I set with the slider. I can see in the loghs the values are actually communicated to the ESPHome device. Any suggestion what I am doing wrong here ?

Thank You
Jan P

Hi Jan,

I was struggling with the same thing and seems it’s broken esphome max7219digit implementation but luckily there is simple workaroud: use intensity instead of set_intensity, like:

t.intensity(id(esp8266_d1_mini_0001_brightness).state);

worked for me

found here

cheers

Hi Marek,

wow now it works like a treat !!!

sensor:
  - platform: homeassistant
    name: "LED Display Brightness"
    id: "led_matrix_2_brightness"
    entity_id: "input_number.brightness_led_matrix"
    filters:
      - calibrate_linear:
          - 0.00 -> 0
          - 15.00 -> 15

display:
  - platform: max7219digit
    cs_pin: D8
    num_chips: 12
    num_chip_lines: 2
    rotate_chip: 0
    chip_lines_style: zigzag
    intensity: 2
    lambda: |-

[....more lambdas...]

      it.intensity(id(led_matrix_2_brightness).state);

Thank you so much Marek .

PS: I just noticed that the filter is not even needed.