you can optimize that
value_template: >
{% set lights = [
states.light.eetkamer,
states.light.slaapkamer,
states.light.voortuin,
] %}
{{ lights | selectattr('state','eq','on') | list | count }}
Then to add a light, all you need to do is add to the list. No need for a huge if statement