How do I get every light that is on to list in an entity?

Hey! :wave:

I’m wondering how to get every single light that’s on in Home Assistant to list in an entity, so for example:

Lamp, Kitchen Light

I’m looking to add this to a dashboard to show what’s been left on.

Do you really want an entity, or just a way to display the information?

If you really want an entity, you can use the following in a Template sensor:

{{states.light|selectattr('state', 'eq', 'on')
|map(attribute='name')|join(', ') }}

Otherwise, there are a few cards that can show entities conditionally:
Entity Filter card
Auto-Entities Card
Markdown Card (use the template above in the content section.)

Hi you can do this.


  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - entity_id: light.*
          state: 'on'
      exclude:
        - entity_id: light.*groupe*
        - entity_id: light.*
          attributes:
            is_hue_group: true
    sort:
      method: friendly_name
      ignore_case: true