Display Template Sensor for MyQ in HADashboard

I am trying to display the state of MyQ garage doors in HADashboard. I’ve read I need to use templates and have added the below to my configuration.yaml. However, I cannot find how to display the state of the garage door on the dashboard. I tried adding sensor.car_garage and other variations and keep getting entity not found.

configuration.yaml

sensor:
  - platform: template
    sensors:
car_garage_door:
       friendly_name: "Car Garage"
       value_template: >-
        {% if states.cover.car.state == 'closed' %}
          Closed
        {% elif states.cover.car.state == 'Open' %}
          Open
        {% else %}
          Unknown
        {% endif %}

I would like to display something similar to:

Screenshot 2020-12-01 224616

Your indentation is wrong, did you not get any errors in the logs? Should be like this:

sensor:
  - platform: template
    sensors:
      car_garage_door:
        friendly_name: "Car Garage"
        value_template: >-
          {% if states.cover.car.state == 'closed' %}
            Closed
          {% elif states.cover.car.state == 'Open' %}
            Open
          {% else %}
            Unknown
          {% endif %}

Remember that MyQ also reports “closing” and “opening” as statuses as well. You might want to account for those in your template.

1 Like

Thank you. I’m not sure why my code pasted that way on the forum, but I did have the indention correct in my config file. What am I doing wrong to display this information on a HADashboard (AppDaemon)?

title: Main Panel
widget_dimensions: [120, 120]
widget_size: [1, 1]
widget_margins: [5, 5]
columns: 8
global_parameters:
    use_comma: 0
    precision: 1
    use_hass_icon: 1
    namespace: default
    devices:
      media_player:
        step: 5
include: sensors
layout:
    - clock.clock (2x2), sensor.car_garage 

Not familiar with HA Dashboard, but do you see the sensor in Home Assistant?

In addition to noting that there are “opening” and “closing” states as Brandon noted, you should also check the “open” and “closed” states. (I notice that “closed” is
not capitalized and “Open” is. If it’s the same as mine (which is also a MyQ), both should be lower-case only.)

1 Like

No, I can’t find the sensor that I created with the Template in Home Assistant.

Why do you even need a template sensor that shows the exact same state as the cover itself?

setting up door chimes to let me know if doors are opened so I tried “opening” as the state from your post and that worked even better than open, which didn’t work for me! In the case of the garage door, knowing when it’s opening is highly preferable to door open like other sensors. Thanks for posting that!