Garage Cover Template ON/OFF Sensor

Hello Folks,

So for the very first time after using HA for more than 3 months, I am using templates. In this case, I am combining my garage door and sensor into a single template. The documentation of cover template says the value template only recognizes true/false, open/close sensor status. However, my sensor status spits out “on” for an opened door and “off” for a closed door. Howe can go about fixing this.

cover:
  - platform: template
    covers:
      garage_door:
        friendly_name: "Garage Door"
        value_template: "{{ states('binary_sensor.garage_door_sensor') }}"
        open_cover:
          service: switch.toggle
          data:
            entity_id: switch.garage_door
        close_cover:
          service: switch.toggle
          data:
            entity_id: switch.garage_door
        icon_template: >-
          {% if states('binary_sensor.garage_door_sensor') == "on" %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}      

What doesn’t work?

try

{{ is_state('binary_sensor.garage_door_sensor', 'on') }}

in the value_template

If you haven’t already figured it out.

Hey @fxcoolby nevermind, I had one extra closed bracket and as soon as I deleted it everything worked. Thanks @elwing for the fix.