Problem with setting up automation for cover

The first and the third if/elif statement can be combined as the service is always cover.stop_cover if the power consumption is above 0. Can you try like this and report the errors you get:

- id: '1575468037003'
  alias: cover living room
  description: ''
  trigger:
  - event_data:
      id: [254, 242, 255, 31]
      pushed: 1
    event_type: button_pressed
    platform: event
  condition: []
  action:
  - alias: ''
    data:
      entity_id: cover.qubino_goap_zmnhcdx_flush_shutter_switch
    service_template: >-
      {% set button_press = trigger.event.data.onoff %}
      {% set power_consumption = state_attr('cover.qubino_goap_zmnhcdx_flush_shutter_level', 'power_consumption') | float %}
        {% if power_consumption > 0 %}
          cover.stop_cover
        {% elif not button_press and power_consumption == 0 %}
          cover.close_cover
        {% else %}
          cover.open_cover
        {% endif %}