mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Migrate demo light tests to use Kelvin (#133003)
This commit is contained in:
parent
483688dba2
commit
7c9992f5d3
@ -9,11 +9,10 @@ from homeassistant.components.demo import DOMAIN
|
|||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_BRIGHTNESS_PCT,
|
ATTR_BRIGHTNESS_PCT,
|
||||||
ATTR_COLOR_TEMP,
|
ATTR_COLOR_TEMP_KELVIN,
|
||||||
ATTR_EFFECT,
|
ATTR_EFFECT,
|
||||||
ATTR_KELVIN,
|
ATTR_MAX_COLOR_TEMP_KELVIN,
|
||||||
ATTR_MAX_MIREDS,
|
ATTR_MIN_COLOR_TEMP_KELVIN,
|
||||||
ATTR_MIN_MIREDS,
|
|
||||||
ATTR_RGB_COLOR,
|
ATTR_RGB_COLOR,
|
||||||
ATTR_XY_COLOR,
|
ATTR_XY_COLOR,
|
||||||
DOMAIN as LIGHT_DOMAIN,
|
DOMAIN as LIGHT_DOMAIN,
|
||||||
@ -79,25 +78,33 @@ async def test_state_attributes(hass: HomeAssistant) -> None:
|
|||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
LIGHT_DOMAIN,
|
LIGHT_DOMAIN,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
{ATTR_ENTITY_ID: ENTITY_LIGHT, ATTR_EFFECT: "none", ATTR_COLOR_TEMP: 400},
|
{
|
||||||
|
ATTR_ENTITY_ID: ENTITY_LIGHT,
|
||||||
|
ATTR_EFFECT: "none",
|
||||||
|
ATTR_COLOR_TEMP_KELVIN: 2500,
|
||||||
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
state = hass.states.get(ENTITY_LIGHT)
|
state = hass.states.get(ENTITY_LIGHT)
|
||||||
assert state.attributes.get(ATTR_COLOR_TEMP) == 400
|
assert state.attributes.get(ATTR_COLOR_TEMP_KELVIN) == 2500
|
||||||
assert state.attributes.get(ATTR_MIN_MIREDS) == 153
|
assert state.attributes.get(ATTR_MAX_COLOR_TEMP_KELVIN) == 6535
|
||||||
assert state.attributes.get(ATTR_MAX_MIREDS) == 500
|
assert state.attributes.get(ATTR_MIN_COLOR_TEMP_KELVIN) == 2000
|
||||||
assert state.attributes.get(ATTR_EFFECT) == "none"
|
assert state.attributes.get(ATTR_EFFECT) == "none"
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
LIGHT_DOMAIN,
|
LIGHT_DOMAIN,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
{ATTR_ENTITY_ID: ENTITY_LIGHT, ATTR_BRIGHTNESS_PCT: 50, ATTR_KELVIN: 3000},
|
{
|
||||||
|
ATTR_ENTITY_ID: ENTITY_LIGHT,
|
||||||
|
ATTR_BRIGHTNESS_PCT: 50,
|
||||||
|
ATTR_COLOR_TEMP_KELVIN: 3000,
|
||||||
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
state = hass.states.get(ENTITY_LIGHT)
|
state = hass.states.get(ENTITY_LIGHT)
|
||||||
assert state.attributes.get(ATTR_COLOR_TEMP) == 333
|
assert state.attributes.get(ATTR_COLOR_TEMP_KELVIN) == 3000
|
||||||
assert state.attributes.get(ATTR_BRIGHTNESS) == 128
|
assert state.attributes.get(ATTR_BRIGHTNESS) == 128
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user