The key to getting it to work is the template to determine what entities to handle. yaml {{ states.light | rejectattr('entity_id', 'eq', 'light.dynamic_lights') | rejectattr('entity_id', 'eq', 'light.all_lights_on') | rejectattr('entity_id', 'in', integration_entities('group')) | rejectattr('entity_id', 'in', integration_entities('fullykiosk')) | rejectattr('entity_id', 'in', integration_entities('demo')) | rejectattr('entity_id', 'in', integration_entities('Demo')) | rejectattr('entity_id', 'in', integration_entities('bambu_lab') + integration_entities('browser_mod')) | selectattr('state' , 'eq' , 'on') | sort(attribute='name') | map(attribute = 'entity_id') | list }} The templates finds all light entities, rejects the two versions of dynamic lights and various integrations such as light groups and others that create light entities that are not applicable and keeps lights that are currently turned on. You may need to adjust your template accordingly. It wouldn't take much to adapt it to handle lights in a certain room or floor, for example. You can paste this template into Developer Tools > Template and see what it returns. Currently, mine returns ['light.kitchen', 'light.living_room1', 'light.living_room2', 'light.office1', 'light.office2', 'light.stove']
Integrations can be rejected with their own line or combined using the + sign.