Is there any card or something similar that can give you a log of all Automations that ran in the last let’s say 24h ? I would love to display it in Alert Ticker card, but I have way to many automations to specify them one by one, so I would need an entity filter.
Why not just go to Settings → Automations & Scenes and sort the list by last triggered?
you can put this in a markdown card:
- type: markdown
title: Automations Triggered
content: |
|Time||Name|
|----:|:--:|:----|
{% for state in states.automation
| selectattr('attributes.last_triggered', 'defined')
| selectattr('attributes.last_triggered')
| rejectattr('entity_id', 'in', 'automation.update_battery_status_group_members')
| rejectattr('state', 'eq', 'unavailable')
|sort(attribute='attributes.last_triggered', reverse=true) -%}
{% if (now() - state.attributes.last_triggered).total_seconds() < 86400 %}
{%- set t1 = state.attributes.last_triggered.timestamp() | timestamp_custom('%H:%M') -%}
{%- set t = now() - state.attributes.last_triggered -%}
{%- set days = t.days if t.days > 0 else ' ' -%}
{%- set hrs = t.seconds//3600 %}
{%- set hrs = hrs if hrs > 0 else ' ' -%}
|{{t1}}||_{{state.name}}_|
{% endif -%}
{% endfor %}
it will show all automations triggered in the last 24 hours in a reverse time ordered list (most recent first)
dont forget auto-entities and use a filter
filter:
include:
- domain: automation
state: 'on'
last_triggered: '<= 5'
adjust the number ![]()
24 hours is a lot of automations..
tbh, I had a lot of these with several specifics. but, since the automation dashboard in HA matured, I did away with all of them.
and did as Tom says
btw finite’s template shows 2 funny things in my setup
forgot to set a name for 1 automation

and have a time conversion error in another…

haha thx
edit
time was not an issue, it’s repeated for certain cases…
- id: turn_off_morning_switches_at_11
triggers:
trigger: time
at:
- '11:00'
- '11:30'
- '12:00'
could rename it then, o well
type: custom:flex-table-card
title: automatizace
max_rows: 10 #Without that, it shows all automations.
sort_unmodified: true
entities:
include: automation.*
sort_by: last_triggered-
columns:
- name: Automatizace
data: name
- name: poslední spuštění
data: last_triggered
sort_unmodified: true
modify: |-
if (x) {
if(x.length == 0){
"-"
}
else {
var date = new Date(x);
(String(date.getDate()).padStart(2,'0')) +
"/" +
(String(date.getMonth()+ 1).padStart(2,'0')) +
"/" +
date.getFullYear() +
" " +
String(date.getHours()).padStart(2,'0') +
":" +
String(date.getMinutes()).padStart(2,'0') +
":" +
String(date.getSeconds()).padStart(2,'0')
}
} else {
"-"
}
Are you sure you need that string manipulation for the time? Rather than using a time function?
I’ve been using this card for a while and it works, so I had no reason to change anything. Since the card is one of the examples shown here, it would be better to direct the question there.
Nah, it’s up to you, I don’t use the card.
It’s just that that template seems so very verbosely manipulating strings instead of using the available time functions.
