mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
* yeelight: implement min_mireds and max_mireds, fixes #9509 thanks to @amelchio for pointing this out! * remove typing infos
This commit is contained in:
parent
2a2ee81957
commit
c00647ace0
@ -54,6 +54,10 @@ SUPPORT_YEELIGHT_RGB = (SUPPORT_YEELIGHT |
|
|||||||
SUPPORT_EFFECT |
|
SUPPORT_EFFECT |
|
||||||
SUPPORT_COLOR_TEMP)
|
SUPPORT_COLOR_TEMP)
|
||||||
|
|
||||||
|
YEELIGHT_MIN_KELVIN = YEELIGHT_MAX_KELVIN = 2700
|
||||||
|
YEELIGHT_RGB_MIN_KELVIN = 1700
|
||||||
|
YEELIGHT_RGB_MAX_KELVIN = 6500
|
||||||
|
|
||||||
EFFECT_DISCO = "Disco"
|
EFFECT_DISCO = "Disco"
|
||||||
EFFECT_TEMP = "Slow Temp"
|
EFFECT_TEMP = "Slow Temp"
|
||||||
EFFECT_STROBE = "Strobe epilepsy!"
|
EFFECT_STROBE = "Strobe epilepsy!"
|
||||||
@ -191,6 +195,20 @@ class YeelightLight(Light):
|
|||||||
"""Return the brightness of this light between 1..255."""
|
"""Return the brightness of this light between 1..255."""
|
||||||
return self._brightness
|
return self._brightness
|
||||||
|
|
||||||
|
@property
|
||||||
|
def min_mireds(self):
|
||||||
|
"""Return minimum supported color temperature."""
|
||||||
|
if self.supported_features & SUPPORT_COLOR_TEMP:
|
||||||
|
return kelvin_to_mired(YEELIGHT_RGB_MAX_KELVIN)
|
||||||
|
return kelvin_to_mired(YEELIGHT_MAX_KELVIN)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def max_mireds(self):
|
||||||
|
"""Return maximum supported color temperature."""
|
||||||
|
if self.supported_features & SUPPORT_COLOR_TEMP:
|
||||||
|
return kelvin_to_mired(YEELIGHT_RGB_MIN_KELVIN)
|
||||||
|
return kelvin_to_mired(YEELIGHT_MIN_KELVIN)
|
||||||
|
|
||||||
def _get_rgb_from_properties(self):
|
def _get_rgb_from_properties(self):
|
||||||
rgb = self._properties.get('rgb', None)
|
rgb = self._properties.get('rgb', None)
|
||||||
color_mode = self._properties.get('color_mode', None)
|
color_mode = self._properties.get('color_mode', None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user