Skip to content

Commit 687df07

Browse files
Merge pull request #36 from amelchio/dualwhite-v6-brightness-temperature
Fix brightness/temperature for CommandSetWhiteV6
2 parents 6848c38 + 839e9ab commit 687df07

File tree

1 file changed

+24
-10
lines changed
  • limitlessled/group/commands

1 file changed

+24
-10
lines changed

limitlessled/group/commands/v6.py

+24-10
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,17 @@ def convert_hue(self, hue, legacy_color_wheel=False):
131131

132132
return hue % (self.MAX_HUE + 1)
133133

134-
def _build_command(self, cmd_1, cmd_2):
134+
def _build_command(self, cmd_1, cmd_2,
135+
select=False, select_command=None):
135136
"""
136137
Constructs the complete command.
137138
:param cmd_1: Light command 1.
138139
:param cmd_2: Light command 2.
139140
:return: The complete command.
140141
"""
141142

142-
return CommandV6(cmd_1, cmd_2, self._remote_style, self._group_number)
143+
return CommandV6(cmd_1, cmd_2, self._remote_style, self._group_number,
144+
select, select_command)
143145

144146

145147
class CommandSetBridgeLightV6(CommandSetV6):
@@ -227,21 +229,33 @@ def night_light(self):
227229
"""
228230
return self._build_command(0x01, 0x06)
229231

230-
def brightness(self, brightness):
232+
def dimmer(self):
231233
"""
232-
Build command for setting the brightness of the led.
233-
:param brightness: Value to set (0.0-1.0).
234+
Build command for setting the brightness one step dimmer.
234235
:return: The command.
235236
"""
236-
return self._build_command(0x01, self.convert_brightness(brightness))
237+
return self._build_command(0x01, 0x02, select=True, select_command=self.on())
237238

238-
def temperature(self, temperature):
239+
def brighter(self):
239240
"""
240-
Build command for setting the temperature of the led.
241-
:param temperature: Value to set (0.0-1.0).
241+
Build command for setting the brightness one step brighter.
242+
:return: The command.
243+
"""
244+
return self._build_command(0x01, 0x01, select=True, select_command=self.on())
245+
246+
def cooler(self):
247+
"""
248+
Build command for setting the temperature one step cooler.
249+
:return: The command.
250+
"""
251+
return self._build_command(0x01, 0x04, select=True, select_command=self.on())
252+
253+
def warmer(self):
254+
"""
255+
Build command for setting the temperature one step warmer.
242256
:return: The command.
243257
"""
244-
return self._build_command(0x01, self.convert_temperature(temperature))
258+
return self._build_command(0x01, 0x03, select=True, select_command=self.on())
245259

246260
class CommandSetDimmerV6(CommandSetV6):
247261
""" Command set for Dimmer LED dimmer (1CH MiLight dimmer) connected to wifi bridge v6. """

0 commit comments

Comments
 (0)