Updating display based on garage door

I have a project that I thought would be pretty simple and straightforward, but I’m going in circles trying to get it to work. I’m probably overlooking something simple since, disclaimer, I’m fairly new to HA and to ESP devices (this is my first one).

I have an ESP8266 (wemos d1 mini clone) with an SSD1306 display wired in. I want to display the status of my garage door. For starters, I just want it to display simple text status but the end goal is to have some fancier graphics (but I’m trying to start small). I’m on HA core-2021.5.4, and esphome is 1.18.0

So far, I’ve managed to fumble my way through a build that doesn’t throw any errors, but it doesn’t seem to work either. I get the message “Booted Up” displayed on the screen, but the status never changes to “Garage Open” or any of the other messages based on the status of the garage door. The ESP seems to be receiving the messages via the API, it’s just not making use of them.

Some logs from the serial output:

[D][api.connection:617]: Client 'Home Assistant 2021.5.4 (192.removed)' connected successfully!
[D][homeassistant.text_sensor:016]: 'cover.garage_door': Got state 'closed'
[D][text_sensor:015]: 'garage_display_sensor': Sending state 'closed'

And here’s my full config:

esphome:
  name: garage_display
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "ssid"
  password: "password"
  
  power_save_mode: none
  reboot_timeout: 3min

  manual_ip:
    static_ip: 10.removed
    gateway: 10.removed
    subnet: 255.255.255.0
    
# Enable logging
logger:
  level: VERBOSE
  
# Enable Home Assistant API
api:
  password: "password"
  reboot_timeout: 2min

ota:
  password: "password"

font:
  - file: 'fonts/cour.ttf'
    id: my_font
    size: 18

#display
i2c:
  sda: D2
  scl: D1

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    id: garage_display1
    brightness: 1
    pages:
      - id: bootedup
        lambda: |-
          it.print(0, 10, id(my_font), "Booted Up");
      - id: garage_display_open
        lambda: |-
          it.print(0, 10, id(my_font), "GARAGE OPEN");
      - id: garage_display_closed
        lambda: |-
          it.print(0, 10, id(my_font), "GARAGE CLOSED");
      - id: garage_display_closing
        lambda: |-
          it.print(0, 10, id(my_font), "GARAGE CLOSING");
      - id: garage_display_opening
        lambda: |-
          it.print(0, 10, id(my_font), "GARAGE OPENING");

text_sensor:
  - platform: homeassistant
    entity_id: cover.garage_door
    id: garage_display_sensor
    on_value:
      display.page.show: !lambda |-
        if (id(garage_display_sensor).state=="OPEN") {
           return id(garage_display_open);
        } if (id(garage_display_sensor).state=="OPENING") {
          return id(garage_display_opening);
        } if (id(garage_display_sensor).state=="CLOSING") {
          return id(garage_display_closing);
        } if (id(garage_display_sensor).state=="CLOSED") {
          return id(garage_display_closed);
        } else {
          return id(bootedup);
        }
1 Like

Turns out I was closer to the solution than I thought. I was able to fix this by changing to lower case for the state check:

      display.page.show: !lambda |-
        if (id(garage_display_sensor).state=="open") {
           return id(garage_display_open);
        } if (id(garage_display_sensor).state=="opening") {
          return id(garage_display_opening);
        } if (id(garage_display_sensor).state=="closing") {
          return id(garage_display_closing);
        } if (id(garage_display_sensor).state=="closed") {
          return id(garage_display_closed);
        } else {
          return id(bootedup);
        }

Sounds like an interesting project.
Would you mind posting a wiring diagram and the d1 mini code. If not a link to the sources you used.
Thanks so much.