You have at least one automation whose state is unavailable
. This kind of automation doesn’t have a current
attribute and causes the template to fail.
This version selects automations that have a current
attribute before checking if its value is greater than zero.
{{ states.automation
| selectattr('attributes.current', 'defined')
| selectattr('attributes.current', '>', 0)
| map(attribute='name') | join('\n') }}