Simple and Effective Alerting

Hi,
I’m trying to integrate your custom card, but i have this error
No card type found

What do I do wrong ?

Any help here please ? :frowning:

Did you add the card-mod and auto-entities custom components via HACS? I’d probably verify that first, but if you did those, then start with just one small section of the alerts at a time. (i.e. Just the “Active Information” section to see if it renders correctly. ) Good luck

Yes, I added both via HACS.
I tried of course to integate small parts of your code.

One thing I realized about my configuration, is that I use a main lovelace dashboard file in the configuration directory, then all of my sub pages, like this overview page, are files in the config\lovelace directory. These sub pages are called by includes in the main file…

What I said above might have been confusing, but in short, if you are building the dashboard all in one page, you may need to format it as dashboard by starting with “views:” then bump everything below that over. See snip of code below and note the changes.

views:
  - title: ''
    icon: mdi:home
    cards:
      - type: vertical-stack
        cards:
          - type: custom:auto-entities
            show_empty: false
            card:
              type: entities
              title: Active Critical Alerts
              card_mod:

If that isn’t it, then it would be good for you to post the full code of the page giving you issues so we can look more closely for errors in the actual yaml.

I’m having trouble getting the alerts on the cards. I see just the “Possible issues”, but if a trigger raises an alert, nothing happens. I’m getting the alert on the mobile app (as a standard alert in the phone’s notification area - as specified in the notify group. Any thoughts?

Notify:

notify:
  - name: STD_Information
    platform: group
    services:
      - service: mobile_app_***
  - name: STD_Warning
    platform: group
    services:
      - service: mobile_app_***
  - name: STD_Critical
    platform: group
    services:
      - service: mobile_app_***

Alerts:

alert_test:
  name: Test Alert
  done_message: Test alert done
  entity_id: binary_sensor.0x00124b002a4e9c8f_occupancy
  state: 'on'
  repeat: 5
  can_acknowledge: true
  skip_first: false
  notifiers:
    - STD_Warning

Dashboard (empty):

views:
  - title: ''
    icon: mdi:home
    cards:
      - type: vertical-stack
        cards:
          - type: custom:auto-entities
            show_empty: false
            card:
              type: entities
              title: Active Critical Alerts
              card_mod:
                style: |
                  ha-card {
                    background-color: rgba(251,13,13,1);
                    border-radius: 5px;
                    --primary-color: white;
                    --paper-item-icon-color: white;
                    --secondary-text-color: white;
                  }
            filter:
              include:
                - entity_id: /^alert(.).*_crit_alert_active/
                  options:
                    secondary_info: last-changed
              exclude:
                - state: 'off'
                - state: idle
            sort:
              method: last_changed
              reverse: true
          - type: custom:auto-entities
            show_empty: false
            card:
              type: entities
              title: Active Warnings
              card_mod:
                style: |
                  ha-card {
                    background-color: rgba(204,102,0,1);
                    border-radius: 5px;
                    --primary-color: white;
                    --paper-item-icon-color: white;
                    --secondary-text-color: white;
                  }
            filter:
              include:
                - entity_id: /^alert(.).*_warn_alert_active/
                  options:
                    secondary_info: last-changed
              exclude:
                - state: 'off'
                - state: idle
                - state: unavailable
            sort:
              method: last_changed
              reverse: true
          - type: custom:auto-entities
            show_empty: false
            card:
              type: entities
              title: Active Information
              card_mod:
                style: |
                  ha-card {
                    background-color: rgba(68,115,158,1);
                    border-radius: 5px;
                    --primary-color: white;
                    --paper-item-icon-color: white;
                    --secondary-text-color: white;
                  }
            filter:
              include:
                - entity_id: /^alert(.).*_info_alert_active/
                  options:
                    secondary_info: last-changed
              exclude:
                - state: 'off'
                - state: idle
            sort:
              method: last_changed
              reverse: true
          - type: custom:auto-entities
            show_empty: false
            card:
              type: entities
              title: Acknowledged Alerts
              card_mod:
                style: |
                  ha-card {
                    background-color: rgba(68,115,158,1);
                    border-radius: 5px;
                    --primary-color: white;
                    --paper-item-icon-color: white;
                    --secondary-text-color: white;
                  }
            filter:
              include:
                - domain: alert
                  options:
                    secondary_info: last-changed
              exclude:
                - state: 'on'
                - state: idle
            sort:
              method: last_changed
              reverse: true
          - type: custom:auto-entities
            show_empty: false
            card:
              type: entities
              title: Water Issues
              card_mod:
                style: |
                  ha-card {
                    background-color: rgba(251,13,13,1);
                    border-radius: 5px;
                    --primary-color: white;
                    --paper-item-icon-color: white;
                    --secondary-text-color: white;
                  }
            filter:
              include:
                - attributes:
                    device_class: moisture
                  options:
                    secondary_info: last-changed
              exclude:
                - state: 'off'
                - state: unavailable
          - type: custom:auto-entities
            show_empty: false
            card:
              type: entities
              title: Tech Issues
              card_mod:
                style: |
                  ha-card {
                    background-color: rgba(204,102,0,1);
                    border-radius: 5px;
                    --primary-color: white;
                    --paper-item-icon-color: white;
                    --secondary-text-color: white;
                  }
            filter:
              include:
                - group: group.network_devices
                  options:
                    secondary_info: last-changed
                - group: group.server_devices
                  options:
                    secondary_info: last-changed
                - group: group.wan_devices
                  options:
                    secondary_info: last-changed
              exclude:
                - state: 'on'
                - state: unavailable
          - type: custom:auto-entities
            show_empty: false
            card:
              type: entities
              title: Information
              card_mod:
                style: |
                  ha-card {
                    background-color: rgba(68,115,158,1);
                    border-radius: 5px;
                    --primary-color: white;
                    --paper-item-icon-color: white;
                    --secondary-text-color: white;
                  }
            filter:
              template: >
                {{ expand('group.device_uptimes') | selectattr('state', 'match',
                '[0-9] minutes') | map(attribute='entity_id') | list | join(',
                ') }}
          - type: custom:auto-entities
            show_empty: false
            card:
              type: entities
              title: Possible Issues
              card_mod:
                style: |
                  ha-card {
                    background-color: rgba(68,115,158,1);
                    border-radius: 5px;
                    --primary-color: white;
                    --paper-item-icon-color: white;
                    --secondary-text-color: white;
                  }
              show_header_toggle: false
            filter:
              include:
                - state: unknown
                - state: unavailable
              exclude:
                - entity_id: device_tracker.*
                - entity_id: person.*
                - entity_id: group.*
                - entity_id: scene.*
                - entity_id: sensor.stokerbbq*
                - entity_id: sensor.*_last_ding
                - entity_id: switch.wall*_dimmer*
                - entity_id: button.*
                - entity_id: sensor.weatherflow_wind_*
                - entity_id: sensor.weatherflow_feels_*

Hello, I’m having an issue showing a notification on all my dashboards (I would like to show on all devices). I’ve restarted HA after all config changes.

Here is the alert (which I can see firing properly in entities):

cold_plunge_low_flow:
  name: Cold plunge flow is low
  entity_id: input_boolean.cold_plunge_flow_low
  state: "on"
  repeat: 600
  can_acknowledge: true 
  message: Cold plunge flow is low. Cold plunge chiller disabled. Change filter if needed, check valves open, and restart cold plunge chiller.
  notifiers:
    - STD_Warning

Here is the alert being fired:
image

And here is my notifications.yaml:

- platform: group 
  name: STD_Warning
  services:
    - service: html5

and here is my configuration.yaml:

notify: !include notifications.yaml

What am I missing here?

Just bumping up for the question above. Sorry, and thanks!

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