Closed grifdail closed 4 years ago
Wow, that looks nice.
Thank you for your contribution.
One thing though.
I can see that the color bulb also has a BrightnessProperty
.
Color lights are supposed to have only a ColorProperty
.
The brightness can be controlled via the color picker.
But I think can change that after I merged it.
I found it more convenient that way especially for working with the gateway.
Ideally you would just pick the hue and saturation of the color and then adjust the brightness. However the gateway UI for "ColorProperty" let you pick any RGB color. This is good for web but not representative at all for a lightbulb.
I know the Tradfri client support HSB color.
One way to do deal with this could be to extract the hue and saturation from the RGB color and only set that.
Another reason for this is that's it's usually easier to work with different values for both. I've set up a huge 15 rules system to control a color bulb with a Tradfri OnOff switch. The "on" button cycle between 8 colors. The "Off" button cycle between 5 levels of brightness. Using only one property to control both would mean creating a total of 40 different rules.
I fully understand that, but it's hard to provide a consistent UI across different light bulbs.
Most of the APIs have their own way of dealing with brightness depending on the light mode.
The color picker works for almost all of them in the same way.
There is an issue from @mrstegeman that might involve the BrightnessProperty
https://github.com/mozilla-iot/gateway/pull/2425.
I added an experimental flag for the brightness property in the settings. If you set it, the brightness property will also appear on color lights.
This PR add support for Colored Light (such as this one ), White spectrum Light ( here ) and smart plug (Like this ).
At this point it would probably make sense to split the code into different file.
Tested for color light and smart plug
Also deal with issue #2