Garage Door Openers/Sensors Combo Card

This is a guide to creating a card to control garage door openers and represent the open or closed status.
This is the end result:

I added this to configuration.yaml:

cover:
  - platform: template
    covers:
      garage_door1:
        friendly_name: "Garage Door 1"
        value_template: "{{ is_state('binary_sensor.garage_door_1', 'on') }}"
        open_cover:
          service: switch.turn_on
          entity_id: switch.garage_openers_1
        close_cover:
          service: switch.turn_on
          entity_id: switch.garage_openers_1
        icon_template: >-
          {% if is_state('cover.garage_door1', 'open') %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}
      garage_door2:
        friendly_name: "Garage Door 2"
        value_template: "{{ is_state('binary_sensor.garage_door_2', 'on') }}"
        open_cover:
          service: switch.turn_on
          entity_id: switch.garage_openers_2
        close_cover:
          service: switch.turn_on
          entity_id: switch.garage_openers_2
        icon_template: >-
          {% if is_state('cover.garage_door2', 'open') %}
            mdi:garage-open-variant
          {% else %}
            mdi:garage-variant
          {% endif %}
      garage_door3:
        friendly_name: "Garage Door 3"
        value_template: "{{ is_state('binary_sensor.garage_door_3', 'on') }}"
        open_cover:
          service: switch.turn_on
          entity_id: switch.garage_openers_3
        close_cover:
          service: switch.turn_on
          entity_id: switch.garage_openers_3
        icon_template: >-
          {% if is_state('cover.garage_door3', 'open') %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}

I used this for the card:

type: entities
title: Garage Doors
entities:
  - entity: cover.garage_door1
    icon_template: |-
      {% if is_state('cover.garage_door1', 'open') %}
        mdi:garage-open
      {% else %}
        mdi:garage
      {% endif %}
  - entity: cover.garage_door2
    icon_template: |-
      {% if is_state('cover.garage_door2', 'open') %}
        mdi:garage-open-variant
      {% else %}
        mdi:garage-variant
      {% endif %}
  - entity: cover.garage_door3
    icon_template: |-
      {% if is_state('cover.garage_door3', 'open') %}
        mdi:garage-open
      {% else %}
        mdi:garage
      {% endif %}

You just need to replace with your sensors and contacts. Be sure and restart HA after adding to configuration.yaml. I’m using ZOOZ MultiRelay ZEN16 to control all three garage door openers.

2 Likes

This is great- would you happen to have an idea of how to do something similar in ESPHome? It does not support icon_template or value_template to my knowledge and I was hoping to keep everything self-contaied there.

Thanks for sharing this code. I’m just starting out on HA journey and have been trying to get this working all day. Can you help me confirm a few details?
Should I put both pieces of code into the configuration.yaml?
Can you explain the steps to then add to dashboard after a restart?
Many thanks for any help.
J.

The card code goes on the dashboard in an added card. In my example switch.garage_openers_1 is my name for a contact closure switch. binary_sensor.garage_door_1 is my name for a sensor that closes when the garage door closes. You need to replace those with your devices.

1 Like

Thank you so much, all up and running, live & learn.

Is there any combination to work this with MQTT?
I’m trying to use it, but I got error “icon_template” can’t be used with MQTT. :frowning:

Thanks for sharing, I’ve added exactly as above to my configuration.yaml (changed the names of states etc) but get an error when creating the card: “Entity not available: cover.garage_door_r”.
Any ideas? How do I add “cover.garage_door_r” as an entity, or should this happen automatically with the configuration.yaml code? Thanks

Did you restart Home Assistant?

@TexasGreg Just wanted to say thank you for this info. It worked great. Now to Ice the MyQ integration forever…

2 Likes

Thanks for the info,
I am using a (Z-Wave) Zooz relay to open and close the garage door and an old (Zigbee) Smartthings multipurpose sensor to detect if the door is open/closed and if it is moving. I had been using MyQ but with the HA integration being removed I rigged this up.
I wanted to see if the garage door was moving in between the door opening or closing. so I figured out the following. Posting in case someone else wants to see.

cover:
  - platform: template
    covers:
      garage_door1:
        friendly_name: "Garage Door"
        value_template: >-
          {% if is_state('binary_sensor.garage_door_open_close_sensor', 'off') %}
            Closed
          {% elif is_state('binary_sensor.garage_door_moving_sensor', 'on') %}
            Moving
          {% else %}
            Open
          {% endif %}
        open_cover:
          service: switch.turn_on
          entity_id: cover.garage_relay_1
        close_cover:
          service: switch.turn_on
          entity_id: cover.garage_relay_1
        icon_template: >-
          {% if is_state('binary_sensor.garage_door_open_close_sensor', 'off') %}
            mdi:garage-variant
          {% elif is_state('binary_sensor.garage_door_moving_sensor', 'on') %}
            mdi:garage-alert-variant
          {% else %}
            mdi:garage-open-variant
          {% endif %}

Thank you for making this! This is exactly what I need, but I cannot figure out how to change to fit my setup.

To monitor garage open/close status, I am using a sensor:

  • binary_sensor.front_door_sensor_opening (this has states of “off” and “on”)

To open the garage door I am using the google assistant SDK:

  • I had to make a script to open the door
  • script.open_the_garage_door
alias: Open the Garage Door
sequence:
  - service: google_assistant_sdk.send_text_command
    data:
      command: open the garage door,CODE
mode: single

To close the garage door I am using the same google assistant SDK:

  • I had to make a script to close the door
  • script.close_the_garage_door
alias: Close the Garage Door
sequence:
  - service: google_assistant_sdk.send_text_command
    data:
      command: close the garage door,CODE
mode: single

I am able to create a button to run my scripts (I have to have separate buttons):

show_name: true
show_icon: true
type: button
tap_action:
  action: toggle
entity: script.open_the_garage_door

Any help on using your combo card with my setup would be greatly appreciated. This is a little above my head and I just don’t know how to put all of this together.

I just have 3 sensors and 3 switches. I don’t know about Google SDK.

What type of sensor did you use here to detect if the door is moving? I have a Zooz Tilt/Shock sensor that I am planning to use to detect open/close, not sure if I can use your code for my purpose or not as I’m unsure if the sensor will do the same. Using the same relay so hoping to borrow as much of this as I can. Does this go in your config.yaml file?

Also, which card did you put on your dashboard ? I’m a bit confused there as the tilt sensor would determine status of up or down, but I’d want to be able to click the door icon to trigger the call service for the relay to open/close the door.

Appreciate the help!

I use something like this for my security system to know whether the garage door is open or closed: https://www.amazon.com/Magnetic-Contacts-Shutter-Adjustable-Bracket/dp/B07ZBT28L8/

You create a new card with the code I provided, replacing my sensor and contact device names with yours.