Notification if Door or Window is left open

This blueprint will run whenever a binary sensor is left on (or off) for a configurable amount of time. The most common use case for this is to get notified when a door or window is left open, but it can also be used for motion sensors or any other binary sensor. This blueprint is easy to set up, but also highly configurable, making use of many of the HomeAssistant companion apps’ notification features.

As this is my first blueprint, there may be bugs in the code, so let me know if you spot any, and I’ll try to fix them ASAP. Thanks in advance!

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

  name: Contact Sensor Left Open Notification
  description: "Notifies you when a door or window is left open. 

    For more information on setting the click url, please visit the companion docs:

    If you'd like to notify multiple people, use a notify group:

  domain: automation
      name: Entity
      description: The entity that will trigger the automation. This must be a binary sensor. (ie. binary_sensor.fridge)
          domain: binary_sensor
      name: Device Friendly Name
      description: What should we call the entity in the notification? (ie. Fridge)
      default: ""
      name: Issue State
      description: The state that triggers the automation. Because this is a binary sensor, it can only be on or off. Use the developer tools to find the correct setting.
      default: "on"
            - "on"
            - "off"
      name: Seconds before alert
      description: The amount of time in seconds that the device can be in the issue state before an alert is triggered.
      default: "150"
          min: 1
          max: 3600
          mode: box
          unit_of_measurement: seconds
      name: Notify Service
      description: The service that will be called to deliver the notification. (ie. notify.mobile_app_my_phone)
      default: "notify.mobile_app_YOURDEVICE"
      name: Click URL
      description: Where the user will be taken if they tap the notification. (ie. /lovelace/kitchen)
      default: "/lovelace/ROOM"
      name: Notification Title
      description: The title of the notification. 
      default: "The {{friendly_name}} was left open"
      name: Notification Message
      description: The message of the notification.
      default: "The {{friendly_name}} was left open at {{now().hour}}:{{now().minute}}:{{now().second}}."
      name: Notification Icon (Android Only)
      description: The icon that is shown when the issue is reported. (ie. mdi:fridge-alert)
      default: "alert"
            - alert
            - alert-circle
            - door
            - door-open
            - motion-sensor
            - fridge
            - fridge-alert
            - home
            - home-alert
            - home-assistant
      name: Notification Color (Android Only)
      description: The color of the notification.
      default: "red"
            - "red"
            - "orange"
            - "yellow"
            - "green"
            - "blue"
            - "purple"
      name: Interruption Level (iOS Only)
      description: The intrusiveness of the notification recieved. This also determines whether the notification will be delivered while the device is in a focus mode.
      default: "active"
            - passive
            - active
            - time-sensitive
            - critical
  friendly_name: !input friendly_name
  entity: !input entity
  click_url: !input click_url
  notification_icon_warning: !input notification_icon_warning

  platform: state
  entity_id: !input entity
  to: !input issue_state
    hours: 0
    minutes: 0
    seconds: !input seconds
- service: !input notify_service
    message: !input message
    title: !input title
      clickAction: !input click_url
      url: !input click_url
      tag: !input entity
      color: !input notification_color
      notification_icon: 'mdi:{{ notification_icon_warning }}'
        interruption-level: !input interruption_level

So, others in this forum may be more nice to look into details of your code.
I wont and this is merely because you stated ‘first blueprint’ …so my response is more conceptual…why not use regular ‘automations’ for this? The GUI has lots or sufficiently powerful options to do the same…not knowing if you already investigated that and rejected of course.


The standard automation feature is fully capable of doing this same thing. My goal with this blueprint was to make the process quicker and more streamlined, especially for new users. Specifically, the UI editor only allows for specifying the title and message of the notification. This blueprint allows notification color, icon, interruption level, and click URL to be specified without messing with the companion docs or data.

Agree with bits/pieces but you can also use the gui as a starting point and use yaml to go-beyond…or (in my exceptional case) turn to nodered. What I (and this is ‘me’) like of gui -automation is the more tangible control but I agree it has limitations.
Maybe others are more advanced to help but my main message is to not make it too complex or overengineer things. When you start adding more complexity…in the end it could become unreadable in case of issues… or in other words: a technical solution might not be the right solution.

Yeah, I’m still a fairly beginner user, so I personally prefer to use as little yaml as possible, though I am getting increasingly comfortable with it. I’ve been thinking of switching to Node Red, but I like the simplicity of having all of my automations in one place using the built in automations feature.

I agree that keeping things simple is important, but I also believe that some complexity is needed for the best experience and organization. For example, having a door icon in the status bar draws my attention much better than a generic HA notification. Same with the red color. It’s a balance between simplicity and functionality.

Thanks for making this! I’ve been trying to find something like this but would like it for all doors being open after x time and before y time. Basically let me know if someone opens a door between 10:30PM and 6AM. Thoughts?

This is how I’d do it. No blueprint required.


Your automation is not what this thread was talking about. Yours will check to see if the door is opened during a time period. They are looking for one that will tell if the is open.

Is there any way to get this to check a group i have 4 doors and 12 windows on binary sensors. I do not want 16 automations there must be away in HA or NR to check all and report back which ones are open. Like if your leaving home or at night ??


Have you tried making a binary sensor group (settings > devices & services > helpers > +create helper > binary sensor group) and then using that with this blueprint? Because it works exactly like you’d expect it to.

Note the notification portion of the blueprint is broken, but the binary sensor, triggering and event work fine.

A blueprint is the right solution for this problem as it’s a reusable component. There are many conceptual ways to solve any one problem, and a blueprint is the best way for this one.

1 Like

Is it possible to add multiple notification receiver? E.g. me and my wife…

Please use a notify group for this function.

Thanks @Neekster, works fine and blueprint hides the complexity. :+1:

1 Like

Hi @Neekster. Thanks for the blueprint. It should help those who need this functionality to create a their automation quickly and easily.

To those (above) asking “why do this when one can build an automation with the GUI instead”, one needs to remember that an automation is actually stored in YAML. The GUI is in itself only facilitating the building of that YAML by hiding many details, i.e. YAML syntax and structure, but it may still require some technical knowledge that users might lack. In contrast to the generic automation GUI, a blueprint is capable of masking even more details and can provide dropdowns and other options specific to a task.

In short, if you prefer a GUI build over the blueprint, I could ask why you don’t go directly to YAML. The reasoning is the same - to simplify what you want to do depending on your skill.

1 Like

I agree with Thorrrr, it would be nice to get a notification to know what door or window is open.
The solution you propose will certainly work but you only get a warning that a door or a window is open.
You will still have go looking around the place to see what is open.
If I understand Thorrrr correct, it’s more like the low battery blueprint (Low battery level detection & notification for all battery sensors) notifications that he asked for.

When set at it’s default settings, this blueprint will notify you what door is left open if you put in the friendly name.
This will not work in groups, but it can tell you the group name.

Nice blueprint! Thanks for posting this @Neekster - was able to get this working in about 5min, exactly what I was looking for. Simply wanted a notification if the garage door was left open for X minutes.

Hi there, is there any way to put a template in the „friendly name“ field that searches the group for the real name of the Window or door?

Can this work with a group of sensors and notify which sensor is on? I notice it works well with a single sensor and can notify multiple people. If I use a group for the entity it works but does not identify which member of the group that triggered the automation.

1 Like