type: custom:auto-entities
show_empty: false
card:
type: entities
filter:
template: >-
{% set ns = namespace(entity_and_area=[]) -%}
{%- for entity in states.device_tracker -%}
{%- 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] -%}
{%- endfor -%}
{%- set sorted_list = (ns.entity_and_area) | rejectattr('area','eq',none) | sort(attribute='area') -%}
{{ sorted_list | map(attribute='entity_id') | list }}
Here we have a list of โdevice_trackerโ entities (except not assigned to any area) sorted by area.
Will post a list of useful posts (just in case):
passing options into a conventional entity row:
โ hide a name
โ show an attribute
select entities dependently on their attributes
card-mod:
โ general schema
โ conditional card_mod
โ glance + card_mod
โ card-mod in a template: one, two, three
stack containing cards of different types
graphs in a stack:
โ history-graph
โ mini-graph-card
โ mini-graph-card + template
sorted graphs in an apexcharts donut card
dividers between lists
rows separated by dividers
static rows between filtered rows
defining a number of found elements
how to list entities in 2 columns
how to define Markdown cards in auto-entities
areas:
โ sort entities by area
โ a card with entities filtered by some area
โ list lights in some area
โ list of โareaโ cards
โ show an Area card for one area_name
โ list of entities except ones not assigned to any area
a possible way to easily define templates for cards
how to show an alternative card if a filter gives an empty list