Cover for Garage Door with 2 Binary sensors A little lost

Hi
I have a (template) Cover for the garage door and wanted to change the icon based of 2 binary sensors (2 reed switch’s) one for open one for closed ?.
Here is the cover

  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        position_template: "{{ states('sensor.garage_door') }}"
        open_cover:
          service: switch.turn_on
          data:
            entity_id: switch.garage_door_control
        close_cover:
          service: switch.turn_on
          data:
            entity_id: switch.garage_door_control
        icon_template: >-
          {% if states('sensor.garage_door')|float > 0 %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}

The binay switchs are
binary_sensor.garage_door_is_closed and binary_sensor.garage_door_is_open they are either on/off to state if the door is closed or open
Thanks Andrew

So does this 0 to 100 position sensor you have used actually exist?

sensor.garage_door

Hi, No the sensor.garage_door doesn’t exist just the 2 binary sensors binary_sensor.garage_door_is_closed and binary_sensor.garage_door_is_open they are reed switchs

Create it then:

sensor:
  - platform: template
    sensors:
      garage_door:
        friendly_name: "Garage Door Position"
        unit_of_measurement: ' '
        value_template: >
         {% if is_state('binary_sensor.garage_door_is_closed', 'on') %}
           0
         {% elif is_state('binary_sensor.garage_door_is_open', 'on') %}
           100
         {% else %}
           50
         {% endif %}

This assumes that the binary sensors are on when active.

3 Likes

Awesome that worked great thanks @tom_l very appreciated
Andrew

1 Like

Hi arfrater,
how did you mount the two read switches?
Do you use Shelly 1?
I installed a Shelly 1 with a read switch on my garage door.
Is it possible to install two read switches on the Shelly 1?

Thank you.

Hi @Kabala
Its a DIY setup of ESP32 with esphome then i brought a few small reed switchs from eBay and wired it all together. The sensor monitors temp and has 2 PIR’s as well.

Andrew