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.
- Level
- Intermediate
- Active time
- 45–90 minutes
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 — one kit per curtain. For a rod see the rod version;
- Sonoff SNZB-01P — 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 (
openingorclosing): 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_eventand press the button. Write downdevice_ieee,cluster_idandcommand. - 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
commandto 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.
At home
Marto
In Marto's kids' room one switch controls two curtains. One press opens, closes or stops, depending on what the curtains are doing at the moment.
Need a hand?
We can set up and install everything in this project. In some regions we install it ourselves — ask us.
Contact us


