MAX7219 as text sensor for timer?

Hello,

i created a MAX7219 text sensor that will display messages that i set with an automation in HA. But how do i make it act as countdown timer?

I want to have something ,like a button press, trigger the display to start a 20 minute timer. How would i do this?

The code in esp is the following and works fine:

esphome:
  name: ledmatrix

esp8266:
  board: d1_mini_pro

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "bc0640266a6b34d9b87b69526e7e328a"

wifi:
  ssid: "xxxxx"
  password: "xxxxxx"
  fast_connect: true
  manual_ip:
    static_ip: 192.168.2.50
    gateway: 192.168.2.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Ledmatrix Fallback Hotspot"
    password: "1jvk6oluXVSh"

captive_portal:

spi:
  clk_pin: D5
  mosi_pin: D7
  
display:
  - platform: max7219digit
    cs_pin: D6
    scroll_mode: stop
    scroll_speed: 50ms
    num_chips: 4
    intensity: 8
    lambda: |-
      it.printf(0, 0,id(digit_font), "%s", id(led_matrix).state.c_str());

font:
  - file: "pixelmix_bold.ttf"
    id: digit_font
    size: 8
    
text_sensor:
  - platform: homeassistant
    name: "LED Matrix"
    entity_id: input_text.led_matrix
    id: led_matrix

binary_sensor:
  - platform: status
    name: "LEDMatrix Status"