* Fixes for demos

* Update vacuum.py

* Comment

* Fix tests
This commit is contained in:
Bram Kragten authored and GitHub committed 2020-03-11 08:16:22 -07:00
1 parent 7127492767
commit 4c4e5f3fa9
8 files changed
+98 -21

No files matched your search

+13 -5
View File
@@ -44,9 +44,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
effect_list=LIGHT_EFFECT_LIST,
effect=LIGHT_EFFECT_LIST[0],
),
DemoLight(
"light_2", "Ceiling Lights", True, True, LIGHT_COLORS[0], LIGHT_TEMPS[1]
),
DemoLight("light_2", "Ceiling Lights", True, True, ct=LIGHT_TEMPS[1]),
DemoLight(
"light_3", "Kitchen Lights", True, True, LIGHT_COLORS[1], LIGHT_TEMPS[0]
),
@@ -86,6 +84,10 @@ class DemoLight(Light):
self._effect_list = effect_list
self._effect = effect
self._available = True
if ct is not None and hs_color is None:
self._color_mode = "ct"
else:
self._color_mode = "hs"
@property
def device_info(self):
@@ -128,12 +130,16 @@ class DemoLight(Light):
@property
def hs_color(self) -> tuple:
"""Return the hs color value."""
return self._hs_color
if self._color_mode == "hs":
return self._hs_color
return None
@property
def color_temp(self) -> int:
"""Return the CT color temperature."""
return self._ct
if self._color_mode == "ct":
return self._ct
return None
@property
def white_value(self) -> int:
@@ -165,9 +171,11 @@ class DemoLight(Light):
self._state = True
if ATTR_HS_COLOR in kwargs:
self._color_mode = "hs"
self._hs_color = kwargs[ATTR_HS_COLOR]
if ATTR_COLOR_TEMP in kwargs:
self._color_mode = "ct"
self._ct = kwargs[ATTR_COLOR_TEMP]
if ATTR_BRIGHTNESS in kwargs: