This reverts commit 6ffe0f6405
.
This commit is contained in:
parent
82abae1f7d
commit
370799bd22
2 changed files with 9 additions and 25 deletions
|
@ -132,12 +132,6 @@ async def _async_reproduce_state(
|
|||
if deprecated_attrs:
|
||||
_LOGGER.warning(DEPRECATION_WARNING, deprecated_attrs)
|
||||
|
||||
if ATTR_WHITE in state.attributes and ATTR_COLOR_MODE not in state.attributes:
|
||||
state_dict = state.as_dict()
|
||||
state_dict["attributes"][ATTR_BRIGHTNESS] = state.attributes[ATTR_WHITE]
|
||||
state_dict["attributes"][ATTR_COLOR_MODE] = COLOR_MODE_WHITE
|
||||
state = State.from_dict(state_dict)
|
||||
|
||||
# Return if we are already at the right state.
|
||||
if (
|
||||
cur_state.state == state.state
|
||||
|
|
|
@ -20,8 +20,6 @@ VALID_PROFILE = {"profile": "relax"}
|
|||
VALID_RGB_COLOR = {"rgb_color": (255, 63, 111)}
|
||||
VALID_RGBW_COLOR = {"rgbw_color": (255, 63, 111, 10)}
|
||||
VALID_RGBWW_COLOR = {"rgbww_color": (255, 63, 111, 10, 20)}
|
||||
VALID_WHITE = {"white": 220} # Specified in a scene
|
||||
VALID_WHITE_STATE = {"color_mode": "white", "brightness": 220} # The light's state
|
||||
VALID_XY_COLOR = {"xy_color": (0.59, 0.274)}
|
||||
|
||||
|
||||
|
@ -29,7 +27,7 @@ async def test_reproducing_states(hass, caplog):
|
|||
"""Test reproducing Light states."""
|
||||
hass.states.async_set("light.entity_off", "off", {})
|
||||
hass.states.async_set("light.entity_bright", "on", VALID_BRIGHTNESS)
|
||||
hass.states.async_set("light.entity_white_value", "on", VALID_WHITE_VALUE)
|
||||
hass.states.async_set("light.entity_white", "on", VALID_WHITE_VALUE)
|
||||
hass.states.async_set("light.entity_flash", "on", VALID_FLASH)
|
||||
hass.states.async_set("light.entity_effect", "on", VALID_EFFECT)
|
||||
hass.states.async_set("light.entity_trans", "on", VALID_TRANSITION)
|
||||
|
@ -39,7 +37,6 @@ async def test_reproducing_states(hass, caplog):
|
|||
hass.states.async_set("light.entity_kelvin", "on", VALID_KELVIN)
|
||||
hass.states.async_set("light.entity_profile", "on", VALID_PROFILE)
|
||||
hass.states.async_set("light.entity_rgb", "on", VALID_RGB_COLOR)
|
||||
hass.states.async_set("light.entity_white", "on", VALID_WHITE_STATE)
|
||||
hass.states.async_set("light.entity_xy", "on", VALID_XY_COLOR)
|
||||
|
||||
turn_on_calls = async_mock_service(hass, "light", "turn_on")
|
||||
|
@ -50,7 +47,7 @@ async def test_reproducing_states(hass, caplog):
|
|||
[
|
||||
State("light.entity_off", "off"),
|
||||
State("light.entity_bright", "on", VALID_BRIGHTNESS),
|
||||
State("light.entity_white_value", "on", VALID_WHITE_VALUE),
|
||||
State("light.entity_white", "on", VALID_WHITE_VALUE),
|
||||
State("light.entity_flash", "on", VALID_FLASH),
|
||||
State("light.entity_effect", "on", VALID_EFFECT),
|
||||
State("light.entity_trans", "on", VALID_TRANSITION),
|
||||
|
@ -60,7 +57,6 @@ async def test_reproducing_states(hass, caplog):
|
|||
State("light.entity_kelvin", "on", VALID_KELVIN),
|
||||
State("light.entity_profile", "on", VALID_PROFILE),
|
||||
State("light.entity_rgb", "on", VALID_RGB_COLOR),
|
||||
State("light.entity_white", "on", VALID_WHITE),
|
||||
State("light.entity_xy", "on", VALID_XY_COLOR),
|
||||
]
|
||||
)
|
||||
|
@ -83,7 +79,7 @@ async def test_reproducing_states(hass, caplog):
|
|||
State("light.entity_xy", "off"),
|
||||
State("light.entity_off", "on", VALID_BRIGHTNESS),
|
||||
State("light.entity_bright", "on", VALID_WHITE_VALUE),
|
||||
State("light.entity_white_value", "on", VALID_FLASH),
|
||||
State("light.entity_white", "on", VALID_FLASH),
|
||||
State("light.entity_flash", "on", VALID_EFFECT),
|
||||
State("light.entity_effect", "on", VALID_TRANSITION),
|
||||
State("light.entity_trans", "on", VALID_COLOR_NAME),
|
||||
|
@ -92,12 +88,11 @@ async def test_reproducing_states(hass, caplog):
|
|||
State("light.entity_hs", "on", VALID_KELVIN),
|
||||
State("light.entity_kelvin", "on", VALID_PROFILE),
|
||||
State("light.entity_profile", "on", VALID_RGB_COLOR),
|
||||
State("light.entity_rgb", "on", VALID_WHITE),
|
||||
State("light.entity_white", "on", VALID_XY_COLOR),
|
||||
State("light.entity_rgb", "on", VALID_XY_COLOR),
|
||||
],
|
||||
)
|
||||
|
||||
assert len(turn_on_calls) == 13
|
||||
assert len(turn_on_calls) == 12
|
||||
|
||||
expected_calls = []
|
||||
|
||||
|
@ -109,9 +104,9 @@ async def test_reproducing_states(hass, caplog):
|
|||
expected_bright["entity_id"] = "light.entity_bright"
|
||||
expected_calls.append(expected_bright)
|
||||
|
||||
expected_white_value = dict(VALID_FLASH)
|
||||
expected_white_value["entity_id"] = "light.entity_white_value"
|
||||
expected_calls.append(expected_white_value)
|
||||
expected_white = dict(VALID_FLASH)
|
||||
expected_white["entity_id"] = "light.entity_white"
|
||||
expected_calls.append(expected_white)
|
||||
|
||||
expected_flash = dict(VALID_EFFECT)
|
||||
expected_flash["entity_id"] = "light.entity_flash"
|
||||
|
@ -145,15 +140,10 @@ async def test_reproducing_states(hass, caplog):
|
|||
expected_profile["entity_id"] = "light.entity_profile"
|
||||
expected_calls.append(expected_profile)
|
||||
|
||||
expected_rgb = dict(VALID_WHITE)
|
||||
expected_rgb = dict(VALID_XY_COLOR)
|
||||
expected_rgb["entity_id"] = "light.entity_rgb"
|
||||
expected_rgb["brightness"] = expected_rgb["white"]
|
||||
expected_calls.append(expected_rgb)
|
||||
|
||||
expected_white = dict(VALID_XY_COLOR)
|
||||
expected_white["entity_id"] = "light.entity_white"
|
||||
expected_calls.append(expected_white)
|
||||
|
||||
for call in turn_on_calls:
|
||||
assert call.domain == "light"
|
||||
found = False
|
||||
|
|
Loading…
Add table
Reference in a new issue