peter-murray / node-hue-api

Node.js Library for interacting with the Philips Hue Bridge and Lights
Apache License 2.0
1.19k stars 145 forks source link

Is anyone working on RGB state for groups? #70

Closed Connor-Knabe closed 8 years ago

Connor-Knabe commented 8 years ago

When I attempt to change the color of a group of lights I get "Api Error: RGB state is not supported for groups yet" using setGroupLightState() function.

peter-murray commented 8 years ago

I am not going to implement this, at least not directly setting it on a group.

The problem comes from the fact that you can have any number of different lights in a group. Each Hue light has a different conversion for the RGB values into the HSL values that end up being sent to the bulb/light.

This means that you would have to do multiple requests and potentially conversions per type of light in the group to achieve what you think would be a single request.

It is possible to do the conversion on the first light in the group, and then send the HSL values to all the lights in the group, but if they are not all the same, then some lights may not respond correctly and set the correct colour (if you attempt to set the value outside the triangle it will convert it for you in the bridge), or at worst generate an error.

The Hue Bridge has an alternative approach to this, which is to set a scene with the colours desired. You can then activate the scene as required (and even filter the lights using a group when you activate it).

This may solve your issue, or if you are looking to dynamically change the colours for a group, I would suggest that you use HSL or HSB instead.