šŸ“ State Notifications & Actions

@Blacky would you be able to mod this BP to use Event Trigger?

Some things I need to notify about with Alarmo (alarm system) are Events (not Entity states)

I have 4 entities. It seems the ā€œtriggerā€ variable is only set to the first entity not the one actually firing. My instance is hard drive overheating. I have 4 drives in the NAS. I always get notified as if its drive 1 that’s overheating.

@Ltek

As noted in the state trigger.

" If your option is not in the dropdown menu then just type the state you would like to use in and click the save button."

Blacky :grinning:

@jsk01

It should be the one that triggered the automation.

Blacky :grinning:

I was asking about an Event (its not an Entity). Would be nice to have your BP also allow for listening for (triggering on) Events. This allows for the automation to trigger on anything any HA or an integration does.

the trigger would look like this example…

event_type: alarmo_failed_to_arm

I know the workaround is to use a helper and create an automation to set/unset it, but that kinda sux for a few reasons… simply triggering on the event would be far better and more efficient.

@Ltek

I will put it on the list of suggestions.

Thanks for your input.

Blacky :grinning:

1 Like

Is there a way to prevent notifications when restarting HA? Each time I need to restart HA it sends a notification from my Ikea Water Sensors.

@Belbivy

You probably have 1 - Button Or Any State set as your trigger. Try using 2 - ON this way you only get notified when your water sensor detected water. Make sure you test it so you confirm it works for you and your sensor.

Blacky :grinning:

This appears to have resolved the issue. Thank you.

@Blacky I think I found an odd, rare, bug… I suspect something is not updating the Action buttons.

I’ve spent over 2 hours across 2 days testing 6 different automations based on this BP. The automations’ Action buttons should turn on/off these toggle buttons…

Notifications work fine but Action Buttons do not work. And Confirmations do not show, which makes me think the Action buttons are not being activated at all?

What happens… ALL 6 of the automations ONLY change the state of a single Entity, Small Deck (input_boolean.bypass_deck_large_motion)

Even when that entity is not in the BPs code (see example code below). This problem still happens after multiple reboots… and yesterday updating from HAOS 14.2 to 15.0

one of the YAMLs (YES, these action buttons are controlling SMALL DECK, not Driveway)

alias: "Notify Motion : Driveway"
description: ""
use_blueprint:
  path: Blackshome/state-notifications-and-actions.yaml
  input:
    start_trigger_state: "on"
    start_trigger_state_entity:
      - binary_sensor.philips_driveway_motion
    include_start_notify: enable_start_notify_options
    start_notify_device:
      - 4c405513584e73a3a8a3a9996bc35562
      - 3674d1323c5d602efb76a2e00225cbb3
    start_title: " {{ states[trigger.entity_id].attributes.friendly_name }}"
    start_notify_data:
      - channel
      - sticky
      - high_priority
    start_action_button_1: Disable
    include_start_auto_actions: []
    start_action_1:
      - action: input_boolean.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.bypass_driveway_motion
    include_start_action_buttons:
      - enable_start_action_button_1
      - enable_start_action_button_2
    start_notify_channel: motion-driveway
    start_action_2:
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.bypass_driveway_motion
    start_action_button_2: Enable
    start_action_button_confirmation_title: Action...
    start_action_button_confirmation_message: Driveway Motion Notifications Disabled
    start_action_button_2_confirmation_message: Driveway Motion Notifications Enabled
    start_time_delay:
      hours: 0
      minutes: 0
      seconds: 0
    start_message: " "
    global_conditions:
      - condition: state
        entity_id: input_boolean.bypass_driveway_motion
        state: "off"
      - condition: state
        entity_id: timer.bypass_timer_driveway_motion
        state: idle

@Blacky I started looking at Debug logs trying to figure out why the Action buttons do not work and I found this error happens with every trigger on the automations I have that use this same base code…

Debug Log error that happens with all these automations…

2025-03-22 14:36:22.394 ERROR (MainThread) [homeassistant.components.automation.notify_motion_deck_large] Error while executing automation automation.notify_motion_deck_large: value should be a string for dictionary value @ data['message']

one of the YAMLs…

