Light group for lights that are already on

I habe the same question with controlling the lights which are currently ON.

I understand that there is an existing solution as described above. But this was all written before the changes of group behaviour in HA release 2022.4. So I tried to find something easier. I added the template mentioned above which gives me a list of all lights which are currently on in the script to „set group“. Unfortunately template seems to be not accepted here.

Does anyone have a more simple Solution than described above by using the new Features implemented in R2022.4?

im also looking for a reliable solution

Hi, I’m trying to add this code to templates.yaml because I separated con config file, but it doesnt work. Can you advise me?

KarimS, this needs to be in light (and not in templates.yaml, so

lights:
  - platform: template
    lights:

Hope that helps