home-assistant.io icon indicating copy to clipboard operation
home-assistant.io copied to clipboard

Alert for a group of entities

Open Quanticles opened this issue 1 year ago • 1 comments

Feedback

What if I have two garage doors? Do I need to copy/paste the entire alert or can I share the same alert definition? In my real-life case, we have ~10 flood sensors

URL

https://www.home-assistant.io/integrations/alert/

Version

2024.2.2

Additional information

No response

Quanticles avatar Feb 18 '24 17:02 Quanticles

Hey there @home-assistant/core, @frenck, mind taking a look at this feedback as it has been labeled with an integration (alert) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of alert can trigger bot actions by commenting:

  • @home-assistant close Closes the feedback.
  • @home-assistant rename Awesome new title Renames the feedback.
  • @home-assistant reopen Reopen the feedback.
  • @home-assistant unassign alert Removes the current integration label and assignees on the feedback, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information) to the feedback.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information) on the feedback.

home-assistant[bot] avatar Feb 18 '24 17:02 home-assistant[bot]

HI, just found this issue via google. I do have a group entity that contains all openwindow sensors and I have my alert configured on that group. That group entity is on when one window is open and I get my alert after 15 mins (to close it ;) )

alert:
  fenster_offen_alarm:
    name: Fenster offen
    message: >-
      {% for entity_id in states.binary_sensor.fenster_offen.attributes.entity_id %}{% if states[entity_id].state == 'on' and (as_timestamp(now()) - as_timestamp(states[entity_id].last_changed)) >= 900 and (as_timestamp(now()) - as_timestamp(states[entity_id].last_changed)) >= 3600 %}{{ states[entity_id].name }} ist seit {{ ((as_timestamp(utcnow()) - as_timestamp(states[entity_id].last_changed)) | int) | timestamp_custom('%Hh %Mm', false) }} offen.{{"\r\n"}}{% endif %}{% if states[entity_id].state == 'on' and (as_timestamp(now()) - as_timestamp(states[entity_id].last_changed)) >= 900 and (as_timestamp(now()) - as_timestamp(states[entity_id].last_changed)) < 3600 %}{{ states[entity_id].name }} ist seit {{ ((as_timestamp(utcnow()) - as_timestamp(states[entity_id].last_changed)) | int) | timestamp_custom('%Mm', false) }} offen.{{"\r\n"}}{% endif %}{% endfor %}
    done_message: Alle Fenster sind wieder geschlossen.
    entity_id: group.fenster_offen
    state: "on"
    repeat: 15
    can_acknowledge: true
    skip_first: true
    notifiers:
      - webex_marvin

Problem: the notification is a little tricky since you would probably not want a generic "there's water somewhere" but rather an indication which sensor triggerd the alarm. This is why I've pasted my message template code here.

MichaelHeimann avatar Mar 29 '24 18:03 MichaelHeimann