Group Light Controls

From GitHub:

CCOSTAN:
It would be great to be able to DIM an entire group.
https://cloud.githubusercontent.com/assets/2160436/10103695/61da4d04-6373-11e5-9914-5545684f65a5.png


luxus:
Changing color would be awesome as well :slight_smile: impossible to get the same color

3 Likes

Has anybody taken a crack at this?

This would be really useful. I have a fixture that has 5 hue white bulbs in it because I was unable to hardwire a dimmer for it. I always want to set the brightness level for all 5 of those bulbs at the same time because they are essentially a single light for all use cases.

I have just started using Home Assistant today and I don’t have much python experience but I may poke around if nobody else has tried this yet. I figure since HA already has the ability to treat a group of lights as a switch that it may not be hard to extend that functionality to check if all lights in a group are dimmable and allow dimming control instead of just a switch.

The only alternative I can provide is to write a shell script that makes one API call to a group instead of Home Assistant making 5 API calls at once.

Let me see if I can pull up my thread in my smartphone…

Update: Here you go:

After poking around for a bit there seems to be a number of ways this could be achieved

  1. Modify the turn_on behavior of the group component to accept a brightness
  2. Add a “platform” to the light component which aggregates lights into a single entity
  3. Create a “grouped_light” component which is a subclass of the light component and just calls its parent class’ method for every member of its group

I am not sure that 1. would really make sense as groups don’t seem to have a detail card. Maybe it would make sense if it could be done “generically” where if all members of a group share the same capabilities then the group gets a detail card in which settings apply to all members of the group.

I don’t think 2. makes very much sense either. As far as I can tell platforms are reserved for physical things.

Number 3 makes the most sense to me. It is intuitive to think of a group of lights (for example all in the same physical fixture) as a single entity which will always be controlled together and never individually.

I don’t have much python experience (javascript all day currently) so I may be misreading how some of this code is constructed and what might make sense. Can anybody comment on my ideas above and let me know if any of them are worth pursuing?

I took a stab at it. Got something basic but not perfect working. See here Grouped light control