diff --git a/miio/philips_moonlight.py b/miio/philips_moonlight.py index bf71fbc74..3df222dd7 100644 --- a/miio/philips_moonlight.py +++ b/miio/philips_moonlight.py @@ -186,7 +186,7 @@ def set_rgb(self, rgb: Tuple[int, int, int]): if color < 0 or color > 255: raise PhilipsMoonlightException("Invalid color: %s" % color) - return self.send("set_rgb", [rgb_to_int(rgb)]) + return self.send("set_rgb", [*rgb]) @command( click.argument("level", type=int), @@ -241,7 +241,7 @@ def set_brightness_and_rgb(self, brightness: int, rgb: Tuple[int, int, int]): if color < 0 or color > 255: raise PhilipsMoonlightException("Invalid color: %s" % color) - return self.send("set_brirgb", [brightness, rgb_to_int(rgb)]) + return self.send("set_brirgb", [*rgb, brightness]) @command( click.argument("number", type=int), diff --git a/miio/tests/test_philips_moonlight.py b/miio/tests/test_philips_moonlight.py index f7596fa33..3cd69892e 100644 --- a/miio/tests/test_philips_moonlight.py +++ b/miio/tests/test_philips_moonlight.py @@ -4,7 +4,7 @@ from miio import PhilipsMoonlight from miio.philips_moonlight import PhilipsMoonlightStatus, PhilipsMoonlightException -from miio.utils import int_to_rgb +from miio.utils import int_to_rgb, rgb_to_int from .dummies import DummyDevice @@ -30,15 +30,15 @@ def __init__(self, *args, **kwargs): 'set_power': lambda x: self._set_state("pow", x), 'set_bright': lambda x: self._set_state("bri", x), 'set_cct': lambda x: self._set_state("cct", x), - 'set_rgb': lambda x: self._set_state("rgb", x), + 'set_rgb': lambda x: self._set_state("rgb", [rgb_to_int(x)]), 'apply_fixed_scene': lambda x: self._set_state("snm", x), 'set_bricct': lambda x: ( self._set_state('bri', [x[0]]), - self._set_state('cct', [x[1]]) + self._set_state('cct', [x[1]]), ), 'set_brirgb': lambda x: ( - self._set_state('bri', [x[0]]), - self._set_state('rgb', [x[1]]) + self._set_state('rgb', [rgb_to_int((x[0], x[1], x[2]))]), + self._set_state('bri', [x[3]]), ) } super().__init__(args, kwargs) @@ -229,8 +229,6 @@ def rgb(): with pytest.raises(PhilipsMoonlightException): self.device.set_brightness_and_rgb(10, (0, 0, 256)) - - def test_set_scene(self): def scene(): return self.device.status().scene