Possible to create one automation with many door open notifications?

Kind of new here but have a decent understanding of the very basics. I was able to create a notification automation for each door and window. So 20 separate automations in all. I imagine there has to be a way to get all similar door and window open notifications in one automation. I couldn’t find a blueprint or example of this being done. Could someone please point me in the right direction to get this done? Links or examples? Thanks in advance.

I did it this way

#=======================================================================
# notify stephan phone Door Change
#=======================================================================
- id: 'notify stephan phone Door Change'
  alias: "notify Stephan phone Door Change"
  initial_state: true
  trigger:
  - entity_id: 
    - binary_sensor.garage_side_door
    - binary_sensor.garage_door
    - binary_sensor.front_door
    - binary_sensor.cupboard_door
    - binary_sensor.linen_door
    - binary_sensor.washing_door
    - binary_sensor.dryer_door
    platform: state
  action:
  - data_template:
      title: "Home Assistant"
      message: "{{ trigger.to_state.attributes.friendly_name }} was {% if trigger.to_state.state == 'on' %} Open {% else %} Closed {% endif %}"
    service: notify.stephan_phone
1 Like

This looks great! Just what I need. I don’t understand what is happening on the message line. Where can I find information to learn what is happening with that code and how to decipher?!

{{ trigger.to_state.attributes.friendly_name }} this just put the friendly Name into the message


and the
Binary_sensor only have a ON or OFF

so we
{% if trigger.to_state.state == ‘on’ %}
Open
{% else %}
Closed
{% endif %}

now the message says
Garage Door was Open

1 Like

That’s brilliant mate! Thanks very much for the reply.

All good bro

Beinh new with HA as well. And open Doss/windows is my next tasks after saving my plants :slight_smile:

Did i get it right the we get a notification each time an window/door is opend or closed? It is possible to create a timer so that i get the notification 15 minutes after the window is opend. I am sure i saw something in the community, but did not find it again.

alert integration ?

1 Like
1 Like