immersive-home/app/lib/home_apis/hass/templates/devices.j2
2024-03-16 01:16:08 +01:00

12 lines
437 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 %}
{
"data": {{ ns.devices }}
}