I am in the process of updating my template sensors to the new recommended format. I have a sensor that uses states.light
to provide a count of lights that are currently on. Is states.light
still the appropriate way to do this or is there a newer way perhaps using the states()
format?
- name: Custom All Light Status
unique_id: custom_all_light_status
state: >-
{{ states.light
| rejectattr('attributes.entity_id','defined')
| selectattr('state', 'eq', 'on')
| list | count }}