alias: "Notify : Deck Small"
description: ""
use_blueprint:
  path: Blackshome/state-notifications-and-actions.yaml
  input:
    start_trigger_state: "on"
    start_trigger_state_entity:
      - binary_sensor.sensor_backyard_bosch_motion_deck_s_occupancy
    include_start_notify: enable_start_notify_options
    start_notify_device:
      - 4c405513584e73a3a8a3a9996bc35562
      - 3674d1323c5d602efb76a2e00225cbb3
    start_notify_data:
      - channel
      - sticky
    start_notify_channel: motion-backyard
    start_action_1:
      - action: input_boolean.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.bypass_deck_small_motion
    start_action_2:
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.bypass_deck_small_motion
    include_start_action_buttons:
      - enable_start_action_button_1
      - enable_start_action_button_2
    start_action_button_1: Disable
    start_action_button_2: Enable
    start_time_delay:
      hours: 0
      minutes: 0
      seconds: 0
    include_start_action_button_confirmation: enable_start_action_button_confirmation
    start_action_button_confirmation_title: Action...
    start_action_button_confirmation_message: Small Deck Motion Notifications Disabled
    start_action_button_2_confirmation_message: Small Deck Motion Notifications Enabled
    global_conditions:
      - condition: state
        entity_id: input_boolean.bypass_deck_small_motion
        state: "off"
      - condition: state
        entity_id: timer.bypass_timer_small_deck_motion
        state: idle
    start_message: "{{ states[trigger.entity_id].attributes.friendly_name }}"
    start_title: Motion

@Ltek

Thanks for your YAML.

In Start Actions Buttons you just needed to enter in a Time Delay. I have enter in 1 hour and added a Action Button Cancel Confirmation Message and a Time Delay Confirmation Message.

What happened as soon as it was executed it preformed the actions canceling the action buttons.

alias: "Notify : Deck Small"
description: ""
use_blueprint:
  path: Blackshome/state-notifications-and-actions.yaml
  input:
    start_trigger_state: "on"
    start_trigger_state_entity:
      - binary_sensor.sensor_backyard_bosch_motion_deck_s_occupancy
    include_start_notify: enable_start_notify_options
    start_notify_device:
      - 4c405513584e73a3a8a3a9996bc35562
      - 3674d1323c5d602efb76a2e00225cbb3
    start_notify_data:
      - channel
      - sticky
    start_notify_channel: motion-backyard
    start_action_1:
      - action: input_boolean.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.bypass_deck_small_motion
    start_action_2:
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.bypass_deck_small_motion
    include_start_action_buttons:
      - enable_start_action_button_1
      - enable_start_action_button_2
    start_action_button_1: Disable
    start_action_button_2: Enable
    start_time_delay:
      hours: 1
      minutes: 0
      seconds: 0
    include_start_action_button_confirmation: enable_start_action_button_confirmation
    start_action_button_confirmation_title: Action...
    start_action_button_confirmation_message: Small Deck Motion Notifications Disabled
    start_action_button_2_confirmation_message: Small Deck Motion Notifications Enabled
    global_conditions:
      - condition: state
        entity_id: input_boolean.bypass_deck_small_motion
        state: "off"
      - condition: state
        entity_id: timer.bypass_timer_small_deck_motion
        state: idle
    start_message: "{{ states[trigger.entity_id].attributes.friendly_name }}"
    start_title: Motion
    start_action_button_stop_confirmation_message: Nothing was done!
    start_time_delay_confirmation_message: Too late, it has been automatically cancelled!

Blacky :grinning:

thank you, I’ll put that in.

1 Like

@Blacky is there a diff way to do this… ā€œDo not retrigger for N minutes?ā€

I have some Bosch motion sensors that reset in 30 seconds. I would prefer the automations (notifications) do not re-trigger for 3 minutes.

I tried using a timer but not sure its working. Am I’m missing a better way? If this is not built-in, that would be a fantastic next feature!

thx

@Ltek

The Time Delay functions as a delay ON, but you’re looking for a delay OFF instead.

Why?

You want the motion sensor to trigger instantly, but once triggered, it should stay active for at least 3 minutes after motion stops before detecting motion again.

Some motion sensors have this built-in, but if not, you can create a Template Binary Sensor with a delay_off and use that as the trigger.

It’s best to handle this at the trigger level, rather than within the blueprint.

You will need to add this code below to your configuration file.

I used your motion sensor binary_sensor.sensor_backyard_bosch_motion_deck_s_occupancy and I am assuming it is for your Small Deck but just change the Name and your Motion Sensor ID

template:
  - binary_sensor:
      - name: "Motion Sensor Small Deck"
        state: "{{ is_state('binary_sensor.sensor_backyard_bosch_motion_deck_s_occupancy', 'on') }}"
        delay_off: 
          minutes: 3

This is how you add more than one binary sensor to your configuration file. You only use the template: once with your sensor under it.

