Help with Garage door template after updating to latest home assistant update

Hi,

I had some kind of a warning appear the other day saying something about templates changing or something?

It suggested I change my garage door cover template in the configuration.yaml with a pre suggested option and now my garage door state shows as unknown and will not operate via the Shelly switch I use. I’ve tried playing around with it for an hour or so with no luck. Just wondering if anyone could help me out please? Also, sorry if I am posting in the wrong section of the forum, I just signed up to the forums to ask for help, it tells me there is 4 errors with the template

Below is my old template configuration, will post the new one below that:

old template:

template:
  - sensor:
      - name: "Garage Door"
        state: >
          {% if is_state('binary_sensor.garage_sensor', 'on') and is_state('switch.garage_door', 'on') %}
            opening
          {% elif is_state('binary_sensor.garage_sensor', 'off') and is_state('switch.garage_door', 'on') %}
            closing
          {% elif is_state('binary_sensor.garage_sensor', 'off') %}
            open
          {% else %}
            closed
          {% endif %}
 
cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: "{{ states('sensor.garage_door') }}"
        open_cover:
          - condition: state
            entity_id: sensor.garage_door
            state: "closed"
          - service: switch.toggle
            target:
              entity_id: switch.garage_door
        close_cover:
          - condition: state
            entity_id: sensor.garage_door
            state: "open"
          - service: switch.toggle
            target:
              entity_id: switch.garage_door
        stop_cover:
          service: switch.toggle
          target:
            entity_id: switch.garage_door
        icon_template: >-
          {% if is_state('cover.garage_door', 'opening') or is_state('cover.garage_door', 'closing') %}
            mdi:garage-alert
          {% elif is_state('cover.garage_door', 'open') %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}

new template that was pre generated:

template:
- cover:
  - device_class: GARAGE
    open_cover:
    - condition: state
      entity_id:
      - sensor.garage_door
      state: closed
      match: all
    - target:
        entity_id:
        - switch.garage_door
      action: switch.toggle
    close_cover:
    - condition: state
      entity_id:
      - sensor.garage_door
      state: open
      match: all
    - target:
        entity_id:
        - switch.garage_door
      action: switch.toggle
    stop_cover:
    - target:
        entity_id:
        - switch.garage_door
      action: switch.toggle
    default_entity_id: cover.garage_door
    icon: "{% if is_state('cover.garage_door', 'opening') or is_state('cover.garage_door',
      'closing') %}\n  mdi:garage-alert\n{% elif is_state('cover.garage_door', 'open')
      %}\n  mdi:garage-open\n{% else %}\n  mdi:garage\n{% endif %}"
    name: Garage Door
    state: '{{ states(''sensor.garage_door'') }}'

Can only upload one attachment per post, wanted to add garage door unknown attachment but cannot do it

I’ve just started playing around with templates in HA, so this doesn’t affect me…and I can’t answer any template questions. I’ve been following this thread and just wanted to share the link in case you haven’t seen it:

1 Like

Thank you, I will post in there for help and see how I go

1 Like

You have kept that part, right?
The deprecation notice you got was only regarding the cover: part.

Also, device_class are lowercase (“garage”).

1 Like

The all caps “GARAGE” caught my attention! But, being new to templates, I wasn’t sure that it was an issue…so I didn’t feel “qualified” to point it out. Still learning :slightly_smiling_face:

Edited: I think I remember reading about ‘device_class’ all caps in the 800+ posts Deprecation thread…

I have kept all that part and changed garage to all lower case as I seen it said there was an issue with it being in all caps

1 Like

I have the exact same situation, as I use the Shelly’s for my garage doors and created the cover exactly like you did. Have you found any resolution? for the depreciated cover?

No, I haven’t. I gave up and I have purchased an athom esp 32 based controller for my garage door which doesn’t require manually making the template (it needs to be flashed with esphome). I don’t have the time to stuff around withe the template anymore and I need something to work for my wife when she takes our daughter for a walk so she doesn’t have to take her keys.

