Limiting curtain position

Hi all,

I’m using Xiaomi aquara curtains and would like to limit the maximum open position. Since the curtains are opening in a 90 degree corner, they are sometimes getting stuck, so I would like to limit the curtain maximum open position just before the corner as a workaround. Currently I am able to open them, but I have to always use the slider to 90% or so. I would like to just be able to click ‘open’ and use google assistant to ‘open the curtains’ without having to state the position (‘open the curtains to 90%’).

The curtains are connected via Deconz and are visible in Home Assistant as ‘cover’. Any suggestions are appreciated, thanks!

haven’t tried it, but I think you can create a template cover, which you can use instead of the original cover. In this template cover set the position to 90% when it is opened.
I think something like this could work:

  - platform: template
        friendly_name: "My curtain"
          service: cover.set_cover_position
            entity_id: cover.original_cover_id
            position: 90
          service: cover.close_cover
            entity_id: cover.original_cover_id
          service: cover.stop_cover
            entity_id: cover.original_cover_id
          service: cover.set_cover_position
            entity_id: cover.original_cover_id
            position: "{{ (position * 0.9) | round }}"
        position_template: "{{ (state_attr('cover.original_cover_id', 'current_position') / 0.9) | round }}"

Replace cover.original_cover_id with your cover id and my_curtain with something you like.

Thanks a lot, this worked flawlessly. I only needed to remove the line with the ‘value template’ for it to work, otherwise it gave a config error.

Cool, I edited my original answer, so that it is correct now :slight_smile: