📲 Contact Sensor (Door or Window) Left Open Notification

I noticed in the logs that notifications to iOS devices fail to send if the topic is longer than 64 bytes, in my case because the entity id is long
I got it to work by changing the tag to keep it short:
From:
tag: "{{ trigger_entity }}-{{ friendly_name }}-{{ notify_services_string }}"
to
tag: '{{ trigger_entity }}'

1 Like

Would there be a reason I cannot get a notification when out of network. I can receive the notification with in network and receive other notifications (Alarmo specifically) when in and out of network,

Request for a persistent notifications option.
My current automation for open door/windows uses a persistent notification to ensure that the notification is not swiped away by accident and forgotten. Therefore the notification is only dismissed if the door/window is actually closed.

I would request the option to only send the notifications to users who are at home/in the ha zone. Would that be possible?

I’ll add that to my to do list.

Thanks. You are certainly not the first person in this thread wanting this. I’ll see what I can do when I rework this blueprint and add new features.

2 Likes

I know I’m a little late and I hope you were already able to solve this problem. I’d say this problem is not due to the blueprint.

Thanks for the request. I’ll add this to my to do list. This is something that will only work on Android I think.

Although I understand the request I think this would blow up the blueprint and I’d rather not include this right now.

It’s solved. It works as its supposed to. I’m new to HA, so not sure what was going on.

Thanks for the response! Great blueprint!

Thanks for this genius blueprint :slight_smile:

1 Like

Hi @Malte,

Could you please add an option to fire an action for running a script?
I would be using that one to call my Alexa to play an MP3 file based notification on my native language pre-recorded by a custom TTS engine.

What I would want to achieve is to have an audible announcement on my Alexa during the night If I have left the window open and the room is getting too cold, this would be a great wasy to avoid getting a cold by the morning. Won’t really help to have a notification on my phone as I would not notice it, specially in DND mode.

Btw, for the Alexa part I’m already using this script below
(MP3 file properties: 24000Hz; Stereo; 32 bits, 48kbps CBR)

alias: Alexa
sequence:
  - alias: Alexa
    parallel:
      - service: notify.alexa_media
        data:
          message: >-
            "<audio
            src='https://yourinstance.ui.nabu.casa/local/audio/room-getting-chilly.mp3'/>"
          data:
            type: tts
          target: media_player.bedroom_echodot
        alias: media_player.bedroom_echodot
mode: single
icon: phu:alexa-logo

Thanks,
Z

Hey there,

I’ve updated this blueprint with many more features, and you might want to consider reimporting it.

@tcarlsen: Your issue might have been due to the tag length being too long. This problem should be resolved now. @eytan: Thanks for pointing out that issue. I’ve made changes so the length will never exceed that limit again.

@imca: Persistent notifications are now possible. Please give me feedback, as this is an Android-only feature, and I currently do not own any Android devices.

@tillig: I added a condition selector that gets checked before the notification is sent. I do not check this condition when clearing the notification.

@Stothed: Your idea about a reminder is great. I’ve implemented it, and I will surely be configuring this on my production instance as well.

@xelemorf: Your idea about being able to add additional actions has now been added. There are two action selectors. One for when the notification is sent and one for when the notification is cleared.

Thanks to all of you for your valuable feedback! Please let me know if you find something not working as expected. Everything should work without a single breaking change.

2 Likes

So I’m having issues with your code. I initially used the code prior to the most recent update 03/04/24 and everything was working fine. I stopped receiving notifications when not in network (to be honest, not sure if I ever received notifications when not on network).

I updated to the most recent blue print (and accidentally deleted the old version), now not receiving notifications at all (on or off network). I haven’t changed much, if anything, as far as settings are concerned. Mind taking a look?

Note: notifications work when I run a manual notification in developer tools.

Thanks,

alias: Fridge test 2
description: 
use_blueprint:
  path: Raukze/contact-sensor-left-open-notification.yaml
  input:
    trigger_entity: binary_sensor.refrigerator_door
    friendly_name: Fridge!!
    issue_state: "on"
    duration_issue_state:
      hours: 0
      minutes: 2
      seconds: 0
      days: 0
    notify_services_string: notify.mobile_app_batphone, notify.mobile_app_batablet
    duration_from_issue_state:
      hours: 0
      minutes: 0
      seconds: 0
      days: 0
    time_between_repeat_notification:
      hours: 0
      minutes: 2
      seconds: 0
      days: 0
    notification_interruption_level: active

Thanks for the issue report. I’ll take a look at it. What would help is to see the trace of the execution. Thanks in advance!

I tested your config with a different input_boolean and of course different notify-devices in my setup and initially I wasn’t getting the notifications either but now they started working. Even though it might sound stupid try a reboot of HA because I remember also not getting notifications during development of the update but a reboot did the trick. Please report back!

I did a reboot with no resolution.

Here are my trace screenshots.


Thanks!

The screenshots you sent look like you manually triggered the automation. Can you send a trace from when the automation gets triggered by the sensor. That’s important because the blueprint automates on the trigger ID when being triggered by the actual sensor.

Sorry for the late reply, it was a long weekend.

I feel like such a dummy. After going through the traces, I realize why manual triggering may not work.

So what I found out this afternoon is that it does work, but seems inconsistent. I triggered the automation directly via the sensor itself. First time (2:48PM) did not display an alert, the second time (3:01PM) does display an alert. Nothing changed. Not sure how to troubleshoot this. Sorry for all the trouble. Thanks for taking a look.

Thanks. its working now. a small feature request. add the option to pause and resume a climate device like a radiator on open and close like:

- service: climate.set_preset_mode
    target:
      entity_id: !input climate_device
    data:
      preset_mode: !input pause_preset

// waiting for close

- service: climate.set_preset_mode
    target:
      entity_id: !input climate_device
    data:
      preset_mode: !input resume_preset