Use light enums in lcn (#70796)
parent
5af496682b
commit
67b411d2b2
|
@ -9,9 +9,9 @@ from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_TRANSITION,
|
ATTR_TRANSITION,
|
||||||
DOMAIN as DOMAIN_LIGHT,
|
DOMAIN as DOMAIN_LIGHT,
|
||||||
SUPPORT_TRANSITION,
|
|
||||||
ColorMode,
|
ColorMode,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
|
LightEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_ADDRESS, CONF_DOMAIN, CONF_ENTITIES
|
from homeassistant.const import CONF_ADDRESS, CONF_DOMAIN, CONF_ENTITIES
|
||||||
|
@ -64,7 +64,7 @@ async def async_setup_entry(
|
||||||
class LcnOutputLight(LcnEntity, LightEntity):
|
class LcnOutputLight(LcnEntity, LightEntity):
|
||||||
"""Representation of a LCN light for output ports."""
|
"""Representation of a LCN light for output ports."""
|
||||||
|
|
||||||
_attr_supported_features = SUPPORT_TRANSITION
|
_attr_supported_features = LightEntityFeature.TRANSITION
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, config: ConfigType, entry_id: str, device_connection: DeviceConnectionType
|
self, config: ConfigType, entry_id: str, device_connection: DeviceConnectionType
|
||||||
|
|
|
@ -10,10 +10,9 @@ from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_SUPPORTED_COLOR_MODES,
|
ATTR_SUPPORTED_COLOR_MODES,
|
||||||
ATTR_TRANSITION,
|
ATTR_TRANSITION,
|
||||||
COLOR_MODE_BRIGHTNESS,
|
|
||||||
COLOR_MODE_ONOFF,
|
|
||||||
DOMAIN as DOMAIN_LIGHT,
|
DOMAIN as DOMAIN_LIGHT,
|
||||||
SUPPORT_TRANSITION,
|
ColorMode,
|
||||||
|
LightEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
|
@ -44,13 +43,13 @@ async def test_entity_state(hass, lcn_connection):
|
||||||
"""Test state of entity."""
|
"""Test state of entity."""
|
||||||
state = hass.states.get("light.light_output1")
|
state = hass.states.get("light.light_output1")
|
||||||
assert state
|
assert state
|
||||||
assert state.attributes[ATTR_SUPPORTED_FEATURES] == SUPPORT_TRANSITION
|
assert state.attributes[ATTR_SUPPORTED_FEATURES] == LightEntityFeature.TRANSITION
|
||||||
assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [COLOR_MODE_BRIGHTNESS]
|
assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.BRIGHTNESS]
|
||||||
|
|
||||||
state = hass.states.get("light.light_output2")
|
state = hass.states.get("light.light_output2")
|
||||||
assert state
|
assert state
|
||||||
assert state.attributes[ATTR_SUPPORTED_FEATURES] == SUPPORT_TRANSITION
|
assert state.attributes[ATTR_SUPPORTED_FEATURES] == LightEntityFeature.TRANSITION
|
||||||
assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [COLOR_MODE_ONOFF]
|
assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.ONOFF]
|
||||||
|
|
||||||
|
|
||||||
async def test_entity_attributes(hass, entry, lcn_connection):
|
async def test_entity_attributes(hass, entry, lcn_connection):
|
||||||
|
|
Loading…
Reference in New Issue