1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Cleanup mired light test (#162622)

This commit is contained in:
epenet
2026-02-09 09:55:58 +01:00
committed by GitHub
parent 3c266183e1
commit 9e1bfa3564

View File

@@ -1952,49 +1952,6 @@ async def test_light_service_call_color_temp_conversion(hass: HomeAssistant) ->
assert data == {"brightness": 255, "rgbww_color": (0, 0, 0, 66, 189)}
async def test_light_mired_color_temp_conversion(hass: HomeAssistant) -> None:
"""Test color temp conversion from K to legacy mired."""
entities = [
MockLight("Test_rgbww_ct", STATE_ON),
MockLight("Test_rgbww", STATE_ON),
]
setup_test_component_platform(hass, light.DOMAIN, entities)
entity0 = entities[0]
entity0.supported_color_modes = {
light.ColorMode.COLOR_TEMP,
}
entity0._attr_min_color_temp_kelvin = 1800
entity0._attr_max_color_temp_kelvin = 6700
assert await async_setup_component(hass, "light", {"light": {"platform": "test"}})
await hass.async_block_till_done()
state = hass.states.get(entity0.entity_id)
assert state.attributes["supported_color_modes"] == [light.ColorMode.COLOR_TEMP]
assert state.attributes["min_color_temp_kelvin"] == 1800
assert state.attributes["max_color_temp_kelvin"] == 6700
await hass.services.async_call(
"light",
"turn_on",
{
"entity_id": [
entity0.entity_id,
],
"brightness_pct": 100,
"color_temp_kelvin": 3500,
},
blocking=True,
)
_, data = entity0.last_call("turn_on")
assert data == {"brightness": 255, "color_temp_kelvin": 3500}
state = hass.states.get(entity0.entity_id)
assert state.attributes["color_mode"] == light.ColorMode.COLOR_TEMP
assert state.attributes["color_temp_kelvin"] == 3500
async def test_light_service_call_white_mode(hass: HomeAssistant) -> None:
"""Test color_mode white in service calls."""
entity0 = MockLight("Test_white", STATE_ON)