thomasloven / lovelace-auto-entities

🔹Automatically populate the entities-list of lovelace cards
MIT License
1.19k stars 111 forks source link

How can I list all areas? #382

Open elblogbruno opened 10 months ago

elblogbruno commented 10 months ago

Hello everyone. I am trying to list all available areas on my UI, hovewer I have not been very lucky.

I tried using a template:

   - type: "custom:auto-entities"
            card:
              type: "grid"
              title: All areas
              columns: 2
              square: false
            card_param: "cards"
            filter:
              template: "{{ areas() }}"
              options:
                type: area

Hovewer this gives me the following error:

image

Am I missing something? is this a bug or something? Thanks a lot!

ildar170975 commented 7 months ago
  1. This is neither a bug nor a FR. Suggest to ask similar questions in a dedicated auto-entities Community thread.

  2. This is wrong:

           filter:
             template: "{{ areas() }}"
             options:
               type: area

    You cannot use the "template" & "options" together. All your code to create a list of "area" cards should be inside the "template" option. Try this untested:

    filter:
    template: >-
    {% for AREA in areas() -%}
      {{
        {
          'type': 'area',
          'area': AREA
        }
      }},
    {%- endfor %}