Cannot call "cover.set_cover_position'

Hello

I have a roller shutter controlled by a Aqara Relay T2 in interlock mode, to which I added a motor encoder using ESPHome rotary encoder component. Both of these parts work perfectly.

The problem is when I try to set the position of the shutter I get “Entity xxxx does not support the cover.set_cover_position action”.

Here is my cover config :

cover:
  - platform: template
    covers:
      volet_roulant:
        unique_id: volet_roulant
        device_class: shutter
        friendly_name: "Volet roulant"
        position_template: "{{ states('sensor.shutter_position_volet') }}"
        open_cover:
          action: switch.turn_on
          target:
            entity_id: switch.volet_roulant_montee
        close_cover:
          action: switch.turn_on
          target:
            entity_id: switch.volet_roulant_descente
        stop_cover:
          action: switch.turn_off
          target:
            entity_id:
              - switch.volet_roulant_descente
              - switch.volet_roulant_montee

Form my understanding of the documentation (the Garage door example) it should be enough. Or do I have to define set_cover_position ? if so, how ?

For reference, my ESPHome config :

esphome:
  name: shutter
  friendly_name: shutter

sensor:
  - platform: rotary_encoder
    id: encoder
    name: 'Position volet'
    pin_a: D1
    pin_b: D2
    unit_of_measurement: "%"
    publish_initial_value: True
    filters:
      - calibrate_linear:
          method: exact
          datapoints:
            - 0 -> 100
            - 6 -> 75
            - 12 -> 50
            - 21 -> 25
            - 32 -> 5
            - 38 -> 0

Thank you

I was able to achieve the desired behaviour with this configuration. As I am new to this, feedbacks are appreciated :slight_smile:

        set_cover_position:
          - choose:
            - conditions:
                - condition: template
                  value_template: "{{ states('sensor.shutter_position_volet') | int > position }}"
              sequence:
                - action: switch.turn_on
                  target:
                    entity_id: switch.volet_roulant_descente
                - wait_template: "{{ states('sensor.shutter_position_volet') | int <= position }}"
                  timeout: 60
                - action: switch.turn_off
                  target:
                    entity_id: switch.volet_roulant_descente
            - conditions:
                - condition: template
                  value_template: "{{ states('sensor.shutter_position_volet') | int < position }}"
              sequence:
                - action: switch.turn_on
                  target:
                    entity_id: switch.volet_roulant_montee
                - wait_template: "{{ states('sensor.shutter_position_volet') | int >= position }}"
                  timeout: 60
                - action: switch.turn_off
                  target:
                    entity_id: switch.volet_roulant_montee