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

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


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

Thanks a lot for the solution @TheFes. Strangely I’m finding that when I change the brightness using this it still turns on any lights that were previously turned off. Any suggestions on how to debug this so I can try to adjust and make it work?

Can you post your configuration for the template light?

Thanks so much for the quick response. I figured it out. The issue was I was trying to control a group of lights that was from Hue. I created a group helper within HA that includes the lights and used that with your code and it works perfectly. Thanks again!

Thanks for posting. This does basically what I am looking for but when I use the brightness slider it bounces around before going to the selected brightness. Is it possible to add and remove lights from a group when they are turned on and off rather than compiling the list when the brightness is changed? I think this would have a smoother ui experience.

I have a group of lights that are rgb and cct…
The whole isse could be solved by dynamically adding members to the group but that isnt provided by home assistant… or adding such a feature into the group settings
This is a stupid problem. I think a fix would make alot of people happy