💬 Entity State Notification

Could you share your configuration? Maybe a screenshot? When window is open you should get a notification which will be closed when the observed entity leave its state. I use it for several windows. If your notification still appears after closing the window there must be something wrong. Would be helpful if you share your trace of the automation after closing the window.

Hi, is it possible to periodically resent the notification until the door closed? And we should be able to disable/enable periodicity with actionable notification. Thank you

1 Like

Sry, for the late answer. I’ll be working on it. Hopefully everything is easy to implement. :wink:

You can checkout the new version. :slight_smile:

  • BREAKING CHANGE: check your custom messages and title. use entity_name and active_state variables instead of the old trigger variables.
1 Like

Hi,
I have the following error when the blueprint tries to send the notification:

Unable to resolve webhook ID from the device ID

Could you share your configuration and the trace? Need the point where error occurs. Could also be a home assistant companion error. Had it once. I had to remove companion app, delete the login tokens using the browser in profile menu. Then I’d reinstall the app, log in and everything worked as expected.

Here are some remarks to the new version:

1.) The reminder message is great but until now i never saw the stop button and due to some short comings in my scenarion it is not usable

2.) To offer the entity_name is nice, but in my case not usefull. Actually i get the area name from the trigger, so that i am able to say that a window is open in this or that room. There is no need to specify the window. The firedly_name is useless to get some more information as far as i know.

3.) The trigger information ist not available for the reminder message. so i get a None in my reminder message.

This is my title

Thanks for your feedback. Could you share your automation configuration? If you want to have access to your entity id check out the variable sensor.

Sure.

alias: RE - Open window notification
description: ""
use_blueprint:
  path: panhans/entity_state_persistent_norification.yaml
  input:
    for_time_m: 10
    sensor_entity:
      - binary_sensor.gt_windows
      - binary_sensor.of_windows
      - binary_sensor.kt_windows
      - binary_sensor.lr_windows
      - binary_sensor.mbr_windows
      - binary_sensor.mba_windows
      - binary_sensor.sba_windows
      - binary_sensor.nbr_windows
      - binary_sensor.gr_windows
      - binary_sensor.abr_windows
    title: "{{ area_name(trigger.entity_id) }} - Offene Fenster!"
    message: >-
      Seit mehr als 15 Minuten sind Fenster geöffnet. Bitte prüfen, ob diese
      geschlossen werden können/müssen. {{entity_name}} - {{active_state}}
    notify_group: window_open_notification_group
    status_bar_icon: mdi:window-open-variant
    ha_notification: true
    persistent_notification: false
    period: 10
    stop_button_text: Erinnerung beenden

Try to set your title to:

{{ area_name(sensor) }} - Offene Fenster

Be sure to reload your automations. I tested out your configuration. It worked for me.

The notifications to the app is working with others scripts and blueprints… Why do you use an ID for the mobile instead of the name of the entity?

Thats the way home assistant stores it. After that I convert it to the notify service. So each device has its own service. Go to developer tools and services and look for your device. The service is called e.g. notify.mobile_app_your_device. test it out. If you get errors here you have a faulty configuration.
I had problema with passing variables with the other way of notifications. Thats why I use it that way in all my blueprints and all work fine for me.

Thanks, but works fine from the developer tools and other blueprints. I don’t know where is the problem.
Last test with other mobile device and a new app installation and the same error

Would be helpfull if you share your trace log or the generated service call in the trace section of your automation.

variables:
  active_state: 'on'
  message: 'Keep in mind: {{ trigger.from_state.attributes.friendly_name }} is open'
  title: '{{ trigger.from_state.attributes.friendly_name }} is open'
  sensor_entity:
    - binary_sensor.door_window_sensor_158d00024e0466
    - binary_sensor.door_window_sensor_158d00024eeb0d
  group_target: ''
  ha_notification: false
  notify_device: 9c8a3ec426668c26d659a6a429c3fa94
trigger_variables:
  for_time_m: 2
  for_time_m_t: '{{ for_time_m | default(0) | int  }}'
trigger:
  - platform: state
    entity_id:
      - binary_sensor.door_window_sensor_158d00024e0466
      - binary_sensor.door_window_sensor_158d00024eeb0d
    to: 'on'
    for:
      hours: 0
      minutes: '{{ for_time_m_t }}'
      seconds: 0
  - platform: state
    entity_id:
      - binary_sensor.door_window_sensor_158d00024e0466
      - binary_sensor.door_window_sensor_158d00024eeb0d
    from: 'on'
condition: []
action:
  - if:
      - condition: template
        value_template: '{{ trigger.to_state.state == active_state }}'
    then:
      - if:
          - condition: template
            value_template: '{{ notify_device != none }}'
        then:
          - domain: mobile_app
            type: notify
            device_id: '{{ notify_device }}'
            title: '{{ title }}'
            message: '{{ message }}'
            data:
              ttl: 0
              priority: high
              notification_icon: mdi:home-assistant
              tag: pesn-{{ trigger.entity_id }}
              persistent: true
              sticky: true
      - if:
          - condition: template
            value_template: '{{ group_target is defined and group_target != '''' }}'
        then:
          - service: notify.{{ group_target }}
            data:
              title: '{{ title }}'
              message: '{{ message }}'
              data:
                ttl: 0
                priority: high
                notification_icon: mdi:home-assistant
                tag: pesn-{{ trigger.entity_id }}
                persistent: true
                sticky: true
      - if:
          - condition: template
            value_template: '{{ ha_notification }}'
        then:
          - service: persistent_notification.create
            data:
              title: '{{ title }}'
              message: '{{ message }}'
              notification_id: pesn-{{ trigger.entity_id }}
    else:
      - service: notify.notify
        data:
          data:
            tag: pesn-{{ trigger.entity_id }}
            ttl: 0
            priority: high
          message: clear_notification
      - service: persistent_notification.dismiss
        data:
          notification_id: pesn-{{ trigger.entity_id }}
mode: parallel
id: '1684481281152'
alias: 'aviso al movil ventana abierta '
description: ''

Triggered by the state of binary_sensor.door_window_sensor_158d00024eeb0d at 19 de mayo de 2023, 12:28:22

If: then action executed

If: then action executed

Enviar una notificación

Stopped because an error was encountered at 19 de mayo de 2023, 12:28:22 (runtime: 0.02 seconds)

Unable to resolve webhook ID from the device ID

First things first: Don’t use trigger variables anymore. Have a look in the breaking changes. Use enity_name instead in your messages. Please also try to delete the notify device, save, add it and save again.
And I need the json trace log. You can download it when clicking the 3-dots menu.

Wait! Your are using a old version of the blueprint. Can you please update the blueprint first?

That is working now. Thanks for this.

And what did i miss with the button?

Could you share you trace log (click in your automation trace, then the 3-dots menu, download it and post it e.g. here). The service call is interesting for me. Do you use an android or iphone device?

Its an Android device and hiere ist the link to the trace.

Homeassistant trace (github.com)

If fixed the problem. As may time before the problem is in front of the screen.

I changed my notification group and misinterpreted the home assistan information as the mobile notification.

Fixing the group give the notification, the reminder and the button :rofl:

1 Like