#Dynamic Light Group

1 messages · Page 1 of 1 (latest)

sour ledge
#

I want to create a dynamic light group (or something similar) to be able to only adjust the lights that are currently on. I want to be able to have a slider on my dashboard that only adjusts those lights. I have tried googling all this and couldn't seem to find anything that would be able to easily achieve this?

ember shoal
#

Create a helper group of lights.

sour ledge
#

I currently have a light group with all lights in it, but if only some of those lights are on, I don't want the rest of the lights to turn on if i wanted to change brightness or color.

languid narwhal
#

I do this

#

here:

#
  all_on_lights: >
    {{ integration_entities('group')|  select('search',
    'light.group_all_lights')   | expand | selectattr("attributes.rgb_color",
    "defined") |  selectattr("state", "eq", "on") | map(attribute='entity_id') 
    | list }}

Define this variable a script, and call your action on 'all_on_lights'

#

Code context:

#
sequence:
  - variables:
      all_on_lights: >
        {{ integration_entities('group')|  select('search',
        'light.group_all_lights')   | expand |
        selectattr("attributes.rgb_color", "defined") |  selectattr("state",
        "eq", "on") | map(attribute='entity_id')  | list }}
  - repeat:
      sequence:
        - metadata: {}
          data:
            hs_color: "{{ range(1, 360) | random | string + ',' + 100 | string }}"
          target:
            entity_id: "{{all_on_lights[repeat.index - 1]}}"
          action: light.turn_on
      for_each: "{{ all_on_lights }}"
mode: restart
icon: mdi:sale
fields: {}
description: |-
  This script can be used to change the lights in the house to random colors.

  It can be used by an LLM to trigger this action when requested

  Do not use this to modify individual lights or bulbs!
sour ledge
#

From what I can see of that though it wouldn't allow me to do this from a card on the dashboard. My goal if possible is to treat only the lights that are on as one so i can use a light card (or something similar) on my dashboard. sorry if i'm not explaining things very clearly

#

I know a light group would let me, but from what i've tried it doesn't see, possible to edit one after its created. I know its possible with the old style group, but that wouldn't be treated as a light

subtle lotus
#

(also while poking around in helpers I discovered a template light. You might be able to include the above search for lights that are on into a single entity with that. Never tried it, only just discovered it)