template:
- sensor:
- name: Lights on counter
state: >-
{% set exclusions = ['light.office_1', 'light.office_2', 'light.office_3'] %}
{{ states.light
| rejectattr('attributes.entity_id', 'defined')
| rejectattr('entity_id', 'in', exclusions)
| selectattr('state', 'eq', 'on') | list | count }}
icon: mdi:lightbulb-group
2 Likes