Writing text to lcd

I see where you want to go - but still - how do I pull that information from hassio into the lcd display thats hooked to the esp8266 and how to I show that for the last two door open events.

(When everything works (I thought I start easy) I’m going to replace the limited 20x4 display with a bigger pixel based tft or oled that can hold far more logging then just 2 lines. I need to know the basics first…)

Esphome has home assistant sensor component. But you need entity ID from home assistant. And I know nothing about that.

oke - for now your input has been very useful - thank you

Find all entity- IDs needed here from home assistant and I can help to setup Esphome.

I’m getting there…
I update the circuit around the esp with some fancy leds:

  • power (just hooked to 5v)
  • wifi (wifi_led, using the output wifi_led_output) - flashes when connecting - I copied that shamelessly from an other thread. Thought would be cool.
  • enbled or “armed” led - I made a flow in node-red that it turns on when at least on person is home).
  • led when the gpio to the controller relay is active
  • led when the gpio to the garage lights relay is active (not using this yet)

The display say “active” or “disabled” when the led is either on or off (when there is someone home or not)

The only thing I can’t figure out is how to block id: relay from triggering when id(armed_led_state).state != "on"

I found an example somewhere involving a switch as a template but makes no sense to me.

display:
  - platform: lcd_pcf8574
    id: mydisplay
    dimensions: 20x4
    address: 0x27
    lambda: |-
      if ( ! id(wifi_signal_db).has_state() ) {
        it.printf(0, 0, "Connecting...");
      } else {
        it.strftime(0, 0, "%d/%m/%Y %H:%M", id(homeassistant_time).now() );
        it.printf(18, 3, "%.0f", round( id(wifi_signal_db_pct).state ) );
        it.print(0, 3, id(ip_address).state );
      }
      if ( id(relay).state ) {
        it.strftime(0, 1, "%H:%M", id(homeassistant_time).now());
        it.print(6, 1, "triggered");
      }
      if ( id(armed_led_state).state == "on" ) {
        it.print(0, 2, "   <<< ACTIVE >>>   ");
      } else {                         
        it.print(0, 2, "   >> DISABLED <<   ");
      }
      

sensor:
  - platform: wifi_signal 
    name: "WiFi Signal dB"
    id: wifi_signal_db
    update_interval: 10s
    entity_category: "diagnostic"  

  - platform: copy # Reports the WiFi signal strength in %
    source_id: wifi_signal_db
    id: wifi_signal_db_pct
    name: "WiFi Signal Percent"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "Signal %"
    entity_category: "diagnostic"
    device_class: ""


text_sensor:
  - platform: wifi_info
    ip_address:
      id: ip_address
      name: IP address

  - platform: homeassistant
    id: armed_led_state
    entity_id: light.garagedoor_controller_8266_armed_led


time:
  - platform: homeassistant
    id: homeassistant_time


output:
  - platform: gpio
    id: wifi_led_output
    pin: 15

  - platform: gpio
    id: armed_led_output
    pin: 13
    

light:
  - platform: binary
    name: "wifi LED"
    output: wifi_led_output
    id: wifi_led

  - platform: binary
    name: "Armed LED"
    output: armed_led_output
    id: armed_led
    disabled_by_default: True


switch:
  - platform: gpio
    name: Gargedoor on ESP8266
    icon: "mdi:garage"
    id: relay
    pin: 14
    inverted: true
    on_turn_on:
      - delay: 750ms
      - switch.turn_off: relay

  - platform: gpio
    name: Garage lights
    pin: 12
    inverted: true


interval:
  - interval: 1s
    then:
      if:
        condition:
          wifi.connected:
        then:
          - if:
              condition:
                api.connected:
              then:
                - light.turn_on:
                    id: wifi_led
              else:
                - light.turn_on:
                    id: wifi_led
                    flash_length: 1900ms
        else:
          - light.turn_on:
              id: wifi_led
              flash_length: 250ms

I don’t see anything in your yaml that is triggering id:relay.
And I see your setup quite confusing overall…

Have you considered using Switch/Case method?

There’s also the option to use the LCD Menu Integration for more complex display uses.

Well, this is my first try ever using esphome - If you have ways to simplify :slight_smile:

The relay is a switch so it’s published to HA. In AH a got a button hooked to it.

Regards,
Sjoerd

So, do you have a physical button you press that toggles the relay? I’m confused why your using a Switch and made a button to use in HA? When you create a switch or button in esphome, you will get a switch or button entity in HA automatically and don’t need to create a second one.

An easier way to do it??? Best advice I can give you is marry someone smart that can help you or someone rich that can pay to have someone else do it lol.

euhm yes - the button in HA is coming from esphome obv.

sounds like you got it.

So I’m the only one doesn’t understand this setup.
On yaml there is gpio switch taking care of the relay, but there is nothing triggering it. So the only way to trigger it is to do it manually on GUI.
If you had a button/binary sensor to trigger the switch you could set conditions for triggering.

“So the only way to trigger it is to do it manually on GUI.”

Exactly - and that is what i want - “press” the button of the remote control from my phone using the relay on the esp using the gui.

So add a button to your yaml.