Grouped light control

Hi, maybe resurrecting a dead topic here.

Anyway, I love this grouped_light component, and still shocked it’s not a core part of home assistant.

I was having problems getting alexa to fade my lights, so I’ve made some minor changes.

This is nice because currently the emulated hue bridge has an open issue where groups of lights can’t be faded (this is because a group doesn’t have an attribute of “SUPPORT_BRIGHTNESS”).

With this custom component and my small changes, Alexa will now dim those lights.

3 Likes

Dumb question but how do I use this?

If you’re using only hue bulbs, you can actually add hue groups now. They result in less calls to the hue bridge, transition in sync rather than one after the other, and are quite a bit more reliable.

is there instructions to help me enable your custom component. Its exactly what I’m looking for. as I can’t control the brightness of my grouped ceiling hue lights. ultimately I’m trying to control the brightness though HADashboard.

thanks

This may be a Dumb Question but where do you place the grouped_light.py file?

For Docker it’s in /usr/src/app/homeassistant/components/light/

I’m new to HA. I ran into this problem almost immediately: Not being able to create groups of “dimmable” objects and then dim them all simultaneously. (For instance, if one creates an HA group of lights and then uses the Emulated Hue API to expose that group as a single “Dimmable” object to Alexa, then the voice command “Alexa, dim the bedroom lights” results in an exception because the Emulated Hue API is not prepared to set the brightness level of a group. And, indeed, it seems that groups cannot support uniform brightness control.)

As someone who is also not a veteran of the open source community, this discussion confuses me a bit:

  1. Why are people conflating the UI and the underlying data structures? Presumably good practice separates the interaction with an object from its representation.

  2. Why would the HA component system no be polymorphic? Shouldn’t every component be potentially Dimmable? In that case, a group containing some subset of Dimmable entities would automatically be Dimmable, with the obvious implementation (asynchronously dim each of the entities).

This philosophy would seem to apply to a large number of home automation tasks where one would like to perform a single operation on a group of entities.

Am I missing something? I appreciate any insight people might be able to offer.

9 Likes

I agree to the above.
There should be a way to group things to a single entity in the backend/configuration.
Doing this only on the client side makes it impossible to get a uniform behavior with other platforms like homebridge.

It should still be a group (imo) so individual control of the separate entities is still possible, but there should be a way to define a group to become some sort of ‘super-entity’ with it’s own customization options.
(grouped lights, exposed as a single light to homebridge.
Nest protect sensors grouped into a single entity with it’s states.
Merging motion sensors in one room to become one motion sensor.)

I think solving the handling of groups (even if it should be considered as one entity in everyday use) on the client-side only is weird unless it indeed is a group of different entities in practice.
Perhaps this should be done with different components, but one would expect this in the group section when doing the configuration.
I’ll give this some more thought.

2 Likes

Agree, my kitchen lights are a mix of Ikea Tradfri and Hue bulbs.

Here’s my take at this:

I created this because effects were not supported by the alternatives and the code seemed quite messy. Theoretically, this could also with some slight modifications be converted into a PR, but as @balloob mentioned, this might be better to do in the frontend - unfortunately I haven’t really ever looked at that part of Home Assistant so I created the code for the python core.

HI,

I think this is an awesome idea, and I have tried this, however, I get the following exception:

2018-02-06 23:22:43 INFO (MainThread) [homeassistant.loader] Loaded grouped_light from custom_components.grouped_light
2018-02-06 23:22:43 INFO (MainThread) [homeassistant.setup] Setting up grouped_light
2018-02-06 23:22:43 ERROR (MainThread) [homeassistant.setup] Error during setup of component grouped_light
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/setup.py”, line 199, in _async_setup_component
component.setup, hass, processed_config)
AttributeError: module ‘custom_components.grouped_light’ has no attribute ‘setup’

Any ideas on this?

John

I think you put the python file in the custom_components/grouped_light.py path - you should instead use custom_components/light/grouped_light.py (as documented in the gist)

What’s the major difference between your version and the jjensen version?

I think the main difference is that mine supports effects. Although you won’t notice it, the code is also a bit cleaner, using asyncio and has config validation.

Edit: and this version doesn’t compute the average of the attributes of all child lights (for example for the brightness) as that seemed quite silly to me.

1 Like

Thanks, tried this out last night and it’s been working beautifully. Thank you.

I find it funny this is the fourth version and fork of the original multigroup light – keeps getting better, should definitely be included by default.

That’s open source (at its best) :smiley:

I had no idea people were using my gist. I will merge yours into mine.

Hi

Trying this setup, i am a bit puzzled to what the extra or advantage is of this component compared to a regular Hue group?
That seems to offer the same options and possibilities with the enhanced feature of the color wheel ?

Please let me know if and when I’m missing the essential here…
Cheers
Marius

Home Assistant did not have support for regular Hue groups at the time of writing, so I’ve had to write a script in order to access Hue’s API.

cool, and really appreciated. But you feel this is still necessary, or do Hue groups suffice now.