swa72 / home-assistant

14 stars 1 forks source link

Card listing *devices* not entities? - Configuration / Frontend - Home Assistant Community #59

Closed swa72 closed 2 years ago

swa72 commented 2 years ago

Card listing devices not entities? - Configuration / Frontend - Home Assistant Community

https://community.home-assistant.io/t/card-listing-devices-not-entities/355833

swa72 commented 2 years ago
{% set device_ids = states
  | selectattr('state', 'in', ['unavailable', 'unknown'])
  | map(attribute='entity_id')
  | map("device_id")
  | map("string")
  | unique
  | select("ne", "None")
  | list
%}
swa72 commented 2 years ago

This one will list both scripts and automations, ready to copy to Excel

{{"Name;Domain;Entity_ID;Area Name"}}
{% for state in states %}
{%- if 'script' in state.entity_id or 'automation' in state.entity_id -%}
{{state.name}};{{state.domain}};{{state.entity_id}};{{area_name(state.entity_id)}}
{% endif -%}
{%- endfor -%}
swa72 commented 2 years ago

scripts have no area :-/

swa72 commented 2 years ago

This one will only list automations without area

{{"Name;Domain;Entity_ID;Area Name"}}
{% for state in states %}
{%- if 'automation' in state.entity_id -%}
{%- if area_name(state.entity_id) == None -%}
{{state.name}};{{state.domain}};{{state.entity_id}};{{area_name(state.entity_id)}}
{% endif -%}
{% endif -%}
{%- endfor -%}