#Hoping someone can help me out getting

1 messages · Page 1 of 1 (latest)

sour moth
#

I have an ESP32 hooked up to my garage door opener, running esphome

#

currently it has a relay for the switch, and reed sensors on fully open and fully closed

#
binary_sensor:
  - platform: gpio
    pin:
      number: 18
      mode:
        input: true
        pullup: true
      inverted: false
    name: "Closed"

  - platform: gpio
    pin:
      number: 19
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Open"
    filters:
      - delayed_on: 500ms
      - delayed_off: 500ms

switch:
  - platform: gpio
    pin: 21
    id: relay
    name: "Remote"
    icon: "mdi:garage-door"
    on_turn_on:
    - delay: 100ms
    - switch.turn_off: relay
#

that's the ESPhome code, gives me a switch, and 2 binary_sensors in HA

#

I'm trying to combine these binary sensors into one garage entity with Open/Closed/Opening/Closing states...and i'm a bit lost

#

I have my configuration.yaml with cover: !include covers.yaml
and the covers.yaml has this:

  covers:
    garage_door:
      device_class: garage
      friendly_name: "Garage Door"
      position_template: "{{ states('binary_sensor.garage_door_closed') }}"
      open_cover:
        - condition: state
          entity_id: binary_sensor.garage_door_closed
          state: "on"
        - service: switch.turn_on
          target:
            entity_id: switch.garage_door_remote
      close_cover:
        - condition: state
          entity_id: binary_sensor.garage_door_closed
          state: "on"
        - service: switch.turn_on
          target:
            entity_id: switch.garage_door_remote
      stop_cover:
        service: switch.turn_on
        target:
          entity_id: switch.garage_door_remote
      icon_template: >-
        {% if states('binary_sensor.garage_door_closed')|float > 0 %}
          mdi:garage-open
        {% else %}
          mdi:garage
        {% endif %}```