@@ -17,6 +17,7 @@ class CommandSetV6(CommandSet):
1717 PASSWORD_BYTE2 = 0x00
1818 MAX_COLOR = 0xFF
1919 MAX_BRIGHTNESS = 0x64
20+ MAX_SATURATION = 0x64
2021 MAX_TEMPERATURE = 0x64
2122
2223 def __init__ (self , bridge , group_number , remote_style ,
@@ -48,6 +49,19 @@ def convert_brightness(self, brightness):
4849 """
4950 return math .ceil (brightness * self .MAX_BRIGHTNESS )
5051
52+ def convert_saturation (self , saturation ):
53+ """
54+ Convert the saturation from decimal percent (0.0-1.0)
55+ to byte representation for use in commands.
56+ :param saturation: The saturation from in decimal percent (0.0-1.0).
57+ 1.0 is the maximum saturation where no white leds will be on. 0.0 is no
58+ saturation.
59+ :return: The saturation in byte representation.
60+ """
61+
62+ saturation_inverted = 1 - saturation ;
63+ return math .ceil (saturation_inverted * self .MAX_SATURATION )
64+
5165 def convert_temperature (self , temperature ):
5266 """
5367 Convert the temperature from decimal percent (0.0-1.0)
@@ -310,3 +324,11 @@ def brightness(self, brightness):
310324 :return: The command.
311325 """
312326 return self ._build_command (0x03 , self .convert_brightness (brightness ))
327+
328+ def saturation (self , saturation ):
329+ """
330+ Build command for setting the saturation of the led.
331+ :param saturation: Value to set (0.0-1.0).
332+ :return: The command.
333+ """
334+ return self ._build_command (0x02 , self .convert_saturation (saturation ))
0 commit comments