Hello,
I am fairly experienced with Home Assistant but using lovelace_gen for the first time. I have all the nuts and bolts working, but struggling to get my dashboard to load. In the frontend, it just states “Unknown Error”. What I’m I’m trying to do is iterate over all the areas of my house and for each area provide an entities card with the 4 most recently changed entities. Below is my dashboard yaml. When I paste this into the template renderer in Developer Tools it does appear to format the way that I would expect.
# lovelace_gen
- title: Dashboard Title
path: dashboard_path
theme: reeder_dark
cards:
{%- set max_entities = 4 %}
{%- for area in areas() -%}
{% set ns = namespace(foo=0) -%}
{% set area_name = area_name(area) -%}
{%- set area_entities = expand(states | selectattr('entity_id', 'in', area_entities(area_name)) | map(attribute="entity_id") | list) -%}
{% if area_entities | length > 0 %}
- type: entities
title: {{ area_name }}
entities:
{%- for area_entity in area_entities | sort(attribute='last_changed', reverse=True) %}
{%- if ns.foo < max_entities %}
- {{area_entity.entity_id}}
{%- endif -%}
{% set ns.foo = ns.foo + 1 -%}
{% endfor -%}
{% endif -%}
{% endfor %}