Hi,
I am new to Home Assistant and I have the following challenge:
I want to have a control for all my lights, that are already on. For this I want to use a simple light card. With “controlling” the lights, I mean turn on/off, set brightness and color temperature.
I have already found a solution, to control multiple lights with one light card, by creating a Light Group and adding the lights to this group.
Unfortunately, when I change the brightness, all lights in that group are turned on and I found information, that this behaviour is normal. But as mentioned before: I only want to change the brightness for lights, that are already on, while leaving the others off. So I think I have to find a way, to create a dynamic Light Group with all my lights, that are turned on.
After some researching, I found the possitility to create templates. So I thought the solution for my problem would be, to put a template inside my Light Group definition:
light:
- platform: group
name: Turned on lights
entities: >
{{ (states.light|selectattr('state','eq','off')|map(attribute='entity_id')|list)|join(',') }}
Unfortunately this does not work.
So here my questions:
Is this the correct way to solve my problem, or is there another (simpler) solution for this? If I am on the correct way: What am I doing wrong?
I hope someone can help me, I did a lot of research, but found no solution for my issue. Thank you in advance for your answers.