diff --git a/pywizlight/_version.py b/pywizlight/_version.py index 8540758..2a17ff7 100644 --- a/pywizlight/_version.py +++ b/pywizlight/_version.py @@ -1,2 +1,2 @@ """PyPi Version.""" -__version__ = "0.4.8" +__version__ = "0.4.9" diff --git a/pywizlight/bulb.py b/pywizlight/bulb.py index 20d23c4..f17e663 100755 --- a/pywizlight/bulb.py +++ b/pywizlight/bulb.py @@ -9,12 +9,9 @@ from pywizlight.bulblibrary import BulbClass, BulbType, Features, KelvinRange from pywizlight.colormgmt.rgbcw import hs2rgbcw, rgb2rgbcw, rgbcw2hs -from pywizlight.exceptions import ( - WizLightConnectionError, - WizLightMethodNotFound, - WizLightNotKnownBulb, - WizLightTimeOutError, -) +from pywizlight.exceptions import (WizLightConnectionError, + WizLightMethodNotFound, + WizLightNotKnownBulb, WizLightTimeOutError) from pywizlight.scenes import SCENES _LOGGER = logging.getLogger(__name__) @@ -32,7 +29,6 @@ def __init__( speed=None, scene: int = None, rgb: tuple = None, - hs_color: tuple = None, brightness: int = None, colortemp: int = None, state: bool = True, @@ -54,8 +50,6 @@ def __init__( self._set_brightness(brightness) if colortemp is not None: self._set_colortemp(colortemp) - if hs_color is not None: - self._set_hs_color(hs_color) def set_pilot_message(self): """Return the pilot message.""" @@ -113,11 +107,13 @@ def _set_rgb(self, values: tuple): self.pilot_params["b"] = blue else: raise ValueError("Blue is not in range between 0-255.") - - # Use the existing set_warm_white function to set the CW values - self._set_warm_white(cw) - # Use the existing set_cold_white function to set the CW values - self._set_cold_white(cw) + if cw is not None: + # Use the existing set_warm_white function to set the CW values + self._set_warm_white(cw) + # Use the existing set_cold_white function to set the CW values + self._set_cold_white(cw) + else: + raise ValueError("CW values must be between 0-255. Calculation error.") def _set_hs_color(self, values: tuple): """Set the HS color state of the bulb.""" diff --git a/pywizlight/tests/test_bulb.py b/pywizlight/tests/test_bulb.py index d0e1605..df97dac 100644 --- a/pywizlight/tests/test_bulb.py +++ b/pywizlight/tests/test_bulb.py @@ -79,7 +79,7 @@ async def test_PilotBuilder_rgb(self, data): await pytest.correct_bulb.turn_on(PilotBuilder(rgb=(0, 128, 255))) state = await pytest.correct_bulb.updateState() - assert state.get_rgb() == (0, 128, 255) + assert state.get_rgb() == (0, 127, 255) @pytest.mark.asyncio async def test_PilotBuilder_scene(self, data):