šŸ“² Contact Sensor (Door or Window) Left Open Notification

Thanks, Iā€™m glad that the blueprint is helping you! What you are trying to achieve is not possible and neither do I intent to add a custom trigger. Itā€™s not that I donā€™t want to, but put simple the design of the blueprint wonā€™t allow me to add such a feature.

1 Like

Awesome blueprint, thx a lot!
For Android users it could be helpful to add an option to add the following two fields to the data object:

ttl: 0
priority: high

That will make the notifications appear immediately.
See documentation:

I use it for all my notifications and itā€™s a day and night difference in delivery speed.

Hi @Malte
thank you very much for this great blueprint.
Got a question if the following scenario is already supported (and how this can be achieved) or the blueprint may be enhanced to support it.

What I want to achieve is the following:

  • when a window is opened and the outside temperature is below, say, 20 degree Celcius, I want get a notification.

  • however, when a window is opened and the outside temperature is above, say, 20 degree celcius, I donā€™t want a notification yet.
    However if the outside temperature is dropping, the window is still open (so no new trigger), below that temperature I want to get (repeating) notification(s).

Thanks in advance.

Thanks @wfrey! Iā€™m glad that you like it.

Sorry but currently the automation does not trigger when the custom condition changes. Thus this is neither possible currently nor do I intend to add this as a feature because this would add a lot of overhead. Hope you can understand!

Sorry for the late reply. Iā€™ll add that to my todo list.

Hello,

Thanks for the blueprint itā€™s a big help. I am new to home assistant so it possible I am not using the blueprint correctly but I canā€™t get exactly the use I am looking for. I want to check if a window is open late in the day i.e. in the evening before going to bed. The window may have been open all day. I have tried to use and additional time trigger with setting a range of optional times but I have noticed if the window is open before this time the automation doesnā€™t trigger. Am I doing something incorrectly ?

hi @Malte

thanks for your Blueprint. Somehow it does not work as I expected.

I have combined all my windows in a binary sensor (binary_sensor.window). I have entered this in your blueprint under Entity.

When I open window 1, I get a message from the window. If I also open a second window (which is in the sensor group), I do not receive a new message about the open second window after the timer has expired.

Even if the first window is closed and the second window is still open, I do not receive a message about the second window.

Have I configured your Blueprint incorrectly? I thought that every single window is monitored in the binary_sensor.window.

You are not doing anything incorrectly but your use-case is not what this blueprint is intended for. You could just write your own small automation and straight up use the window sensors value for that as it represents the current state. I hope a understood your requirement.

I understand what you are trying to achieve. This is not possible. The behavior you are describing is expected. The notification does only trigger once if you havenā€™t set the repeat option and specified a time. With the repeat option turned on and the friendly name left empty you will get an enumeration of all sensors within that binary_sensor group that are in the issue state. Hope that this helps.
If you still want exactly your behavior you will have to create an individual automation for every sensor.

Hi Malte,
thanks for the blueprint I use it with several sensors.
But I am to stupid to do one automation.
Garagedoor should give an Alarm when it is open above 15 min but just after sunset before sunrise because during the day it is OK.
When I open my door before or after Sunrise/Sunset the automation works well but when I forgot to close my door during the day in donā€™t get a message after sunset that the door is still open (because it is over 15 mins open). Any suggestions how I can set the time from 15 min to 15+ mins?
I hope that you got what I like to say.
Thanks for your help.

Mathias

Iā€™m wondering why the notifier always shows the time of the first message and not the time of the event that fires the notify the first time. The message says some ā€œdoor-open-timeā€, but if I use a wait time the value is incorrect.
I tried to fix it with

{{ as_timestamp(initially_triggered_at - timedelta(minutes=10)) | timestamp_custom('%T', True) }}

in the notification message inside the frontend. It saves without problems, but I dont get a notification on the companion app, even though the trigger said its fired. Any suggestions?

1 Like

Seems that somebody is interested in the idea. I realised it by tweaking the blueprint at line 254 by changing the variable ā€œinitially_triggered_atā€:

initially_triggered_at: "{{ now() - timedelta(minutes=10) }}"

Sadly this only works if all delays of your corresponding automations are e.g. 10 min.

But Iā€™ve got one other question:
I would love to use a dynamic delay for the notification. Reason: it makes sense to adjust the opening duration for the windows depending on the outside temperature. So I set up a helper ā€œsensor.dauer_luftenā€ which has the outputs: 5, 10 or 15 depending on the temperature. But Iā€™m just not able to include this information into the blueprint.
I tried changing the !input variable ā€œduration_issue_stateā€ in lines 223 and 241 to "{{ states('sensor.dauer_luften') }}". But I realised, that ā€œforā€ needs something like

minutes: 10
seconds: 5

So I put the variables back where they were and tried to change the selector in the gui to ā€œtemplateā€, but the notification wonā€™t fire. I tried

but realised that YAML this gives

Are the quotation marks the problem? Iā€™m running out of ideasā€¦

Hey there, I currently do not have the time to check how to do this myself but from my quick research of the official documentation what you are trying to achieve seems pretty doable:

  • About your definition of initially_triggered_at. You could just use the value of the variable duration_issue_state in the timedelta object to make that dynamic.
  • About your sensor value not being in the correct format (that seems to be the problem): maybe these two links can help you:

If you are not already using the template option of the developer tools Iā€™d highly suggest them for your testing.
Open your Home Assistant instance and show your template developer tools.

@Malte This script is awesome! Exactly what I was looking for to announce a door is left open.

How can I combine custom actions to play on multiple echos more elegantly? I tried a comma, but got an error.

alias: Door Left Open 240916 v1
description: ""
use_blueprint:
  path: Raukze/contact-sensor-left-open-notification.yaml
  input:
    trigger_entity: binary_sensor.doors
    duration_issue_state:
      hours: 0
      minutes: 0
      seconds: 10
      days: 0
    notify_services_string: notify.mobile_app_sw_s23
    custom_action_issue_state:
      - action: notify.alexa_media_wylie_s_echo_show
        metadata: {}
        data:
          message: >-
            door {{friendly_name}} is open at {{
            as_timestamp(initially_triggered_at) | timestamp_custom('%T', True)
            }}.
      - action: notify.alexa_media_everywhere
        metadata: {}
        data:
          message: >-
            door {{friendly_name}} is open at {{
            as_timestamp(initially_triggered_at) | timestamp_custom('%T', True)
            }}.
      - action: notify.alexa_media_echo_master_bed
        metadata: {}
        data: {}
          message: >-
            door {{friendly_name}} is open at {{
            as_timestamp(initially_triggered_at) | timestamp_custom('%T', True)
            }}.
      - action: notify.alexa_media_library_fire_tv
        metadata: {}
        data: {}
          message: >-
            door {{friendly_name}} is open at {{
            as_timestamp(initially_triggered_at) | timestamp_custom('%T', True)
            }}.
    notification_click_url: /lovelace-doors/0

Probably this is what you are looking for.