Shelly 2 roller shutter tilt

Hi

I am trying to create an automation that sets my Shelly 2 roller shutter to a specific position and then tilts the slats of the shutter slightly.
The challenge here is, that the Shelly 2 doesn’t appear to support the “tilt” feature, so I had to sort of create a workaround. I had previously done this in Tasker and it worked just fine. The way this worked was to

  • set the position of the roller shutter
  • wait until shutter movement stops
  • open the shutter
  • wait 800 milliseconds
  • stop the shutter
    That way the slats were positioned in a slightly tilted position.

This is how I reproduced it in HA:

- id: 'XXXXXXXXXXX
  alias: TS down when bright
  trigger:
  - above: '7'
    below: '40'
    entity_id: sensor.sun_elevation
    platform: numeric_state
  condition:
  - below: '75'
    condition: numeric_state
    entity_id: sensor.weather_cloudiness
  - after: '15:00:00'
    before: '22:00:00'
    condition: time
  action:
  - data:
      cover_position: '38'
      entity_id: cover.tv_shutter
    service: cover.set_cover_position
  - delay: '00:00:27'
  - data:
      entity_id: cover.tv_shutter
    service: cover.cover_open
  - delay: '00:00:00.9'
  - data:
      entity_id: cover.tv_shutter
    service: cover.cover_stop

I have two problems with this:

  • I don’t know how to get the roller shutters movement status, so I don’t know when it has stopped. Per documentation, the Shelly 2 should provide “open”, “close” and “stop” as state topics via MQTT, but I have no idea how to retrieve those. For now, I have added a 27-second delay in the automation, that works ok. It would be nicer to be able to wait for the state changing to “stop” and then move on though.

  • the second problem is the tilting at the end. The 900 milliseconds worked fine in Tasker, but is not working at all in HA. The automation seems to ignore the delay and the “stop” call at the end and the shutter just goes on opening all the way. I tried a 1 second delay, that registers fine, but its no good as the shutter just opens the slats all the way and actually moves a little bit back open before stopping.

Has anyone tried to create something similar and succeeded? Is there another way to achieve slats tilt?

This is my entity in configuration.yaml:

cover:
  - platform: mqtt
    name: TV Shutter
    state_topic: "shellies/shellyswitch-XXXXXX/roller/0"
    command_topic: "shellies/shellyswitch-XXXXXX/roller/0/command"
    position_topic: "shellies/shellyswitch-XXXXXX/roller/0/pos"
    set_position_topic: "shellies/shellyswitch-XXXXXX/roller/0/command/pos"
    payload_available: "true"
    payload_not_available: "false"
    qos: 1
    retain: false
    optimistic: false
    payload_open: "open"
    payload_close: "close"
    payload_stop: "stop"
    position_open: 100
    position_closed: 0
1 Like

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.