Skip to content

Commit

Permalink
Merge pull request #36 from amelchio/dualwhite-v6-brightness-temperature
Browse files Browse the repository at this point in the history
Fix brightness/temperature for CommandSetWhiteV6
  • Loading branch information
happyleavesaoc authored Jul 15, 2018
2 parents 6848c38 + 839e9ab commit 687df07
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions limitlessled/group/commands/v6.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,17 @@ def convert_hue(self, hue, legacy_color_wheel=False):

return hue % (self.MAX_HUE + 1)

def _build_command(self, cmd_1, cmd_2):
def _build_command(self, cmd_1, cmd_2,
select=False, select_command=None):
"""
Constructs the complete command.
:param cmd_1: Light command 1.
:param cmd_2: Light command 2.
:return: The complete command.
"""

return CommandV6(cmd_1, cmd_2, self._remote_style, self._group_number)
return CommandV6(cmd_1, cmd_2, self._remote_style, self._group_number,
select, select_command)


class CommandSetBridgeLightV6(CommandSetV6):
Expand Down Expand Up @@ -227,21 +229,33 @@ def night_light(self):
"""
return self._build_command(0x01, 0x06)

def brightness(self, brightness):
def dimmer(self):
"""
Build command for setting the brightness of the led.
:param brightness: Value to set (0.0-1.0).
Build command for setting the brightness one step dimmer.
:return: The command.
"""
return self._build_command(0x01, self.convert_brightness(brightness))
return self._build_command(0x01, 0x02, select=True, select_command=self.on())

def temperature(self, temperature):
def brighter(self):
"""
Build command for setting the temperature of the led.
:param temperature: Value to set (0.0-1.0).
Build command for setting the brightness one step brighter.
:return: The command.
"""
return self._build_command(0x01, 0x01, select=True, select_command=self.on())

def cooler(self):
"""
Build command for setting the temperature one step cooler.
:return: The command.
"""
return self._build_command(0x01, 0x04, select=True, select_command=self.on())

def warmer(self):
"""
Build command for setting the temperature one step warmer.
:return: The command.
"""
return self._build_command(0x01, self.convert_temperature(temperature))
return self._build_command(0x01, 0x03, select=True, select_command=self.on())

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

0 comments on commit 687df07

Please sign in to comment.