I’ve got an ESP32 connected to my ‘dumb’ garage door opener, with reed switches on both fully-closed and fully-open positions. Plus a relay controlling the open/close switch. I’ve flashed with ESPHome, and have 3 entities (switch, closed, open). 
What i’d like to do is combine the 2 position sensors (binary_sensor) into a Garage Door entity, which shows position based on the state of those sensors (ie, if closed=true and open =false, “Closed”, or if closed=false and open=false, “Opening/Closing/Halfway”)
The reason i’m using the fully open sensor is so I can determine whether the door is fully closed, in transit/halfway or fully open.
I’ve tried a few other posts examples but I can’t seem to get it to work. Setting up a Cover template doesn’t work correctly either.
I have this in a covers.yaml split from the main config.yaml, can anyone offer some insight please?
- platform: template
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 %}
Thanks in advance.