Percentage dim a collection of lights individually

Existing percentage change of brightness works on the average? brightness and sets all lights to that new brightness. This is frustrating when a scene is setup and only the brightness need adjusting.

Hue dimming operates as a delta on individual lights. This is much easier to use.

Is there an option/script for delta brightness on each individual light in a group?

You could do it with an automation/script.

.....
light1
brightness: "{{ state_attr('light.light1', 'brightness') - 5 }}"

....
....
light2
brightness: "{{ state_attr('light.light2', 'brightness') - 5 }}"

This lists each light id specifically. I would prefer to do it by looping through each entity id in a group. Then the script can be re-used and does not need to be maintained every time a group changes.

Just got something working in python. Would prefer to see a clean solution in yaml that might become a blueprint.

#Individually dim lights in a group by a percentage.

logger.info("dim_light_group.py - start")

dimming_group = data.get("dimming_group")
dimming_pct = data.get("dimming_pct")
is_hue_group = data.get("is_hue_group")
transition = data.get("transition")

if dimming_group is None:
    dimming_group = "light.living_room"

logger.info("dimming_group is %s" , str(dimming_group))

if dimming_pct is None:
    dimming_pct = 20
logger.info("dimming_pct is %s" , str(dimming_pct))

if is_hue_group is None:
    is_hue_group = False

if transition is None:
    transition = 2

if True:
    dimming_group = hass.states.get(dimming_group)
    
    if dimming_group is None:
        logger.warn("dim_light_group - dimming_group not found in states")

    if 'is_hue_group' in dimming_group.attributes:
        is_hue_group = dimming_group.attributes['is_hue_group']

    if is_hue_group:
        hue_group_light_names = dimming_group.attributes['lights']

        dimming_group_light_ids = []
        
        all_lights = hass.states.entity_ids('light')
        for entity_id in all_lights:
            check_state = hass.states.get(entity_id)
            check_name = check_state.attributes['friendly_name']
            if check_name in hue_group_light_names:
                dimming_group_light_ids.append(entity_id)
            
    else:
        dimming_group_light_ids = dimming_group.attributes['entity_id']


    for group_light_id in dimming_group_light_ids:
        group_light_state = hass.states.get(group_light_id)
        
        if group_light_state.state == "on":
            brightness = group_light_state.attributes["brightness"]
            set_brightness = int(brightness * (100.0 + dimming_pct) / 100.0)
            if set_brightness > 255:
                set_brightness = 255
            logger.info("group_light_id:" + group_light_id + " is on with brightness:" + str(brightness) + " setting to:" + str(set_brightness))
            service_data = {"entity_id": group_light_id, "brightness": set_brightness, "transition": transition}
            hass.services.call("light", "turn_on", service_data, False)