The shelly will not work without the cover being exactly right so it is useless to me now

I was playing around this week trying to figure out a way to bypass the cover. I’ve come to find that really the only thing I absolutely need it for is to pass it through to HomeKit so I can open and close the garage on my phone. I did find a way to create another button in Lovelace that doesn’t use the cover.

type: tile
entity: switch.garage_door
name: Double Garage Door
show_entity_picture: false
hide_state: true
vertical: false
tap_action:
action: toggle
features_position: bottom
card_mod:
style:
.: |
ha-card {
height: 60px !important;
–primary-text-color: #44739E;
–tile-color: crimson !important;
–card-mod-icon: ios:door-garage-double-bay-open;

    {% if is_state('binary_sensor.garage_sensor', 'on') %}
      --tile-color: #44739E !important;
      --card-mod-icon: ios:door-garage-double-bay-closed;
    {% endif %}
  }
ha-tile-icon$: |
  .container:after {
    inset: 0;
    position: absolute;
    content: "";
    border-width: 2px;
    border-style: solid;
    border-color: var(--tile-color) var(--tile-color) var(--tile-color) transparent;
    border-radius: 50%;
    display: none;
    animation: infinite linear 1s spinner;        
    {% if is_state('binary_sensor.garage_sensor', 'off') %}
      display:block;
    {% endif %}
  }
  @keyframes spinner {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }
ha-tile-info$: |
  .secondary {
    visibility: hidden;
  }
  .secondary:before {
    visibility: visible;
    {% if is_state('binary_sensor.garage_sensor', 'on') and is_state('switch.garage_door', 'on') %}
      content: "Opening";
      color: gray;
    {% elif is_state('binary_sensor.garage_sensor', 'off') and is_state('switch.garage_door', 'on') %}
      content: "Closing";
      color: gray;
    {% elif is_state('binary_sensor.garage_sensor', 'off') %}
      content: "Open";
      color: gray;
    {% else %}
      content: "Closed";
      color: gray;
    {% endif %}
  }

I can make another button that doesn’t use the cover but I like to have the cover as a quick identifier to know if it is opened or closed without having to check my security cameras plus it is easier for my wife to also see if it is opened or closed with the cover. I found I had to use the actual switch input of the shelly without the cover to toggle it but it will just show an on or off state, off for when the dry contact is idle and on for a split second when triggered which isn’t ideal for the setup I’m going for

2025-12-11_170748
The button shows exactly that… open closed, opening, closing just like the cover.

So I went through and edited the template to resolve in my instance. My template was the same as the OP. Below is what I did in configuration.yaml. I hop this helps others who may be in the same boat as the OP and I.

  - sensor:
      - name: "Single Garage"
        state: >
          {% if is_state('binary_sensor.single_sensor', 'on') and is_state('switch.single_garage', 'on') %}
            opening
          {% elif is_state('binary_sensor.single_sensor', 'off') and is_state('switch.single_garage', 'on') %}
            closing
          {% elif is_state('binary_sensor.single_sensor', 'off') %}
            open
          {% else %}
            closed
          {% endif %}

  - cover:
    - device_class: garage
      open_cover:
      - condition: state
        entity_id:
        - sensor.single_garage
        state: closed
        match: all
      - target:
          entity_id:
          - switch.single_garage
        action: switch.toggle
      close_cover:
      - condition: state
        entity_id:
        - sensor.single_garage
        state: open
        match: all
      - target:
          entity_id:
          - switch.single_garage
        action: switch.toggle
      stop_cover:
      - target:
          entity_id:
          - switch.single_garage
        action: switch.toggle
      default_entity_id: cover.single_garage
      icon: "{% if is_state('cover.single_garage', 'opening') or is_state('cover.single_garage', 'closing') %}\n
            mdi:garage-alert\n
		  {% elif is_state('cover.single_garage', 'open')%}\n
            mdi:garage-open\n
		  {% else %}\n
             mdi:garage\n
          {% endif %}"
      name: Single Garage Door
      state: '{{ states(''sensor.single_garage'') }}'