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:
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. You showed only the things that work.
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
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
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
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
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.
Pics? Seriously, I’m very interested in seeing how others do that.
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…
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.
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?
This discussion started with “I avoided notification and alerting for a long time because I couldn’t find a well thought out approach that was simple, robust, and repeatable.”. Exactly my thoughts. Approach in this post seems like a well thought of system, which I might adopt to myself.
Unless…
During my 1 1/2 year experience with HA, one major change has been the development of UI for automations. Nowadays I can “write” quite decent automations in UI with only elementary YAML writing skills.
I have been trying to find if someone had already written a Universal Notification handler for HA. Have not find any thus far. As of now, notifications are not so easy to maintain.
Notification handler? My dream come true would be an approach where i could add a notification in an automation an easy way like
[pseudocode] if flue gas temperature < 200 for 2 minutes, notify “Add firewood to stove” [/pseudocode]
Then there would be a notification handler, where a new row would apper as
[stove monitor] [Add firewood to stove] Send to: [My phone] [wifes phone] [blink lights] Category: [Info/Warning/Critical] [enabled/disabled] [notify only people at home]
etc.; all of the options in Chad’s original post, just centralized.
What I would like to do is to remove notification handling from tens of automations to a centralized place, which would allow configuring options for each alert. Preferably with a GUI
Auto entities card is new to me. Could this be a way to pick all notifications from all of my automations? But then, there is also the need to be able to set and store parameters for each of them in some kind of data file. And send the notification per set parameters.
Any ideas would be appreciated. Anything new during the years? Would be nice to have the skills to contribute, but so far any solutions to this have been out of my skillset.
After the last HA update, the notification background disappeared, maybe there is an update? A solution to this problem?
Jan 2025 Update
I took some time over the last few days to convert the majority of my dashboards to the use of sections and use the UI instead of the yaml files. It was pretty straightforward once I figured out how to paste in yaml to the UI from my existing config and make the minor format changes required.
One of the issues that has cropped up over the past 6 months is the auto-entities cards are not fully hiding the way they should. This means there is additional lines of space at the top of your dashboard which is especially noticeable when you 8 of the cards stacked together the way I do. See issue - show_empty in Sections view · Issue #433 · thomasloven/lovelace-auto-entities
I don’t believe the original author of the auto-entities is active recently, so I decided the easiest thing to do was wrap them in conditional cards which, while not ideal, is working great. The only caveat is that you need to create binary template sensors with the same filter to control the conditional cards. Since many have copied my earlier configuration, I thought I’d update this post to include the new dashboard updates.
Additionally, I made a few style changes to the cards so they work better with themes. For instance, the informational type boxes now used the same background and font colors as the top view bar rather than blue.
Updates required to use conditional cards
New sensors required for conditional cards. These give you a count of each alert type. Note that I listed all of mine, but you only need to use those that apply to your build.
- template:
- sensor:
## Note that all these count sensors are a workaround for extra space left between the custom:auto-entities cards when they are empty. Putting the dashboard alerting in conditional cards.
- name: "Active Crit Alerts Count"
state: >
{% set alerts = states.alert | selectattr('entity_id', 'match', '^alert.*_crit_alert_active$') | list %}
{{ alerts | rejectattr('state', 'in', ['off', 'idle']) | list | length }}
attributes:
active_alerts: >
{% set alerts = states.alert | selectattr('entity_id', 'match', '^alert.*_crit_alert_active$') | list %}
{{ alerts | rejectattr('state', 'in', ['off', 'idle']) | map(attribute='entity_id') | list }}
- name: "Active Warn Alerts Count"
state: >
{% set alerts = states.alert | selectattr('entity_id', 'match', '^alert.*_warn_alert_active$') | list %}
{{ alerts | rejectattr('state', 'in', ['off', 'idle']) | list | length }}
attributes:
active_alerts: >
{% set alerts = states.alert | selectattr('entity_id', 'match', '^alert.*_crit_warn_active$') | list %}
{{ alerts | rejectattr('state', 'in', ['off', 'idle']) | map(attribute='entity_id') | list }}
- name: "Active Info Alerts Count"
state: >
{% set alerts = states.alert | selectattr('entity_id', 'match', '^alert.*_info_alert_active$') | list %}
{{ alerts | rejectattr('state', 'in', ['off', 'idle']) | list | length }}
attributes:
active_alerts: >
{% set alerts = states.alert | selectattr('entity_id', 'match', '^alert.*_info_warn_active$') | list %}
{{ alerts | rejectattr('state', 'in', ['off', 'idle']) | map(attribute='entity_id') | list }}
- name: "Acknowledged Alerts Count"
unique_id: acknowledged_alerts_count
state: >
{% set alerts = states.alert | list %}
{{ alerts | rejectattr('state', 'in', ['on', 'idle']) | list | length }}
attributes:
acknowledged_alerts: >
{% set alerts = states.alert | list %}
{{ alerts | rejectattr('state', 'in', ['on', 'idle']) | map(attribute='entity_id') | list }}
- name: "Water Issues Count"
state: >
{% set sensors = states | selectattr('attributes.device_class', 'eq', 'moisture') | list %}
{{ sensors | rejectattr('state', 'in', ['off', 'unavailable', 'unknown']) | rejectattr('entity_id', 'search', 'weather') | list | length }}
attributes:
water_issues: >
{% set sensors = states | selectattr('attributes.device_class', 'eq', 'moisture') | list %}
{{ sensors | rejectattr('state', 'in', ['off', 'unavailable', 'unknown']) | rejectattr('entity_id', 'search', 'weather') | map(attribute='entity_id') | list }}
- name: "Tech Issues Count"
state: >
{% set devices = expand('group.network_devices', 'group.server_devices', 'group.wan_devices') %}
{{ devices | rejectattr('state', 'in', ['on', 'unavailable']) | list | length }}
attributes:
tech_issues: >
{% set devices = expand('group.network_devices', 'group.server_devices', 'group.wan_devices') %}
{{ devices | rejectattr('state', 'in', ['on', 'unavailable']) | map(attribute='entity_id') | list }}
- name: "Information Count"
state: >
{% set entities = expand('group.device_uptimes') | selectattr('state', 'match', '[0-9] minutes') | list %}
{{ entities | length }}
attributes:
matching_entities: >
{% set entities = expand('group.device_uptimes') | selectattr('state', 'match', '[0-9] minutes') | map(attribute='entity_id') | list %}
{{ entities }}
I also created a manual toggle switch to hide my “Possible issues” card which is a very useful card to quickly spot issues that come up, but sometimes I know what the issue is and don’t want to look at the warning once I know I need to get it fixed.
input_boolean:
show_possible_issues:
name: Show Possible Issues
initial: false
The config I’m providing below is to create a full new section view if you use all of it. The easiest way to do that is by creating a new section view, then edit in yaml as you see in the screenshot. Delete the few lines in the new view, then paste the full text of the config.
title: Home
sections:
- type: grid
cards:
- type: conditional
conditions:
- condition: numeric_state
entity: sensor.active_crit_alerts_count
above: 0
card:
type: custom:auto-entities
show_empty: true
card:
type: entities
title: Active Critical Alerts
card_mod:
style: |
ha-card {
background-color: red;
--primary-text-color: white;
--secondary-text-color: white;
--paper-item-icon-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: conditional
conditions:
- condition: numeric_state
entity: sensor.active_warn_alerts_count
above: 0
card:
type: custom:auto-entities
show_empty: true
card:
type: entities
title: Active Warning Alerts
card_mod:
style: |
ha-card {
background-color: orange;
--primary-text-color: white;
--secondary-text-color: white;
--paper-item-icon-color: white;
}
filter:
include:
- entity_id: /^alert(.).*_warn_alert_active/
options:
secondary_info: last-changed
exclude:
- state: "off"
- state: idle
sort:
method: last_changed
reverse: true
- type: conditional
conditions:
- condition: numeric_state
entity: sensor.active_info_alerts_count
above: 0
card:
type: custom:auto-entities
show_empty: true
card:
type: entities
title: Active Information Alerts
card_mod:
style: |
ha-card {
background-color: var(--app-header-background-color);
--primary-text-color: var(--app-header-text-color);
--secondary-text-color: var(--app-header-text-color);
--paper-item-icon-color: var(--app-header-text-color);
}
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: conditional
conditions:
- condition: numeric_state
entity: sensor.acknowledged_alerts_count
above: 0
card:
type: custom:auto-entities
show_empty: true
card:
type: entities
title: Acknowledged Alerts
card_mod:
style: |
ha-card {
background-color: var(--app-header-background-color);
--primary-text-color: var(--app-header-text-color);
--secondary-text-color: var(--app-header-text-color);
--paper-item-icon-color: var(--app-header-text-color);
}
filter:
include:
- domain: alert
options:
secondary_info: last-changed
exclude:
- state: "on"
- state: idle
sort:
method: last_changed
reverse: true
- type: conditional
conditions:
- condition: numeric_state
entity: sensor.water_issues_count
above: 0
card:
type: custom:auto-entities
show_empty: true
card:
type: entities
title: Water Issues
card_mod:
style: |
ha-card {
background-color: red;
--primary-text-color: white;
--secondary-text-color: white;
--paper-item-icon-color: white;
}
filter:
include:
- attributes:
device_class: moisture
options:
secondary_info: last-changed
exclude:
- state: "off"
- state: unavailable
- state: unknown
- entity_id: "*weather*"
- type: conditional
conditions:
- condition: numeric_state
entity: sensor.tech_issues_count
above: 0
card:
type: custom:auto-entities
show_empty: true
card:
type: entities
title: Tech Issues
card_mod:
style: |
ha-card {
background-color: orange;
--primary-text-color: white;
--secondary-text-color: white;
--paper-item-icon-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: conditional
conditions:
- condition: numeric_state
entity: sensor.information_count
above: 0
card:
type: custom:auto-entities
show_empty: true
card:
type: entities
title: Information
card_mod:
style: |
ha-card {
background-color: var(--app-header-background-color);
--primary-text-color: var(--app-header-text-color);
--secondary-text-color: var(--app-header-text-color);
--paper-item-icon-color: var(--app-header-text-color);
}
filter:
template: |
{{
expand('group.device_uptimes')
| selectattr('state', 'match', '[0-9] '[0-9] [Mm]inutes')
| map(attribute='entity_id')
| list
}}
- type: conditional
conditions:
- condition: state
entity: input_boolean.show_possible_issues
state: "on"
card:
type: custom:auto-entities
show_empty: false
card:
type: entities
title: Possible Issues
show_header_toggle: false
card_mod:
style: |
ha-card {
background-color: var(--app-header-background-color);
--primary-text-color: var(--app-header-text-color);
--secondary-text-color: var(--app-header-text-color);
--paper-item-icon-color: var(--app-header-text-color);
}
filter:
include:
- state: unknown
- state: unavailable
exclude:
- entity_id: device_tracker.*
- entity_id: person.*
- entity_id: group.*
- entity_id: scene.*
- entity_id: update.*
- entity_id: event.*
- entity_id: sensor.stokerbbq*
- entity_id: sensor.auto_backup_last_failure
- entity_id: sensor.*_last_ding
- entity_id: switch.wall*_dimmer*
- entity_id: button.*
- entity_id: sensor.weatherflow_wind_*
- entity_id: sensor.weatherflow_feels_*
- entity_id: number.*_effect_speed
- entity_id: binary_sensor.updater
- integration: twinkly
- entity_id: vacuum.vacuum_fairy
- entity_id: "*alarm*"
- entity_id: "*timer*"
- entity_id: "*reminder*"
- entity_id: "*shuffle*"
- entity_id: "*repeat*"
- entity_id: "*do_not_disturb*"
- entity_id: media_player.*
- entity_id: select.gaming*
- entity_id: "*t*.home_assistant*"
- entity_id: sensor.*last_seen
- entity_id: sensor.*spotify*
- entity_id: sensor.meater*
- entity_id: "*.speedtest_wan_two_*"
- integration: mqtt
Obviously, your configuration will be different than mine, so you can also just pick and choose the individual cards and sensors you need from the config above and paste them in directly, as necessary.
FYI - @andrewjswan
Also @vesar, I don’t know of any universal notification handler like you mention, however I did recently start using the State Notifications & Actions - Blueprints Exchange - Home Assistant Community which meets the majority of my needs, and they are pretty easy to maintain. Combine that with some of the new categorization and labels, and it can even be organized pretty well.