List of entities by state - format

I created a sensor that shows me the lights ON in a group according to their status.

With this formatting it shows me a list of names shown one in a row separated by nothing.
I would like to see them in the form of a bulleted list for example:

  • bathroom light
  • garden light
  • light living room

How can I set up this formatting?

this is the code i write:

  - platform: template
        friendly_name: "Lista Luci Accese PT"
        icon_template: "mdi:lightbulb-group-outline"
        value_template: "{{ expand('light.luci_piano_terra') | selectattr('state', 'eq', 'on') |map(attribute='attributes.friendly_name') | list | join('\n ') }}"

this is the result but is not what i’m looking for:



Use a Markdown card. You won’t need the Template Sensor and can simply use its template in the Markdown card.

In case you weren’t aware of it, an entity’s state value is limited to 255 characters and any formatting, like newlines, isn’t displayed.

can you show me how can i do?
I need to know which lights are on, windows open, shutters up at a given time according to their status, all of them formatted in bullet list.

Start by adding this template to a Markdown card, observe the result, then modify it to suit your needs.

{{ states.light
  | selectattr('state', 'eq', 'on')
  | map(attribute='attributes.friendly_name')
  | list | join('\n ') }}

You may need several templates within the card, one for each type of entity you want it to display.