Icon not updating on template switch

Hello, I am creating a template switch in my HA config, and I have an icon template to update the icon according to my binary sensor. However, the switch’s icon just appears as the default icon

switch:
  - platform: template
    switches:
      garage:
        friendly_name: "THE GARAGE DOOR"
        value_template: "{{ is_state('binary_sensor.garage_door_garage_door_sensor', 'open') }}"
        turn_on:
          service: switch.turn_on
          target:
            entity_id: switch.garage_door_garage_door_switch
        turn_off:
          service: switch.turn_off
          target:
            entity_id: switch.garage_door_garage_door_switch
        icon_template: >
          {% if is_state('binary_sensor.garage_door_garage_door_sensor', 'open') %}
            mdi:garage-open-variant
          {% else %}
            mdi:garage-variant
          {% endif %}

Despite what is displayed in the front end, binary sensor states are only 'on' or 'off', your templates are using 'open'.

I have updated it to something like this

switch:
  - platform: template
    switches:
      garage:
        friendly_name: "THE GARAGE DOOR"
        value_template: "{{ is_state('binary_sensor.garage_door_garage_door_sensor', 'on') }}"
        turn_on:
          service: switch.turn_on
          target:
            entity_id: switch.garage_door_garage_door_switch
        turn_off:
          service: switch.turn_off
          target:
            entity_id: switch.garage_door_garage_door_switch
        icon_template: >
          {% if is_state('binary_sensor.garage_door_garage_door_sensor', 'on') %}
            mdi:garage-open-variant
          {% else %}
            mdi:garage-variant
          {% endif %}

also, surely it would’ve gone to the else clause because ‘open’ was wrong?

Something like that or exactly that?

So it works now?

Also, why are you duplicating switch.garage_door_garage_door_switch with a template switch?

If it is to add the nice changing icons you should be using a template cover and device_class: garage

Sorry I’ll clarify. I did exactly that. It’s still not working. I am aware of covers, I have been told to use them left right & centre, but they would not work very well for my use case, because all the buttons would do the exact same thing.

Did you restart after changing it?

Are there errors in your log?

What does this return in Developer Tools → Template

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

Does it change when you open or close the door?

Why would they do that?

You seem to have an switch that is on for open and off for close.

So (after an core update, but I think thats irrelevant), I realised that it was working fine on my dashboard. I may have been looking in the wrong view. Thanks for your help.
(also the reason I don’t use cover is because my actual garage door works on a one button system, and my switch just switches on/off to electronically activate this button through relays)

The cover automatically takes care of that. The open button will only be available if the state is closed. Same for the close button when the cover is open.

Try it.

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: "{{ is_state('binary_sensor.garage_door_garage_door_sensor', 'on') }}"
        open_cover:
          - service: switch.turn_on
            target:
              entity_id: switch.garage_door_garage_door_switch
        close_cover:
          - service: switch.turn_off
            target:
              entity_id: switch.garage_door_garage_door_switch