---
title: "One button for the curtains: open, stop and close with a scene switch"
description: "One button does three things: if the curtain is moving, it stops it; if it is closed, it opens it; if it is open, it closes it. We show the automation from Marto’s Home Assistant."
canonical: "https://realhomeautomations.com/en/projects/one-button-for-the-curtains/"
language: en-US
updated: 2026-11-23T16:24:03+00:00
---

# One button for the curtains: open, stop and close with a scene switch

One button does three things: if the curtain is moving, it stops it; if it is closed, it opens it; if it is open, it closes it. We show the automation from Marto’s Home Assistant.

> Canonical HTML page: https://realhomeautomations.com/en/projects/one-button-for-the-curtains/

- **Difficulty:** Intermediate
- **Build time:** 45–90 minutes
- **Reading time:** 3 minutes

## Tools required

- Aqara Curtain Driver E1 (one motor per curtain; a version for a track or for a rod)
- Sonoff SNZB-01P (a wireless button, Zigbee 3.0)
- Zigbee hub or Home Assistant with a Zigbee adapter


## What readers will learn

- Make one button for opening, stopping and closing
- Use the position of the curtain as a condition
- Stop the curtain halfway with a second press


## Skill requirements

- Add a Zigbee device to Home Assistant
- Edit an automation in YAML

## Project kit

- [Curtain automation kit for tracks Aqara E1 Track Version, Zigbee](https://realhomeautomations.com/en/product/curtain-automation-kit-for-tracks-aqara-e1-track-version-zigbee/index.md)

You have one button by the door and two curtains. You want one press to be enough: if the curtain is moving, stop it; if it is closed, open it; if it is open, close it. You don't want three buttons.

 ## What you will get

 One button with "smart" behavior depending on the state of the curtain. The same logic works for one curtain or for a group.

 ## What we need

- [Aqara Curtain Driver E1, track version](https://realhomeautomations.com/bg/produkt/curtain-automation-kit-for-tracks-aqara-e1-track-version-zigbee/) — one kit per curtain. For a rod see [the rod version](https://realhomeautomations.com/bg/produkt/curtain-automation-kit-for-curtain-rods-aqara-curtain-driver-e1-rod-version-zigbee/);
- [Sonoff SNZB-01P](https://realhomeautomations.com/bg/produkt/sonoff-snzb-01p-smart-wireless-button-zigbee-3-0-multi-action-control-and-compact-design/) — one button;
- Home Assistant with the motor's cover entities.

 You need a Zigbee hub or Home Assistant with a Zigbee adapter.

 ## How it works

 The automation reads the state and position of the curtain and chooses an action. The rules are in order:

- If the curtain is moving (`opening` or `closing`): stop.
- If the position is below 5%: open.
- If the position is above 95%: close.
- If it is somewhere in the middle: above 50% close, otherwise open.

 These thresholds are in Marto's automation. You can change them.

 ## How it is at our place

 In Marto's kids' room the trigger is the event `zha_event` from a Zigbee switch, and the target is the group "Kids room blinds" with two curtains. The automation is in mode `parallel` with up to 10 simultaneous runs, so that the second press can stop the curtain while the first one is still going.

 ## Steps

- Pair the motors and the button in Home Assistant. If you have two curtains, make a group of type cover for them.
- Listen for the events: **Developer tools → Events → Listen to events**, enter `zha_event` and press the button. Write down `device_ieee`, `cluster_id` and `command`.
- Create an automation in YAML and put the recorded values in the trigger.
- Save and press the button once with an open curtain, once with a closed one and once with a moving one.

 ```
alias: One button for the curtains (example)
mode: parallel
max: 10
triggers:
  - trigger: event
    event_type: zha_event
    event_data:
      device_ieee: "aa:bb:cc:dd:ee:ff:00:11"  # replace with your own
      endpoint_id: 1
      cluster_id: 6
      command: "on"                           # replace with the command from the event
actions:
  - choose:
      - conditions:
          - condition: state
            entity_id: cover.kids_room_blinds
            state: [opening, closing]
        sequence:
          - action: cover.stop_cover
            target: {entity_id: cover.kids_room_blinds}
      - conditions:
          - condition: numeric_state
            entity_id: cover.kids_room_blinds
            attribute: current_position
            below: 5
        sequence:
          - action: cover.open_cover
            target: {entity_id: cover.kids_room_blinds}
      - conditions:
          - condition: numeric_state
            entity_id: cover.kids_room_blinds
            attribute: current_position
            above: 95
        sequence:
          - action: cover.close_cover
            target: {entity_id: cover.kids_room_blinds}
    default:
      - choose:
          - conditions:
              - condition: numeric_state
                entity_id: cover.kids_room_blinds
                attribute: current_position
                above: 50
            sequence:
              - action: cover.close_cover
                target: {entity_id: cover.kids_room_blinds}
        default:
          - action: cover.open_cover
            target: {entity_id: cover.kids_room_blinds}
```

 All the identifiers in the code are examples. You paste it as a new automation through "Edit in YAML".

 ## Checking the result

- Closed curtain: a press opens it;
- Moving curtain: a press stops it halfway;
- Open curtain: a press closes it.

 ## If it doesn't work

- Nothing happens → the trigger doesn't match the event → copy the values exactly from Developer tools;
- The button sends several events on one press → listen with a narrower condition → add `command` to the trigger;
- The curtain doesn't stop → the motor doesn't respond to stop → check "Stop" manually from the device card.

 ## Limitations

- If the motor loses its position, the 5% and 95% thresholds can get confused: recalibrate the curtain according to Aqara;
- Without Home Assistant and a Zigbee hub the button does nothing: the curtain is pulled by hand.

 ## Sources and verification status

 Checked against the documentation and Marto's Home Assistant (read-only), 22.11.2026. The model of Marto's switch is not recorded.

- [Aqara: Curtain Driver E1](https://www.aqara.com/en/product/curtain-driver-e1/)
- [SONOFF: SNZB-01P](https://help.sonoff.tech/docs/snzb-01p)
- [Home Assistant: Zigbee Home Automation](https://www.home-assistant.io/integrations/zha/)
- [Home Assistant: Cover](https://www.home-assistant.io/integrations/cover/)