Getting GPIO Sensor to work and display on dashboard

Hi have the following code which creates a button to open my garage door (this works). I have now added the sensor using a pressure sensor connected to pin 2.

I am wanting to display the status of the sensor on my dashboard but cannot find it when I am editting the card

Here is my code

esphome:
  name: garage-door

esp8266:
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: !secret ota_password-garage_door

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Garage-Door Fallback Hotspot"
    password: !secret fallback_password-garage_door

captive_portal:

switch:
      - platform: gpio
        name: "Garage Door"
        id: relay
        pin: 5
        inverted: true
        icon: "mdi:garage"
        on_turn_on:
        - delay: 150ms
        - switch.turn_off: relay
        
# https://esphome.io/components/binary_sensor/gpio.html
binary_sensor:
  - platform: gpio
    pin:
      number: 2
      mode: INPUT_PULLUP
      inverted: True
    name: "Garage Door State"  
    filters:
      - delayed_on : 10ms

I have tried testing the sensor but can’t seem to get it to sense anything when I connect pin 2 to ground.

Back to basics - what entities are shown for the device. Go here Open your Home Assistant instance and show your integrations., search for esphome, click on the device, you’ll see something like '1 device 2 entities`

Aah so I need to add it as an entity and not a sensor.

Sorted, thanks

That is not what I said. You will get the entity id from there.

Yes that is what I did but this only appears under entity and not sensor. I therefore created an entity card and listed it there.

image

binary_sensor.garage_door_state

When I try a sensor card the following happens

It does not appear in the list so I try typing it in manually.

Having looked much harder at your posts, yes it is not a sensor, it is a binary_sensor. Different things.