Alerts - multiple entities

Is there a way to use multiple entities and customize the message with alerts?

e.g. instead of having one of these for each Chromecast, have one which does them all:

bedroom_chromecast_left_streaming:
    name: 'Bedroom Chromecast has been left streaming.'
    entity_id: media_player.bedroom_tv
    state: 'playing'
    repeat: 60
    skip_first: true
    can_acknowledge: True
    data:
      inline_keyboard:
        - 'Stop Stream:/StopBedroomStream'
    notifiers: 
      - telegram_HomeMonitor
1 Like

No, each Alert can only watch one entity according to the docs.

Was kinda hopefull there was a work around - thanks for confirming.

What a weird limitation. You have to create a separate alert for every door and window in your house, for example?

Well you can put the entities in a group and run the alert off that. You lose the ability to determine which member of the group started the alert though.

Hi @xrapidx, I just came across this topic.
Not sure if you’ve resolved this by now but I did this by combining my doors into a group and setting up some shamelessly copied and amended code for the actual notification:

alert:
  door_open_for_long:
    name: A door is still open!
    entity_id: group.alarm_doors
    state: 'on'   # Optional, 'on' is the default value
    message: >-
      {%- if is_state("group.alarm_all", "off") %}
        All doors and windows are CLOSED!
      {% else %}
        Open are: {%- set entities = [states.binary_sensor.konnected_41, states.binary_sensor.konnected_44, states.binary_sensor.konnected_25, states.binary_sensor.konnected_24, states.binary_sensor.konnected_32 ] -%}
        {%- for entity in entities -%}
          {%- if entity.state == 'on' %}
        - {{ entity.name }}
          {%- endif %}
        {%- endfor -%}
      {%- endif %}
    repeat: 5
    can_acknowledge: true  # Optional, default is true
    skip_first: true  # Optional, false is the default
    notifiers:
      - mobile_app
2 Likes

good workaround but a fairly strange limitation of the alert implementation. is there an enahcement/feature request or new information to use multiple entities for the alert implementation?

You can search here:

2 Likes

thanks found one here: Alert support for multiple entities (entity_id list support)?

One Questions:
Is it possible to use trigger to determine which entity triggered to ON?
eg.: “trigger.to_state.attributes.entity_id” ?

Yes if you are using an automation, but this topic is about alerts.

thx. so @chairstacker this is the onyl workaround?

It’s the only one I’ve found so far and it works reliably form me so I stopped looking for other options and keep re-using it for other alerts as well.

1 Like