immersive-home/lib/home_adapters/hass_ws/templates/devices.j2
2023-11-05 16:36:13 +01:00

10 lines
423 B
Django/Jinja

{% set devices = states | map(attribute='entity_id') | map('device_id') | unique | reject('eq',None) | list %}
{%- set ns = namespace(devices = []) %}
{%- for device in devices %}
{%- set entities = device_entities(device) | list %}
{%- if entities %}
{%- set ns.devices = ns.devices + [ {device: {"name": device_attr(device, "name"), "entities": entities }} ] %}
{%- endif %}
{%- endfor %}
{{ ns.devices }}