Brightness 'slider-entity-row' for 'ON' lights only

Hi all!

Started out with Home Assistant recently and I got an expected behaviour which I don’t know how to create.

So currently I use the custom ‘slider-entity-row’ card for a brightness slider for all the lights in the living room:

Except, when moving the slider, it also turns on lights which were initially off. And I would like the slider to just change the brightness (or color temp) of the lights which are currently on / active.

Tried many different options, but couldn’t solve it yet, But I have a feeling that this is definitely possible.

Tried implementing if statement into the ‘entity:’ property.

{%- set entities = [states.light.ikea_lamp, states.light.tv_lamp, states.light.plafondlamp_groep, states.light.tafellamp_groep ] -%}
        {%- for entity in entities -%}
          {%- if entity.state == 'on' %}
        {{ entity.entity_id }}
          {%- endif %}
        {%- endfor -%}

But that isn’t allowed?

Then I also tried creating a sensor from it, which returns the entity_id’s of the on / active lights. But also couldn’t use the sensor within the ‘entity:’ property.

So many hours later, I gave up and wondered if any of you knew how to solve this.

Still wondering if anyone has a better solutions for this?

Currently I solved it by using multiple conditional card, enabling / disabling different sliders controlling different light groups depending on which are active.

But having the conditions within one card, would be more ideal.

Did you ever figure out how to do this? This would be extremely useful.

Unfortunately not, it’s still something I’m interested in. But since the conditional card implementation I haven’t actively searched for a different tactic. It’s still on my list however and I will someday continue to work on a proper solution.

Any updates 1 year later again?
I’m looking to go and implement something like this as well

Still looking for solutions myself. Surely there is a way!