Display a list of attributes?

I created a template sensor to count what lights are on and also get a list of the lights that are on

    - name: "Lights On"
      unique_id: ui_template_lights_on
      unit_of_measurement: entities
      state: >
        {% if state_attr('sensor.lights_on','entity_id') != none %}
          {{ state_attr('sensor.lights_on','entity_id') | count }}
        {% else %}
          {{ 0 }}
        {% endif %}
      attributes:
        entity_id: >
          {{ 
            states.light | selectattr('state', 'eq', 'on')
            | rejectattr('attributes.entity_id', 'defined')
            | map(attribute='name') | list
          }}

Now i want to display this in a lovelace card. i was trying to use the entity card to list the entities that are on, but the output doesn’t look that nice. is there a way to justify the entities within the entity card, or do i need to search for a custom card to display the attribute in a nicer way

You can use the markdown-card.

There is even a nice example a bit down in the docs showing almost exactly what you are after.’

2 Likes

Brilliant! I just need to figure the spacing and how to make it look more like the other entity cards. Thank you!

Try using markdown card.