template:
  - binary_sensor:
      - name: "Motion Sensor Small Deck"
        state: "{{ is_state('binary_sensor.sensor_backyard_bosch_motion_deck_s_occupancy', 'on') }}"
        delay_off: 
          minutes: 3

  - binary_sensor:
      - name: "Motion Sensor Driveway"
        state: "{{ is_state('binary_sensor.philips_driveway_motion', 'on') }}"
        delay_off: 
          minutes: 3

Hope this helps you.

Blacky :grinning:

thx for the help. I’m trying to avoid making Sensor Templates for tons of stuff… seems like the ā€˜workaround’ for so much in HA is to do that but I’d need to create tons of them, and IMO is just not a great solution for most things.

Ultimately I need to have a ā€˜timed bypass’ which I feel is a better for many reasons, more visible, and more flexible solution (a timer can be changes on the fly, and used for multiple purposes). I’m going to try to get this working.

Hi Blacky,

First of all, a huge thank you for your incredible Blueprints! Ever since I started using them, the Woman Acceptance Factor in my home has increased significantly!

I have a question regarding notifications: The initial notification for an open window works perfectly. However, if I miss it, I often forget that the window is still open—which, as you can imagine, isn’t great for heating costs.

Would it be possible to configure your Blueprint (or one of your other fantastic creations) to send recurring reminders until the window is closed? If so, is this implemented using timers, and do they persist through a Home Assistant restart?

I really appreciate your work and look forward to your insights!

@xXkr13g3rXx

I very passionate about saving energy to reduce cost. Maybe I should just create a blueprint for windows and heating / cooling. I can see a use for it here but normally I just check if they are closed (old school way :laughing: ).

I add it to a list.

Blacky :grinning:

2 Likes

@Blacky a few feature requests (pretty please)

The below BP is not longer maintained but has 2 features that are killer…

  1. Repeating notifications (every N hrs, min, sec)

Reoccurring notifications are very helpful not just for saving energy. I use them extensively since sometimes a door or window will look closed and will not be closed ā€˜completely’. This not only wastes energy but it may cause a door lock or sensor to not work properly.

  1. auto-clear notification when end-state occurs.
  1. Notification Groups
    Groups would be really nice for a few reason… including logging. A Log shows all separate mobile notifications. When using your template with individual entities, the Log Book will display 3 lines for each single notification since your blueprint seems to actually send a separate notification trigger for each Entity. If using notify.notify or notify group, it would be only 1 log entry.

  2. Variable use in the Title of the notification.

I found a hack/workaround but I suspect this may be a bug?..

Message body must be ONLY a space character, then you can do something like this in the Title…

{{ states[trigger.entity_id].attributes.friendly_name }} {{ states[trigger.entity_id].last_updated.strftime(" : %m-%d-%y") }}

@Blacky update… this is the error we get in the log

Error while executing automation automation.notify_motion_deck_small: value should be a string for dictionary value @ data[ā€˜message’]

… but when using a space it works fine. Looks like Notify requires a Message be entered.

2 Likes

@Blacky I still cant get any Actions to work, I have 6 similar automations on this BP. Confirmations are sent, but the helper is never changed (on or off)

alias: "Notify Motion : Entry"
description: ""
use_blueprint:
  path: Blackshome/state-notifications-and-actions.yaml
  input:
    start_trigger_state: "on"
    start_trigger_state_entity:
      - binary_sensor.philips_entry_motion
    include_start_notify: enable_start_notify_options
    start_notify_device:
      - 4c405513584e73a3a8a3a9996bc35562
      - 3674d1323c5d602efb76a2e00225cbb3
    start_title: >-
      {{ states[trigger.entity_id].attributes.friendly_name }} - {{
      as_timestamp(states[trigger.entity_id].last_updated) |
      timestamp_custom("%I:%M:%S %p") }}
    start_notify_data:
      - channel
      - sticky
      - high_priority
    start_action_button_1: Disable
    include_start_auto_actions: []
    start_action_1:
      - action: input_boolean.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.bypass_entry_motion
    include_start_action_buttons:
      - enable_start_action_button_1
      - enable_start_action_button_2
    start_notify_channel: motion-entry
    start_action_2:
      - action: input_boolean.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.bypass_entry_motion
    start_action_button_2: Enable
    start_action_button_confirmation_title: Entry Motion
    start_action_button_confirmation_message: Notifications Disabled
    start_action_button_2_confirmation_message: Notifications Enabled
    start_time_delay:
      hours: 0
      minutes: 30
      seconds: 0
    start_message: " "
    global_conditions:
      - condition: state
        entity_id: input_boolean.bypass_entry_motion
        state: "off"
      - condition: state
        entity_id: timer.bypass_timer_entry_motion
        state: idle
    include_start_action_button_confirmation: enable_start_action_button_confirmation