I have 7 spotlights. I want to turn on each spotlight pressing on my esphome button.
Case scenario:
{% set lights = ['light.livingroom_spotlight_1_1','light.livingroom_spotlight_1_2','light.livingroom_spotlight_1_3','light.livingroom_spotlight_1_4','light.livingroom_spotlight_1_5','light.livingroom_spotlight_1_6','light.livingroom_spotlight_1_7'] %}
If all lights are turned off in lights group, then turn first light ‘light.livingroom_spotlight_1_1’
If only first light is turned on, turn on next light (‘light.livingroom_spotlight_1_2’)
If only first and second lights are turned on, then turn on third light (‘light.livingroom_spotlight_1_3’)
and so on.
If lights are turned on in any other non-linear form (first light turned on, then fourth, then seventh) - turn off all lights, and turn on just first light.
This is still new and I haven’t used this myself, but an input_select has a select_next service. Perhaps you can leverage that. It will give you the ability to cycle, but you’ll need more.
That’s not what the OP means, according to my understanding. It should go: Light 1 is on, then press the button, then 1 and 2 is on, press again, 1 and 2 and 3 is on, etc. and after all are on, the next button press will turn everything off, followed by restarting the process.
So, this automation should do the trick and give you the tools to debug it. You’ll have to add your own trigger and adjust the list of lights in the variables.