Migrate hyperion light to color_mode (#69276)
parent
7e6bb3354a
commit
6b4e0c744c
homeassistant/components/hyperion
tests/components/hyperion
|
@ -13,8 +13,7 @@ from homeassistant.components.light import (
|
|||
ATTR_BRIGHTNESS,
|
||||
ATTR_EFFECT,
|
||||
ATTR_HS_COLOR,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR,
|
||||
COLOR_MODE_HS,
|
||||
SUPPORT_EFFECT,
|
||||
LightEntity,
|
||||
)
|
||||
|
@ -74,8 +73,6 @@ DEFAULT_PORT = const.DEFAULT_PORT_JSON
|
|||
DEFAULT_HDMI_PRIORITY = 880
|
||||
DEFAULT_EFFECT_LIST: list[str] = []
|
||||
|
||||
SUPPORT_HYPERION = SUPPORT_COLOR | SUPPORT_BRIGHTNESS | SUPPORT_EFFECT
|
||||
|
||||
ICON_LIGHTBULB = "mdi:lightbulb"
|
||||
ICON_EFFECT = "mdi:lava-lamp"
|
||||
ICON_EXTERNAL_SOURCE = "mdi:television-ambient-light"
|
||||
|
@ -127,6 +124,10 @@ async def async_setup_entry(
|
|||
class HyperionBaseLight(LightEntity):
|
||||
"""A Hyperion light base class."""
|
||||
|
||||
_attr_color_mode = COLOR_MODE_HS
|
||||
_attr_supported_color_modes = {COLOR_MODE_HS}
|
||||
_attr_supported_features = SUPPORT_EFFECT
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
server_id: str,
|
||||
|
@ -221,11 +222,6 @@ class HyperionBaseLight(LightEntity):
|
|||
"""Return the list of supported effects."""
|
||||
return self._effect_list
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
"""Flag supported features."""
|
||||
return SUPPORT_HYPERION
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
"""Return server availability."""
|
||||
|
|
|
@ -22,7 +22,9 @@ from homeassistant.components.light import (
|
|||
ATTR_BRIGHTNESS,
|
||||
ATTR_EFFECT,
|
||||
ATTR_HS_COLOR,
|
||||
COLOR_MODE_HS,
|
||||
DOMAIN as LIGHT_DOMAIN,
|
||||
SUPPORT_EFFECT,
|
||||
)
|
||||
from homeassistant.config_entries import (
|
||||
RELOAD_AFTER_UPDATE_DELAY,
|
||||
|
@ -257,9 +259,9 @@ async def test_light_basic_properties(hass: HomeAssistant) -> None:
|
|||
# By default the effect list is the 3 external sources + 'Solid'.
|
||||
assert len(entity_state.attributes["effect_list"]) == 4
|
||||
|
||||
assert (
|
||||
entity_state.attributes["supported_features"] == hyperion_light.SUPPORT_HYPERION
|
||||
)
|
||||
assert entity_state.attributes["color_mode"] == COLOR_MODE_HS
|
||||
assert entity_state.attributes["supported_color_modes"] == [COLOR_MODE_HS]
|
||||
assert entity_state.attributes["supported_features"] == SUPPORT_EFFECT
|
||||
|
||||
|
||||
async def test_light_async_turn_on(hass: HomeAssistant) -> None:
|
||||
|
|
Loading…
Reference in New Issue