📲 Contact Sensor (Door or Window) Left Open Notification

Looking to receive a quick heads-up if a door or window has been left open for a specific duration? You’re in the right place! This blueprint is designed for just that. It’s the ideal solution for those who want a notification when a door or window remains open for a set amount of time.

You might think, “Can’t I achieve this with a simple automation?” Well, you could, but why go through the hassle of setting up all the intricate details when this blueprint comes feature-rich and ready to go? It neatly encapsulates all the necessary elements, saving you time and effort in crafting intricate automations.

I’m thrilled to introduce an upgraded version of the Contact Sensor Left Open Notification blueprint, inspired by the fantastic work of @Neekster (check it out here). This update not only modernizes the selectors but also brings in some cool functionalities based on things that I found the original blueprint was lacking.

What’s New and Improved :rocket:

Smart Notification Management :robot:

Clear Notifications: Now, the blueprint automatically clears a notification if, for example, your spouse closes the window. No more unnecessary alerts, just the info you need.

Flexible Notification Delivery :satellite:

Multiple Notify Services: Forget about notify groups! Customize your notifications by providing a list of notify services separated by commas. Now, it’s super easy to notify multiple devices.

Extended Entity Support :arrows_counterclockwise:

Input Boolean Compatibility: Alongside the traditional binary sensor support, I’ve added compatibility with the input_boolean domain as a trigger entity. More flexibility, more control.

Blueprint Code :hammer_and_wrench:

Click the badge to import this Blueprint:

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

Configuration / Functionality :couch_and_lamp:

Let’s take a quick tour of the essential configuration options:

  • :robot: Entity: Define the entity triggering the automation (binary_sensor or input_boolean). Use binary grouping of entities to avoid creating individual automations for each entity.
  • :label: Custom Device Friendly Name: Set a personalized name for the entity in the notification. Defaults the entities friendly_name if left empty. This also supports enumeration with binary_sensor groups.
  • :warning: Issue State: Specify the state triggering the automation (on/off for binary sensors).
  • :alarm_clock: Time before alert: Set the duration before an alert is triggered to find the right balance.
  • :mag: Additional condition: Define a condition that is checked after the initial trigger before the notification is sent.
  • :wastebasket: Delete notification when not in issue state anymore: Opt for automatic notification deletion when the issue is resolved.
  • :alarm_clock: Time from issue state before alert removal: Fine-tune the duration before removing the alert.
  • :calling: Notify Service: Choose the service delivering the notification and even notify multiple devices with a comma-separated list.
  • :link: Click URL: Define the destination when tapping the notification (e.g., control panels).
  • :pushpin: Notification Title: Customize the title for quick context understanding.
  • :mailbox_with_mail: Notification Message: Craft a personalized message for the notification.
  • :repeat: Repeat Notification: Whether or not a notification should be repeated after a certain time.
  • :hourglass_flowing_sand: Time Between Repeat: Time period after which the repeat notification is triggered.
  • :rotating_light: Notification Icon (Android Only): Choose an icon representing the reported issue.
  • :rainbow: Notification Color (Android Only): Pick a color for visual distinction.
  • :pushpin: Persistent Notification (Android Only): The notification cannot be closed manually.
  • :bell: Interruption Level (iOS Only): Define the intrusiveness and delivery during focus modes.
  • :gear: Custom Action Issue State: Custom actions that are executed when the device state enters the issue state.
  • :gear: Custom Action From Issue State: Custom actions that are executed when the device state exits the issue state.

Feel free to customize these settings to match your preferences and smart home requirements.

Changelog :spiral_calendar:

Stay tuned for updates on the Enhanced Contact Sensor Left Open Notification Blueprint:

  • 2024-04-23
    • Added a highly requested feature: By using a binary_sensor group you now just need to have one automation. And the best part is if you leave the Custom Device Friendly Name field empty this defaults to the friendly_name of the entity and also expands the binary_sensor group. This means inside the notification you can now see which exact sensor(s) is in the Issue State. Thanks to @123 for this blogpost.
    • Added a variable named triggered_at which you can use inside the Notification Title/Message. Inside this variable the actual initial trigger time gets stored and does not change repeatedly when using the Repeat Notification option.
    • Added a version to the description part of the blueprint so you know if you are running the current version. Thanks @chris400!
    • Added links to various documentation pages to make this blueprint more self explanatory.
  • 2024-04-05: Added icons for mdi:window-closed, mdi:window-open and mdi:window-open-variant. Thanks @meiser for pointing out that these were missing!
  • 2024-03-05: Major Update! Added condition on trigger, repetitive notifications with custom time interval, two action selectors to run additional actions when state changes to and from issue state in parallel with notification, an option to use persistent notifications on android, and fixed notification tag length being too long
  • 2023-12-10: Now the previous “fix” actually was fixed.
  • 2023-12-08: Due to some formatting changes when importing the blueprint via the gist destroyed the clear notification feature. I fixed that.
  • 2023-12-08: Initial version

I’d love to hear your thoughts and experiences. Happy automating!

18 Likes

Hey Malte,
Thanks for this blueprint! It is exactly that I was looking for. I’ve tested it the last two days and have the following two points:

  • Triggered notifications are not cleared automatically after I’ve closed the corresponding window. Side note: I’ve reimported the Blueprint regarding your change log information
  • It would be great to fully support “groups”. Personally I use a group for all windows. If one or more windows are left open, it would be nice to great, to get the information in the notification text, which specific windows are still opened.
    Maybe the following snipped could be helpful:
{%set current_open %}
  {{ (expand('binary_sensor.window_group') 
  | selectattr('state', 'eq', 'on')
  | map(attribute='name') | list)}}
{% endset %}

Thanks for your work :slight_smile:

5 Likes

Hey @schlomm,
thanks for your feedback!

  • About the clear notification not working. I found the bug that was present. Please re-import and it should work now :slight_smile:
  • I understand the requirement with the groups. I will look at it when I have time, but I can’t tell you when that will be.
3 Likes

Just to confirm your latest fix: Notifications are now cleared automatically after Window is closed :slight_smile: Thanks!

How to make notification like:

service: media_player.play_media
data:
media_content_id: >-
Important! Door XXX is still open.
media_content_type: text
target:
entity_id:
- media_player.yandex_station

This is not possible with this blueprint. You’d have to change the behavior of the action of this blueprint.
So far it is only designed to work with the android and iOS companion app notification services.

I really like the idea of this blueprint, but I cant get it to send notifications. I can see that the automation is running after my window has been open for the set time, but I dont get any notification, and neither then i manually run the automation from the interface. I have a lot of other automations with notify, and they works perfectly

alias: TEST
description: ""
use_blueprint:
  path: Raukze/contact-sensor-left-open-notification.yaml
  input:
    notify_services_string: notify.mobile_app_tciphone
    trigger_entity: binary_sensor.matias_window
    friendly_name: test

Any ideas?

2 Likes

I have no idea. Is there any output in the log at the ha logs at trigger time?

sadly not. Dont get it. very wierd, but thanks for sharing anyway

Have you tried this with another mobile app device? Also if you haven’t already done so you could take a look at the past executions of the blueprint/automation as explained here. Maybe this way you can find out what’s wrong.

Thank you so much for posting this blueprint which worked flawlessly for me! I am switching from Alarm.com to ring since I had so many of their cameras and was double paying and not having the alert for a sensor left open with Ring was about to make me send it all back. I was able to import the Home Assistant VM to my QNAP along with the mqtt add-ons and your Blueprint saved the day. Sad that Ring still hasn’t added this simple feature but wifey and I are happy with it now.

Love this blueprint. I have been testing with various doors and windows. Great work. I do have a situation where I think the blueprint should allow for a condition after the initial trigger. Perhaps it does and I don’t understand it.

We often will open a window in a particular room to “air it out”, but we don’t want to whole house to “air out”, so I want alert if the room is airing out, BUT (aka condition) the room door has been left open as well…

Thoughts?

Hi @Malte
if i undestood correctly this will fire notifications fo each window seperately, correct?
Meaning if i open 3 windows within 3 minutes i will get 3 seperate notifications within that 3 minutes?

i’m looking for a solution for a combined/summarized notification that will come once during the configured time.
Is it possible to get an update for this?

thanks, Gyle

I understand your requirement. Adding a condition is currently not possible but definitely doable. I don’t know when I’ll be implementing this but I’ll add it to my todo list.

Yes you’re correct. About the summarized notification: I have been testing exactly that in the past, but have not yet come up with a solution that satisfies me and is not a breaking change for people already using the blueprint. I’ll add this one to my to do list.

1 Like

@gyle @Malte One option here could be to create a helper. For example, if you are monitoring your windows in your living room, you could create a “Combine the state of several sensors” helper for all the contact sensors for each of your living room windows. The new sensor would be a single binary sensor which you should be able to use in this blueprint.

Your “friendly name” could then just be “Living Room Windows”. Doesn’t exactly tell you which windows, but close enough to get you to the right room for someone to check them and close them.

Great Blueprint!
Is there a chance to get a reminder after a few minutes?
So If the first notification was ignored - like a loop?

I second the request to support groups :slightly_smiling_face:

And another Request :): Would be great if you could add a action option, for example to add a mediaplayer to get a notification via text to speech

Nice blueprint. Would it be possible to add an option for multiple binary_sensors instead of having to create individually?

Thanks

2 Likes