All lights off as a condition

Hello, I use a 6-fold button from homemetic (WRC6). This has 6 status LEDs and now I would like one status LED to be turned off when all the lights in the house are turned off. However, I haven’t figured out how to make this a condition yet. Of course I could create a group with all the lights, but I thought there might be an easier way

And should be switched on when at least one light is switched on

{{ states.light|selectattr('state','equalto','on')|list|length }}

will give you the number of “on” lights. If equal zero, it means all lights are off.

1 Like

Thank you very much, that works. However, I probably have to do this differently because the status LED on the camera is also one of the lights and therefore one light is always on

Then add any IDs to be ignored to a reject list, like this:

{{ states.light
   |rejectattr('entity_id','in',['light.IGNORE1','light.IGNORE2'])
   |selectattr('state','eq','on')|list|length }}