本文整理汇总了Python中homeassistant.util.color.color_RGB_to_hs方法的典型用法代码示例。如果您正苦于以下问题:Python color.color_RGB_to_hs方法的具体用法?Python color.color_RGB_to_hs怎么用?Python color.color_RGB_to_hs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类homeassistant.util.color
的用法示例。
在下文中一共展示了color.color_RGB_to_hs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _set_light_mode
# 需要导入模块: from homeassistant.util import color [as 别名]
# 或者: from homeassistant.util.color import color_RGB_to_hs [as 别名]
def _set_light_mode(self, light_mode):
_LOGGER.info('ArloNightLight: {} light mode {}'.format(self._name, light_mode))
if light_mode is None:
return
# {'mode': 'rgb', 'rgb': {'red': 118, 'green': 255, 'blue': 91}}
# {'mode': 'temperature', 'temperature': 2650}
# {'mode': 'rainbow'}
mode = light_mode.get('mode')
if mode is None:
return
if mode == 'rgb':
rgb = light_mode.get('rgb')
self._hs_color = color_util.color_RGB_to_hs(rgb.get("red"), rgb.get("green"), rgb.get("blue"))
self._effect = LIGHT_EFFECT_NONE
elif mode == 'temperature':
temperature = light_mode.get('temperature')
self._color_temp = color_util.color_temperature_kelvin_to_mired(temperature)
self._hs_color = color_util.color_temperature_to_hs(temperature)
self._effect = LIGHT_EFFECT_NONE
elif mode == LIGHT_EFFECT_RAINBOW:
self._effect = LIGHT_EFFECT_RAINBOW
示例2: hs_color
# 需要导入模块: from homeassistant.util import color [as 别名]
# 或者: from homeassistant.util.color import color_RGB_to_hs [as 别名]
def hs_color(self):
"""Return the HS color value."""
if self._rgb:
return color_util.color_RGB_to_hs(*self._rgb)
else:
return None
示例3: hs_color
# 需要导入模块: from homeassistant.util import color [as 别名]
# 或者: from homeassistant.util.color import color_RGB_to_hs [as 别名]
def hs_color(self):
"""Return the HS color value."""
rgb = None
if self.device.supports_rgbw or self.device.supports_color:
rgb, _ = self.device.current_color
return color_util.color_RGB_to_hs(*rgb) if rgb else None
示例4: hs_color
# 需要导入模块: from homeassistant.util import color [as 别名]
# 或者: from homeassistant.util.color import color_RGB_to_hs [as 别名]
def hs_color(self):
"""Return the hue and saturation color value [float, float]."""
return color_util.color_RGB_to_hs(*self._rgb)
示例5: hs_color
# 需要导入模块: from homeassistant.util import color [as 别名]
# 或者: from homeassistant.util.color import color_RGB_to_hs [as 别名]
def hs_color(self):
return color_util.color_RGB_to_hs(self._rgb_color[0], self._rgb_color[1], self._rgb_color[2])