Help setting up custom garage door opener (shelly)

Hi, I’m trying to automate my garage door (open/close and show state). For that I have wired up a shelly, using the shelly input/switch as a sensor if it’s open or closed.
But I can’t seem to figure out, how to create the custom cover entity.
Here is my code:

cover:
  #Garage
  - platform: template
    covers:
      garage:
        device_class: garage
        value_template: >- 
          {% if  state_attr('event_type.event.shellyplus1_80646fd85ea0_input_0', 'long_push')  %}
            closed
          {% else %}
            open
          {% endif %}
        icon_template: >-
          {% if event_type.shellyplus1_80646fd85ea0_input_0 == 'long_push' %}
            mdi:garage
          {% else %}
            mdi:garage-open
          {% endif %}
        open_cover:
          service: switch.turn_on
          target:
            entity_id: switch.shellyplus1_80646fd85ea0_switch_0
        close_cover:
          service: switch.turn_on
          target:
            entity_id: switch.shellyplus1_80646fd85ea0_switch_0

Problem is, it doesn’t display the open/closed state right. The shelly sends a event_type: long_push when it’s closed and a event_type: btn_up when it’s open.

Any idea how to code that?
Thanks