I have the following code in my sensors.yaml file to derive a list of all entities where their state is below 25%, but its not showing the list of devices in attributes
Any help would greatly be appreciated
- platform: template
sensors:
low_battery_devices:
friendly_name: "Low Battery Devices"
icon_template: mdi:battery-alert
value_template: >
{% set threshold = 25 %}
{% set low = states.sensor
| selectattr('entity_id','search','battery')
| selectattr('state','is_number')
| selectattr('state','lt', threshold|string)
| list %}
{{ low | count }}
attribute_templates:
devices: >
{% set threshold = 25 %}
{% set low = states.sensor
| selectattr('entity_id','search','battery')
| selectattr('state','is_number')
| selectattr('state','lt', threshold|string)
| list %}
{{ low | map(attribute='name') | list }}