Home Assistant

Open the cover when the window opens

A window or door contact that opens saves the cover's position and opens the cover. When the contact has been closed for a few seconds, the cover goes back, unless you moved it while the window was open.

Difficulty · BeginnerSetup · 20–40 minutesHA · current stable (blueprint)
Get the pack · from $9Have us set it up

Some hardware links on this page are affiliate links. As an Amazon Associate I earn from qualifying purchases. We may earn a commission if you buy through them, at no extra cost to you. See the affiliate disclosure.

A blind that stays down in front of an open window just flaps. This blueprint, when a window or door contact goes from closed to open, saves the cover and then opens it. When the contact has been closed again for a few seconds, it puts the cover back where it was. If you move the cover yourself while the window is open, an optional guard leaves your position alone.

Entity ids are blueprint inputs. Do not publish which sash this is.

A message when something opens is door and window open notify. Pausing heat or cool while a contact is open is window-open climate pause. This one only moves a cover, and it puts that cover back.

What problem it solves

You want the cover out of the way while the window is open, and you want the old position back when you close the window, without a second automation to remember a percent.

How it works

For a contact with device_class: window or door, on is open and off is closed. Fix an inverted sensor before you trust the restore.

  1. Open saves, then opens — the contact goes from off to on. If the cover’s current_position is already 100, the run stops. There is nothing to save and nothing to open. Otherwise scene.create snapshots that cover under a scene id derived from the entity id, and cover.open_cover runs.
  2. The snapshot is the memory — the scene holds the cover’s state, including position when the cover reports one. The blueprint does not use an input_number. A cover with no position still restores open or closed.
  3. Close restores — the blueprint waits until the contact has been off for the close delay (pack default 4 seconds). It turns the snapshot scene on, which returns the cover, and then deletes the scene.
  4. A manual move can win — the guard is an input, default off. With it on, the blueprint stores the position it saw just after the open command finished. If current_position is different when the contact closes, someone moved the cover and the restore is skipped. The scene is still deleted. With the guard off, the snapshot always wins, which is the right choice when the cover’s position attribute is noisy.
  5. A restart in the middle — if Home Assistant starts and the snapshot scene still exists, the blueprint waits the boot delay (pack default 30 seconds) so the cover integration is back, then continues the wait for a closed contact. It does not open the cover a second time.

mode: single. A second open while the first run is waiting does not create a second snapshot.

Hardware notes

  • Contact. Any binary sensor that is on when the opening is open, device class window or door. One contact per blueprint instance. Two sashes that should share one cover can be a binary-sensor group shown as a window.
  • Cover. A cover entity the open service actually moves. Tilt-only covers that ignore cover.open_cover need a different action. This pack calls cover.open_cover, then restores with the scene.
  • Position. Covers that report current_position restore a percent. Covers that only report open and closed restore that. The guard needs current_position. Leave the guard off when the attribute is missing. The blueprint’s skip-if-already-open check treats a missing position as “not fully open,” so it still snapshots and opens.
  • No new radio. The contact and the cover are assumed to already be in Home Assistant. The linked contact is for a window that does not have one yet.

Snippet

The pack ships a blueprint. Inputs replace real entity ids.

trigger:
  - trigger: state
    entity_id: !input window_contact
    from: "off"
    to: "on"
    id: opened
  - trigger: homeassistant
    event: start
    id: boot
action:
  - choose:
      - conditions:
          - condition: trigger
            id: opened
          - condition: template
            value_template: "{{ state_attr(cover, 'current_position') | int(0) < 100 }}"
        sequence:
          - action: scene.create
            data:
              scene_id: "{{ scene_id }}"
              snapshot_entities:
                - !input cover_entity
          - action: cover.open_cover
            target:
              entity_id: !input cover_entity
      - conditions:
          - condition: trigger
            id: boot
          - condition: template
            value_template: "{{ states('scene.' ~ scene_id) not in ['unknown', 'unavailable'] }}"
        sequence:
          - delay:
              seconds: !input boot_timeout
  - wait_for_trigger:
      - trigger: state
        entity_id: !input window_contact
        to: "off"
        for:
          seconds: !input close_delay
  - if:
      - condition: template
        value_template: "{{ not respect_manual or position_unchanged }}"
    then:
      - action: scene.turn_on
        target:
          entity_id: "{{ 'scene.' ~ scene_id }}"
  - action: scene.delete
    target:
      entity_id: "{{ 'scene.' ~ scene_id }}"

scene_id comes from the cover entity id, with the domain dot replaced, so two covers do not share a scene. respect_manual is the guard input. position_unchanged is the blueprint’s compare against the position taken after the open. close_delay defaults to 4 seconds and boot_timeout to 30 seconds.

Setup outline

  1. Import the blueprint. Pick one cover and one contact.
  2. Leave the guard off for the first test. Open the window. The cover should open, and a scene named from that cover should exist.
  3. Close the window and wait out the close delay. The cover should return to the position it had, and the scene should disappear.
  4. Open the window again, move the cover to a different percent from a dashboard, then close the window. With the guard off, the cover returns to the snapshot. Turn the guard on and repeat. The cover should stay where you moved it.
  5. Restart Home Assistant while the window is open and the scene exists. After the boot delay, closing the window should still restore.

Troubleshooting

  • The cover never opens. The contact did not go from off to on, or current_position is already 100. An inverted contact looks closed when the window is open. Check the device class and the state in Developer Tools.
  • It opens and immediately restores. The contact bounced to off. Raise the close delay. A group of two contacts restores when the group is closed, which is when every member is closed.
  • Restore goes to fully open or fully closed, not the old percent. This cover does not report current_position, so the scene only has open and closed. That is the whole memory available. The guard will not see a percent either. Leave the guard off.
  • You moved the cover and it jumped back. The guard is off. Turn it on. If it still jumps back, the position attribute did not change, so the blueprint believed nobody had touched it.
  • After a restart the cover stays open forever. The snapshot scene was deleted, or it was never created because the cover was already at 100. Open and close the window once to take a new snapshot. The boot path only resumes a scene that is still there.
  • Two covers move. Both automations use the same contact, or the scene id collided because the template was edited to a constant. Leave the scene id template on the cover entity id.

Credits

Based on Open cover with window. That blueprint snapshots the cover with scene.create, opens it when the contact opens, and applies the scene when the contact has been closed. This write-up is an original overview of that path, plus an optional guard so a manual move during the open window is left in place. The guard is off unless you turn it on.

Changelog

v1.0 · Oct 28, 2026: First publish.