Data_template position cover

Maybe a picture would help? The garage shows closed but only the down arrow is active.

I basically need an if statement…if sensor is on set cover.garage_door to open, sensor is off garage door = closed. I just can’t figure how to format/write an if statement or where to put the if statement.

image

cover:
  - platform: template
    covers:
      garage_door:
        friendly_name: "Garage Door"
        open_cover:
          service: switch.turn_on
          entity_id: switch.fortrezz_mimolite_switch_2
        close_cover:
          service: switch.turn_on
          entity_id: switch.fortrezz_mimolite_switch_2
        stop_cover:
          service: switch.turn_on
          entity_id: switch.fortrezz_mimolite_switch_2
        value_template: >
          {{ is_state('binary_sensor.fortrezz_mimolite_sensor_2', 'on') }}
        icon_template: >
          {% if is_state('binary_sensor.fortrezz_mimolite_sensor_2', 'on') %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}

Let me know if this works for you.

2 Likes

That works perfect. Thanks!!