Cover garage

Hi, I have had this config for my garage cover.

#cover:
#  - platform: template
#    covers:
#      garage:
#        friendly_name: "Garasje"
#        value_template: >-
#          {% if is_state('binary_sensor.portmk_2', 'off') %}
#            open
#          {% else %}
#            closed
#          {% endif %}
#        open_cover:
#          - service: switch.turn_on
#            entity_id: switch.garasje_knapp_2
#        close_cover:
#          - condition: state
#            entity_id: binary_sensor.portmk_2
#            state: 'off'
#          - service: switch.turn_on
#            entity_id: switch.garasje_knapp_2
#        stop_cover:
#          service: switch.turn_on
#          entity_id: switch.garasje_knapp_2
#        icon_template: >-
#          {% if is_state('binary_sensor.portmk_2', 'off') %}
#            mdi:garage-open
#          {% else %}
#            mdi:garage
#          {% endif %}

But this is not supported from ver 2026.6, How do I rewrite this so it is supported from ver 6 2026?

See the pinned topic: Deprecation of legacy template entities in 2025.12