WTH can't light groups only dim lights that are on Hue-style

When you dim a light group there some lights are on and some off, all lights turn on and them dim. This is understandable, but stupid.

This isn’t a major problem in automations, I can just check each light and dim them then, but then they don’t become the same brightness. I don’t know what Philips Hue’s rules are with dimming but they are perfect and the only reason I can’t get myself to migrate from the Hue bridge.

Would this ultimately be a feature similar to what was mentioned here? Brightness control of groups - Month of “What the heck?!” - Home Assistant Community (home-assistant.io)

1 Like

I started a technical discussion / some development prototypes on this.

See: Add `light.adjust` service call · Discussion #537 · home-assistant/architecture · GitHub

I actually created a template light to do just that for someone on Facebook yesterday
color_temp can be added as well, but that’s a bit more tricky as the min and max can vary between lights in the group

# Template light which uses a light group, but only adjust the brightness of the lights which are on
# Change object_id on line 8 and friendly_name on line 9
# Change all references to 'light.groep_speelhoek' to your own light group

light:
  - platform: template
    lights:
      template_play_area:
        friendly_name: "Template Play Area"
        level_template: >
          {% set group = 'light.groep_speelhoek' %}
          {{
            expand(group) 
              | selectattr('attributes.brightness', 'defined')
              | map(attribute='attributes.brightness')
              | list
              | default([0], true)
              | average
          }}
        value_template: "{{ is_state('light.groep_speelhoek', 'on') }}"
        turn_on:
          - service: light.turn_on
            target:
              entity_id: light.groep_speelhoek
        turn_off:
          - service: light.turn_off
            target:
              entity_id: light.groep_speelhoek
        set_level:
          - service: light.turn_on
            target:
              entity_id: >
                {% set group = 'light.groep_speelhoek' %}
                {{
                  expand(group) 
                    | selectattr('attributes.brightness', 'defined')
                    | map(attribute='entity_id')
                    | list
                }}
            data:
              brightness: "{{ brightness }}"

Thanks.

I’ve seen plenty of hacks / workarounds to this (though I must say yours is one of the nicer ones). Still it seems nuts that you have to program a page of yaml each time you want to work around this issue. Hence: WTH :stuck_out_tongue:

1 Like

Brother please do not be annoyed. How do I add this to a fresh install of Home assistant?
My light group is light.store_room

place the code above in configuration.yaml and replace all the references to light.groep_speelhoek to light.store_room.

I do see I made some errors, everytime light.speelhoek was mentioned this should be light.groep_speelhoek

Awesome solution! Works flawlessly!
I have a simple question. Is there a way for the icon on the dashboard to change color depending on the bulbs color?

That’s only possible on template lights if you define the fields that produce color for the template light

set_color and color_template

You’d have to do the same for white value or temperature too (if you want those)

Thank you very much for the immediate reply!
I am terribly sorry but I am not so advanced.
Would you be so kind as to show me where I should write these values? (I am not interested in white temperature) in the template above?

EDIT: I followed the code provided here https://www.home-assistant.io/integrations/light.template/ and added color_template and set_color but the icon’s color still doesn’t change