ESPHome LED text notifier with basic response buttons

My wife and I work from home, due to the pandemic, and have frequent video meetings. Sometimes I have a quick question or request but don’t want to disrupt her meeting by knocking and she doesn’t always check her phone messages, so I came up with this solution.

She or I can send messages to the LED matrix in the home office via Home Assistant text input field which is displayed on the screen for 1 minute. Pressing the green, yellow, or red buttons will respond Yes/OK, Please wait, or No via TTS to the living room Nest Hub Max speaker as well as display that in text on the display.

This test was from the living room, from where the audio is playing, but the device will be installed in the office.

Components

  • NodeMCU running ESPHome (from Aliexpress)
  • 4-panel Max7219 Digit Display (from Aliexpress)
  • Arcade buttons (from a local electronics store)
  • Clear case (from a local dollar store)

The wiring is very simple, D0, D1, D2 go to the screen per the ESPHome documentation example and D5, D6, and D7 go to each button.

ESPHome yaml

esphome:
  name: office-text

esp8266:
  board: nodemcu

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: <removed>

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Office-Text Fallback Hotspot"
    password: <removed>

captive_portal:

binary_sensor:
  - platform: gpio
    pin:
      number: D5
      inverted: true
      mode:
        input: true
        pullup: true
    name: office_text_green_button
  - platform: gpio
    pin:
      number: D6
      inverted: true
      mode:
        input: true
        pullup: true
    name: office_text_yellow_button
  - platform: gpio
    pin:
      number: D7
      inverted: true
      mode:
        input: true
        pullup: true
    name: office_text_red_button

spi:
  clk_pin: D0
  mosi_pin: D1

display:
  - platform: max7219digit
    cs_pin: D2
    num_chips: 4
    intensity: 1
    scroll_speed: 70ms
    scroll_delay: 0ms
    lambda: |-
      if (id(office_text).has_state()) {
        it.printf(0, 0, id(digit_font), " %s ", id(office_text).state.c_str());
      } else {
        it.turn_on_off(true);
      }

font:
  - id: digit_font
    file: "fonts/pixelmix.ttf"
    glyphs: '"/@&?!%()+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz'
    size: 8

text_sensor: # This helper input field entity needs to be created in HA
  - platform: homeassistant
    name: "office text"
    id: office_text
    entity_id: input_text.office_text

Automation yaml

alias: Office text buttons
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.office_text_green_button
    from: 'off'
    to: 'on'
    id: green
  - platform: state
    entity_id: binary_sensor.office_text_yellow_button
    from: 'off'
    to: 'on'
    id: yellow
  - platform: state
    entity_id: binary_sensor.office_text_red_button
    from: 'off'
    to: 'on'
    id: red
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: green
        sequence:
          - service: input_text.set_value
            target:
              entity_id: input_text.office_text
            data:
              value: Yes/OK
          - service: tts.google_say
            data:
              entity_id: media_player.lr_hub
              message: Yes, OK
      - conditions:
          - condition: trigger
            id: yellow
        sequence:
          - service: input_text.set_value
            target:
              entity_id: input_text.office_text
            data:
              value: Please wait
          - service: tts.google_say
            data:
              entity_id: media_player.lr_hub
              message: Please wait
      - conditions:
          - condition: trigger
            id: red
        sequence:
          - service: input_text.set_value
            target:
              entity_id: input_text.office_text
            data:
              value: 'No'
          - service: tts.google_say
            data:
              entity_id: media_player.lr_hub
              message: 'No'
    default: []
  - delay:
      seconds: 5
  - service: input_text.set_value
    target:
      entity_id: input_text.office_text
    data:
      value: ''
mode: restart

Next plans
Rather than send the response to a speaker, it would be ideal to send an HA app notification back to the person who set the LED text. This should be possible with trigger.to_state.context.user_id but I just need to figure out the details.

I thought about using Telegram for both the initial message and response but don’t want to force my wife to install another app.

5 Likes

Thanks for sharing this project! This is exactly what i was looking for.

1 Like