Merge pull request #182 from rospogrigio/white_point

Use color picker white point to switch to white mode.
This commit is contained in:
ultratoto14
2020-11-23 20:50:13 +01:00
committed by GitHub

View File

@@ -325,6 +325,10 @@ class LocaltuyaLight(LocalTuyaEntity, LightEntity):
if brightness is None:
brightness = self._brightness
hs = kwargs[ATTR_HS_COLOR]
if hs[1] == 0 and self.has_config(CONF_BRIGHTNESS):
states[self._config.get(CONF_BRIGHTNESS)] = brightness
states[self._config.get(CONF_COLOR_MODE)] = MODE_WHITE
else:
if self.__is_color_rgb_encoded():
rgb = color_util.color_hsv_to_RGB(
hs[0], hs[1], int(brightness * 100 / self._upper_brightness)
@@ -366,7 +370,7 @@ class LocaltuyaLight(LocalTuyaEntity, LightEntity):
self._state = self.dps(self._dp_id)
supported = self.supported_features
self._effect = None
if supported & SUPPORT_BRIGHTNESS:
if supported & SUPPORT_BRIGHTNESS and self.has_config(CONF_BRIGHTNESS):
self._brightness = self.dps_conf(CONF_BRIGHTNESS)
if supported & SUPPORT_COLOR: