I would like to use this card with template with the custom button-card. but really donāt know how to do it (i saw several examples about it in this thread, but without success).
Can somebody helps me?
type: custom:auto-entities
show_empty: false
card:
type: entities
filter:
template: |-
{{ states.light | selectattr('state', 'eq', 'on') |
map(attribute='entity_id') | list
}}
else:
type: markdown
content: all lights off
I would like to have a list of unavailable entities with a heading. Then hide the whole card, including heading, when empty. I canāt seem to get it quite right.
This shows and hides the heading correctly (tested with filters I know are empty), but for some reason no entities appear when there should be results:
Thanks for the speedy reply.
I still have the heading when the filter is empty. Is there anyway to hide the heading card when my filter returns no results?
What do I need to add to make the card show entities from the group that ālast changedā within the last 3 minutes? ⦠and show the last change time?
type: custom:auto-entities
card:
type: entities
title: All Indoor Motion Sensors
filter:
template: >
{{ expand('binary_sensor.motion_all_inside')| map(attribute='entity_id')|
list }}
I mostly follow, I think⦠Using your example I changed Entity to ābinary_sensor.motion_all_insideā and adding a line to pull in āstate.last_changedā attribute.
but it doesnt work⦠is this pulling all entities out of the Group? (like Expand does?)
When I put in the code in the card it says it saves but it doesnt - its empty. Asks me for a new selection when I edit it again.
I tried your exact template, just changed the Entity to the group entity Iām usingā¦
type: custom:auto-entities
show_empty: false
card:
type: entities
filter:
template: >-
{% set ns = namespace(entity_and_area=[]) -%}
{%- for entity in binary_sensor.motion_all_inside -%}
{%- set entity_id = entity.entity_id -%}
{%- set area = area_name(entity.entity_id) -%}
{%- set entity_and_area = ({'entity_id':entity_id,'area':area}) -%}
{%- set ns.entity_and_area = ns.entity_and_area + [entity_and_area] -%}
{%- set last_changed = state.last_changed(entity.entity_id) -%}
{%- endfor -%}
{%- set sorted_list = (ns.entity_and_area) | rejectattr('area','eq',none) | sort(attribute='area') -%}
{{ sorted_list | map(attribute='entity_id') | list }}
I have my list displaying the correct entity ids as the heading using this.entity_id but am trying to figure out how to instead display the device name (in lieu of the entity id) in the following code. Any ideas?