📲 Contact Sensor (Door or Window) Left Open Notification

You can certainly implement this yourself with the help of the inputs Custom Action Issue State and Custom Action From Issue State.

do I have to sleect each entity (many windows and door) individually ?

Yes, as of now this is a limitation of this blueprint.

I guess grouping solves it you need to put that in the blueprint so users can do that (I did not until I researched)

Hi, thx for this blueprint. What is the best way to configure it for multiple sensors? I have about 15 window sensors and i dont want to create a seperate automation for each single one of them.

2 Likes

I am interested in receiving a warning when rain is threatening.
Perhaps even setting up a rain sensor in combination with the “window open” alarm to tell me to CLOSE THE WINDOWS/DOORS.

I have done this, but it aint triggering:

Sorry for the late reply. It’s hard for me to troubleshoot the problem without the trace of the execution. Can you send me screenshots of an execution?

choose:
  - conditions:
      - condition: trigger
        id: send_notification
      - condition: []
    sequence:
      - repeat:
          sequence:
            - parallel:
                - repeat:
                    count: '{{ number_of_notify_services }}'
                    sequence:
                      - service: '{{ notify_services_list[repeat.index-1] }}'
                        data:
                          message: >-
                            {{ friendly_name }} har vĂŚret ĂĽben siden {{
                            as_timestamp(now()) | timestamp_custom('%T', True)
                            }}.
                          title: ' {{ friendly_name }} er efterladt ĂĽben'
                          data:
                            clickAction: /lovelace/klima
                            url: /lovelace/klima
                            tag: '{{ notification_tag }}'
                            color: ''
                            notification_icon: mdi:{{ notification_icon_warning }}
                            push:
                              interruption-level: time-sensitive
                            persistent: false
                            sticky: false
                - choose: []
                  default:
                    - service: climate.set_preset_mode
                      metadata: {}
                      data:
                        preset_mode: Pause
                      target:
                        device_id: f9a1f9c504f86d7f6058f203bcf49bbb
            - if:
                - '{{ repeat_notification }}'
              then:
                - delay: '{{ time_between_repeat_notification }}'
          until:
            - '{{ not repeat_notification }}'
  - conditions:
      - condition: trigger
        id: delete_notification
      - '{{ delete_notification }}'
    sequence:
      - parallel:
          - repeat:
              count: '{{ number_of_notify_services }}'
              sequence:
                - service: '{{ notify_services_list[repeat.index-1] }}'
                  data:
                    message: clear_notification
                    data:
                      tag: '{{ notification_tag }}'
          - choose: []
            default:
              - service: climate.set_preset_mode
                metadata: {}
                data:
                  preset_mode: home
                target:
                  device_id: f9a1f9c504f86d7f6058f203bcf49bbb

@Malte Thanks a lot for your blueprint! May I ask you to add icons for “window” and “window-open”? And might it be possible to add “global conditions” (e.g. person at home) for triggering the event?

What I actually meant was a screenshot of the tree-like thing when you click on traces.

Thanks for the feedback. Can you explain what you mean by adding icons? Where do you want the icons? About global conditions this is absolutely possible with the additional condition added in the last release.

Edit: I think I got your request. You want the mdi-icons for that to be available on android notifications? I added that just right now.

Yes, that’s what I meant, thanks! I’m very sorry, my bad, but “window” mdi-icon does not exist. You might change it to “window-closed”.
I also overlooked the global condition, sorry.

Changed it. Also added mdi:window-open-variant. I just saw that there is an icon selector available. But changing the config would mean a breaking change for people using that config option. For now I don’t wanna go that route.

1 Like

@Malte Do you mind updating the blueprint with a toggle option to specify if the alerts are sent as critical for android devices? According to this: Critical notifications | Home Assistant Companion Docs that means setting the ttl: 0 and priority: high parameters on the notification service. Also, on Android if we want the ability to have a notification override Do Not Disturb settings, the notification must specify a notification channel name as talked about here: Introduction | Home Assistant Companion Docs. All this is is a user entered string, so perhaps adding another optional Android specific field to specify a string for the name of the notification channel and adding it as another parameter to the notification service like: channel: !input notification_channel.

The reason I suggest this is that right now the notifications on Android do not come through unless the phone is not in doze or deep sleep, like sitting on a desk.

1 Like

Hello,

I have not understood the option “Custom Action From Issue State”, it does not take into account the alert delay.
I would like to be notified (pusheover) when the alert is discarded (ex: when the door closes but only when the alert did triggered). It is possible? Or could you add a new message “End of Notification Message” for instance?

Thanks

I think I understood what you are trying to achieve. The custom action from issue state gets executed in parallel with the deletion of the notification (after the defined delay for deletion). This is also the case even when the sensor has not been in the issue state for the defined time interval meaning the notification has not even been sent. That’s a technical restriction because there is no way for me to know whether the state of the sensor has been in the issue state for long enough so that the issue state actually triggered.

I think you can add a new trigger when send_notification switch back to off, and in this case send a notification of the real end of warning.

This is a common use case for PIR detector, most ÂŤ send Âť a end of state event.

I think this is not possible because the mode of the blueprint is repeat meaning there is no way for me to send the end of state event because it never ends unless it gets restarted by the next trigger. Do you know what I mean? Can you think of a solution to this?

yes, i understand it is a stateless automation, but you can keep the current state of send_notification in a dedicated entity (you can request the user to create a helper for that). I’ll try to do something