deCONZ - IKEA Tradfri 2 button close/dimmer + Shelly 2.5 for covers with stop functionality

Hi!

I have a few Shelly 2.5 controlled covers in my house and wanted to make a blueprint to control them. Now, there are several that allow you to open and close them, but not stop them with the same buttons so I made one!

When the Shelly is in status opening/closing it stops the movement.

blueprint:
  name: deCONZ - Tradfri Shutters
  description: '"Control your Shelly shutters with the IKEA Tradfri on/off switch


    Select the Tradfri remote and your shutters. Non-Shelly devices will work fine as well.

    Shutters go up and down based on the I and O buttons, and stop when pressed again. This is based on the state of the device."

    '
  domain: automation
  input:
    remote:
      name: Remote
      description: The remote that will control the cover.
      selector:
        device:
          integration: deconz
          manufacturer: 'IKEA of Sweden'
          model: 'TRADFRI on/off switch'
    cover_entity:
      name: Cover
      description: The cover you wish to close using the button.
      selector:
        entity:
          domain: cover
mode: restart
trigger:
- platform: event
  event_type: deconz_event
  event_data:
    device_id: !input 'remote'

variables:
  cover_entity: !input cover_entity
  cover_state: "{{ states[cover_entity].state }}"
  
action:
- variables:
    event: '{{ trigger.event.data.event }}'
- choose:
  - conditions:
    - '{{ event == 1002 }}'
    sequence:
    - service: >
       {% if cover_state == 'opening' %}
         cover.stop_cover
       {% elif cover_state == 'closing' %}
         cover.stop_cover    
       {% else %}
         cover.open_cover
       {% endif %}
      entity_id: !input cover_entity
  - conditions:
    - '{{ event == 2002 }}'
    sequence:
    - service: >
       {% if cover_state == 'opening' %}
         cover.stop_cover
       {% elif cover_state == 'closing' %}
         cover.stop_cover    
       {% else %}
         cover.close_cover
       {% endif %}
      entity_id: !input cover_entity