Simple and Effective Alerting

You might get more answers, if you would actually show, what is not working, ie. the code from the dashboard where the notification should show. :slight_smile: You showed only the things that work. :slight_smile:

Sorry, I missed this reply.

I don’t know what code to do in the dashboard to show alerts. I have none. I don’t think I saw it in the instructions.

There isn’t anything that automatically shows those alerts on the dashboards, you have to manually build your lovelace dashboards using yaml and custom cards to get this effect. See link to instructions above.

I explain,

Putting it all together, this regular expression pattern matches entity IDs that:

  • Start with “alert.”
  • Have any characters (or none) after “alert.”
  • End with “_warn_alert_active.”

So, it will match entity IDs like “alert_something_warn_alert_active,” “alert_warn_alert_active,” “alert_x_warn_alert_active,” and so on, as long as they follow this pattern. It’s a way to dynamically match multiple entities with similar names that follow a certain naming convention.

look this example in the post:

alert:
  garage_door_info_alert_active:
    name: Garage Door Alert Active
    entity_id: binary_sensor.garage_door_alert_active
    state: "on"
    repeat:
      - 180
    can_acknowledge: true
    skip_first: true
    title: "7580 Info - Garage Door Open"
    message: >
      Garage Door open for {{ relative_time(states.binary_sensor.garage_door_alert_active.last_changed) }} \  
      Alerts on: {{ expand('group.garage_doors') | selectattr('state', 'eq', 'on') | map(attribute='attributes.friendly_name') | list | join(', ') }} \ 
      Triggered: {{ as_timestamp(states.binary_sensor.garage_door_alert_active.last_changed) | timestamp_custom('%A %I:%M%p (%d-%b-%Y)') }}
    done_message: "Garage Door Alert RESOLVED at {{ as_timestamp(states.binary_sensor.garage_door_alert_active.last_changed) | timestamp_custom('%A %I:%M%p (%d-%b-%Y)') }}"
    notifiers:
      - STD_Information

Try something like this :slight_smile:

alert:
  cold_plunge_low_flow_info_alert_active:
    name: Cold plunge low flow Alert Active
    entity_id: binary_sensor.cold_plunge_low_flow_info_alert_active   #YOUR BINARY or NORMAL SENSOR  that shows ON/OFF state for TRIGGER this ALERT
    state: "on"
    repeat:
      - 600
    can_acknowledge: true
    skip_first: true
    title: "7580 Info - Garage Door Open"
    message: 
      Cold plunge flow is low. Cold plunge chiller disabled. Change filter if needed, check valves open, and restart cold plunge chiller.
    notifiers:
      - STD_Information  #Your notifier as in notify.YOURID
2 Likes
    title: "7580 Info - Garage Door Open"
    message: >
      Garage Door open for {{ relative_time(states.binary_sensor.garage_door_alert_active.last_changed) }} \  
      Alerts on: {{ expand('group.garage_doors') | selectattr('state', 'eq', 'on') | map(attribute='attributes.friendly_name') | list | join(', ') }} \ 
      Triggered: {{ as_timestamp(states.binary_sensor.garage_door_alert_active.last_changed) | timestamp_custom('%A %I:%M%p (%d-%b-%Y)') }}
    done_message: "Garage Door Alert RESOLVED at {{ as_timestamp(states.binary_sensor.garage_door_alert_active.last_changed) | timestamp_custom('%A %I:%M%p (%d-%b-%Y)') }}"

only title title: title: “7580 Info - Garage Door Open”`works

Very nice and really usefull, thank you !!

I’m just wonder one thing.
Once the notification is displayed, we can acknoledge it using the input_boolean.
But then, you have to “rearm” the input_boolean for the next alert of the same category.
The best moment to do it is probably when the new alert is triggered.
One approach would be to create an automation that reset any notification input_boolean when an alert with the same name is triggered (using a regexp).

Your code look really clean so I guess you found a very nice way to do it.
Can you please share it ?
Thanks :slight_smile:

The input_boolean I added was as an additional condition the binary_sensor is monitoring the effectively allows me to enable or disable the alert.

That is different than the state of the alert. Take a closer look at the alert entity and you’ll see there are 3 states:
Idle - alert is not active
on - alert is active
off - alert is active, but acknowledged

So when you “acknowledge” an alert, you are doing that to the alert entity, not the input Boolean. Once the conditions that triggered the alert have gone away, the alert automatically goes back to idle, so no automation required.

I knew there was a good reason why you didn’t share a dedicated automation :slight_smile:
Thank you that’s very clear!
And it makes ‘alert’ even more interesting! (sorry I never used it before).

This amazing work — very elegantly done.

This is near perfect for me, and would even improve a few things.

The one thing I do that’s different though, is that I display a countdown timer (normal HA timer) as an indicator of urgency.

1 Like

Pics? :laughing: Seriously, I’m very interested in seeing how others do that. :wink:

For now I’m working with “mushroom-cards” just to show if there’s an active alert, but I’d love to see the messages, that get send with the alert. Still trying… :laughing:

Ah, I’m happy to share.

I built this using the custom button card years ago (so before the mushroom cards existed).

Here my gate has just been opened and the garage has been open for the maximum time. A yellow garage icon means it’s occupied (i.e. there’s a car parked inside). Red means it needs attention (i.e. open for too long).

These are my notifications. The time accumulates until it’s closed.

PS: Home Assistant saved me from disaster last night.

3 Likes

After the update to 2024.7, the custom:auto-entity card, when there are no elements and it should be hidden, leaves an empty space, here is an example of 3 cards (empty) in a vertical stack, is there any way to fix this?

image