Count Lights that ar not a group

A Light Group entity has an attribute called entity_id so we can reject any light entity that has this attribute defined.

- platform: template
  sensors:
    count_lights_on:
      friendly_name: 'Totaal aantal lampen aan'
      value_template: >
        {{ states.light 
          | rejectattr('attributes.is_deconz_group', 'eq', true)
          | rejectattr('attributes.entity_id', 'defined') 
          | selectattr('state', 'eq', 'on')
          | list | count }}
10 Likes