Shelly 2 roller shutter tilt

I know, old question, but I am working on the same issue and found a nice solution. This might help someone else.

I have a room with 3 shutters. Two of them are “Velux”-windows (-> Velux shutters and HomeKit Controller: how to set shutter position?), the other one is controlled by a shelly 2.5.

I wanted to create scenes to set them all at a defined position. I want to use those scenes on the dashboard and in an automation (depending on sunshine intensity and room temperature). After playing around and searching the forum, I got the impression that using scripts is a better way to reach my goal.

Here is an example of my current script:

alias: Dach Rollos 33% zu
sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ state_attr(''cover.lukarne_rollo'', ''current_position'') > 66 }}'
        sequence:
          - service: cover.set_cover_position
            data:
              position: 66
            target:
              entity_id:
                - cover.lukarne_rollo
                - cover.velux_rollo_nord_2
                - cover.velux_rollo_sud
          - wait_template: '{{ not states("cover.lukarne_rollo") in ["opening", "closing"] }}'
            timeout: '00:01:00'
            continue_on_timeout: true
          - service: cover.open_cover
            data: {}
            target:
              entity_id: cover.lukarne_rollo
          - delay:
              hours: 0
              minutes: 0
              seconds: 0
              milliseconds: 400
          - service: cover.stop_cover
            data: {}
            target:
              entity_id: cover.lukarne_rollo
    default:
      - service: cover.set_cover_position
        data:
          position: 66
        target:
          entity_id:
            - cover.lukarne_rollo
            - cover.velux_rollo_nord_2
            - cover.velux_rollo_sud
      - wait_template: '{{ not states("cover.lukarne_rollo") in ["opening", "closing"] }}'
        timeout: '00:01:00'
        continue_on_timeout: true
      - service: cover.close_cover
        data: {}
        target:
          entity_id: cover.lukarne_rollo
      - delay:
          hours: 0
          minutes: 0
          seconds: 0
          milliseconds: 500
      - service: cover.stop_cover
        data: {}
        target:
          entity_id: cover.lukarne_rollo
mode: single
icon: mdi:window-shutter-open


As the shelly 2.5 still not supports the tilt-functionality, I used the “choose”-object at the beginning to test, wether the shutter is comming down or going up. Depending on this, the tilt is done by opening or closing the shutter for a view miliseconds.

EDIT: the shelly is integrated via the official shelly integration into HomeAssistant.