Single button toggle cover and stop cover

Short version: Is there a way to make a single button call the ‘cover.toggle’ service when the cover (a blind in this case) isn’t moving, but tell the blind to stop moving when pressed when it is moving?

Long version: I bought a couple of Ikea tradfri buttons – an N2 (4-button) and a tradfri shortcut button. I’d like to use the shortcut button as a super-simple local controller for the motor I’ve attached to a vertical blind, but as the blind is across a bifold door, a lot of the time we only need the blind to open ⅓ of the way (to expose the first pane of the door). I could use the 4-way button and bind open, close and stop (or indeed a preset position) to three of the four buttons but I was wondering if there’s a way to make the simple shortcut button toggle open and close when the blind is still, but to work as a ‘stop’ command if the blind is currently moving.

Yes.

The logic would require you to test the state of the cover, and your cover must be capable of reporting the closing and opening states:

Cover == closing or opening → action == stop

Cover == closed or open → action == toggle cover.

trigger:
  # your button press trigger here
action:
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: cover.your_cover_here
                state: 'closing'
              - condition: state
                entity_id: cover.your_cover_here
                state: 'opening'
        sequence:
          - service: cover.stop_cover
            target:
              entity_id: cover.your_cover_here
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: cover.your_cover_here
                state: 'closed'
              - condition: state
                entity_id: cover.your_cover_here
                state: 'open'
        sequence:
          - service: cover.toggle
            target:
              entity_id: cover.your_cover_here
1 Like

Thanks for this.

Late yesterday I did some further experimenting (using the visual ui) and I suspect that most of my blinds (which are controlled via the Motion Blinds integration) don’t seem to report their current state while they’re in motion, but I’ll try using your code later today as it’s entirely possibly I misunderstood the ui.

Then unfortunately it is not going to be possible to implement my automation.