mirror of
https://github.com/home-assistant/core.git
synced 2025-07-31 11:18:00 +02:00
Remove deprecated white_value support from MQTT light (#76848)
* Remove deprecated white_value support from MQTT light * Remove deprecated white_value support from MQTT JSON light * Remove deprecated white_value support from MQTT template light
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
"""The tests for the MQTT JSON light platform.
|
||||
|
||||
Configuration with RGB, brightness, color temp, effect, white value and XY:
|
||||
Configuration with RGB, brightness, color temp, effect, and XY:
|
||||
|
||||
light:
|
||||
platform: mqtt_json
|
||||
@ -11,22 +11,8 @@ light:
|
||||
color_temp: true
|
||||
effect: true
|
||||
rgb: true
|
||||
white_value: true
|
||||
xy: true
|
||||
|
||||
Configuration with RGB, brightness, color temp, effect, white value:
|
||||
|
||||
light:
|
||||
platform: mqtt_json
|
||||
name: mqtt_json_light_1
|
||||
state_topic: "home/rgb1"
|
||||
command_topic: "home/rgb1/set"
|
||||
brightness: true
|
||||
color_temp: true
|
||||
effect: true
|
||||
rgb: true
|
||||
white_value: true
|
||||
|
||||
Configuration with RGB, brightness, color temp and effect:
|
||||
|
||||
light:
|
||||
@ -182,7 +168,7 @@ async def test_fail_setup_if_no_command_topic(hass, mqtt_mock_entry_no_yaml_conf
|
||||
assert hass.states.get("light.test") is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize("deprecated", ("color_temp", "hs", "rgb", "white_value", "xy"))
|
||||
@pytest.mark.parametrize("deprecated", ("color_temp", "hs", "rgb", "xy"))
|
||||
async def test_fail_setup_if_color_mode_deprecated(
|
||||
hass, mqtt_mock_entry_no_yaml_config, deprecated
|
||||
):
|
||||
@ -267,10 +253,10 @@ async def test_rgb_light(hass, mqtt_mock_entry_with_yaml_config):
|
||||
assert state.attributes.get(ATTR_SUPPORTED_FEATURES) == expected_features
|
||||
|
||||
|
||||
async def test_no_color_brightness_color_temp_white_val_if_no_topics(
|
||||
async def test_no_color_brightness_color_temp_if_no_topics(
|
||||
hass, mqtt_mock_entry_with_yaml_config
|
||||
):
|
||||
"""Test for no RGB, brightness, color temp, effect, white val or XY."""
|
||||
"""Test for no RGB, brightness, color temp, effector XY."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
light.DOMAIN,
|
||||
@ -295,7 +281,6 @@ async def test_no_color_brightness_color_temp_white_val_if_no_topics(
|
||||
assert state.attributes.get("brightness") is None
|
||||
assert state.attributes.get("color_temp") is None
|
||||
assert state.attributes.get("effect") is None
|
||||
assert state.attributes.get("white_value") is None
|
||||
assert state.attributes.get("xy_color") is None
|
||||
assert state.attributes.get("hs_color") is None
|
||||
|
||||
@ -307,7 +292,6 @@ async def test_no_color_brightness_color_temp_white_val_if_no_topics(
|
||||
assert state.attributes.get("brightness") is None
|
||||
assert state.attributes.get("color_temp") is None
|
||||
assert state.attributes.get("effect") is None
|
||||
assert state.attributes.get("white_value") is None
|
||||
assert state.attributes.get("xy_color") is None
|
||||
assert state.attributes.get("hs_color") is None
|
||||
|
||||
@ -338,7 +322,6 @@ async def test_controlling_state_via_topic(hass, mqtt_mock_entry_with_yaml_confi
|
||||
"color_temp": True,
|
||||
"effect": True,
|
||||
"rgb": True,
|
||||
"white_value": True,
|
||||
"xy": True,
|
||||
"hs": True,
|
||||
"qos": "0",
|
||||
@ -357,19 +340,17 @@ async def test_controlling_state_via_topic(hass, mqtt_mock_entry_with_yaml_confi
|
||||
| light.SUPPORT_EFFECT
|
||||
| light.SUPPORT_FLASH
|
||||
| light.SUPPORT_TRANSITION
|
||||
| light.SUPPORT_WHITE_VALUE
|
||||
)
|
||||
assert state.attributes.get(ATTR_SUPPORTED_FEATURES) == expected_features
|
||||
assert state.attributes.get("rgb_color") is None
|
||||
assert state.attributes.get("brightness") is None
|
||||
assert state.attributes.get("color_temp") is None
|
||||
assert state.attributes.get("effect") is None
|
||||
assert state.attributes.get("white_value") is None
|
||||
assert state.attributes.get("xy_color") is None
|
||||
assert state.attributes.get("hs_color") is None
|
||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||
|
||||
# Turn on the light, full white
|
||||
# Turn on the light
|
||||
async_fire_mqtt_message(
|
||||
hass,
|
||||
"test_light_rgb",
|
||||
@ -377,8 +358,7 @@ async def test_controlling_state_via_topic(hass, mqtt_mock_entry_with_yaml_confi
|
||||
'"color":{"r":255,"g":255,"b":255},'
|
||||
'"brightness":255,'
|
||||
'"color_temp":155,'
|
||||
'"effect":"colorloop",'
|
||||
'"white_value":150}',
|
||||
'"effect":"colorloop"}',
|
||||
)
|
||||
|
||||
state = hass.states.get("light.test")
|
||||
@ -387,7 +367,6 @@ async def test_controlling_state_via_topic(hass, mqtt_mock_entry_with_yaml_confi
|
||||
assert state.attributes.get("brightness") == 255
|
||||
assert state.attributes.get("color_temp") == 155
|
||||
assert state.attributes.get("effect") == "colorloop"
|
||||
assert state.attributes.get("white_value") == 150
|
||||
assert state.attributes.get("xy_color") == (0.323, 0.329)
|
||||
assert state.attributes.get("hs_color") == (0.0, 0.0)
|
||||
|
||||
@ -446,11 +425,6 @@ async def test_controlling_state_via_topic(hass, mqtt_mock_entry_with_yaml_confi
|
||||
light_state = hass.states.get("light.test")
|
||||
assert light_state.attributes.get("effect") == "colorloop"
|
||||
|
||||
async_fire_mqtt_message(hass, "test_light_rgb", '{"state":"ON", "white_value":155}')
|
||||
|
||||
light_state = hass.states.get("light.test")
|
||||
assert light_state.attributes.get("white_value") == 155
|
||||
|
||||
|
||||
async def test_controlling_state_via_topic2(
|
||||
hass, mqtt_mock_entry_with_yaml_config, caplog
|
||||
@ -499,7 +473,6 @@ async def test_controlling_state_via_topic2(
|
||||
assert state.attributes.get("rgbw_color") is None
|
||||
assert state.attributes.get("rgbww_color") is None
|
||||
assert state.attributes.get("supported_color_modes") == supported_color_modes
|
||||
assert state.attributes.get("white_value") is None
|
||||
assert state.attributes.get("xy_color") is None
|
||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||
|
||||
@ -512,8 +485,7 @@ async def test_controlling_state_via_topic2(
|
||||
'"color":{"r":255,"g":128,"b":64, "c": 32, "w": 16, "x": 1, "y": 1},'
|
||||
'"brightness":255,'
|
||||
'"color_temp":155,'
|
||||
'"effect":"colorloop",'
|
||||
'"white_value":150}',
|
||||
'"effect":"colorloop"}',
|
||||
)
|
||||
|
||||
state = hass.states.get("light.test")
|
||||
@ -526,7 +498,6 @@ async def test_controlling_state_via_topic2(
|
||||
assert state.attributes.get("rgb_color") == (255, 136, 74)
|
||||
assert state.attributes.get("rgbw_color") is None
|
||||
assert state.attributes.get("rgbww_color") == (255, 128, 64, 32, 16)
|
||||
assert state.attributes.get("white_value") is None
|
||||
assert state.attributes.get("xy_color") == (0.571, 0.361)
|
||||
|
||||
# Light turned off
|
||||
@ -595,11 +566,6 @@ async def test_controlling_state_via_topic2(
|
||||
state = hass.states.get("light.test")
|
||||
assert state.attributes.get("effect") == "other_effect"
|
||||
|
||||
# White value should be ignored
|
||||
async_fire_mqtt_message(hass, "test_light_rgb", '{"state":"ON", "white_value":155}')
|
||||
state = hass.states.get("light.test")
|
||||
assert state.attributes.get("white_value") is None
|
||||
|
||||
# Invalid color mode
|
||||
async_fire_mqtt_message(
|
||||
hass, "test_light_rgb", '{"state":"ON", "color_mode":"col_temp"}'
|
||||
@ -635,7 +601,6 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
"hs_color": [100, 100],
|
||||
"effect": "random",
|
||||
"color_temp": 100,
|
||||
"white_value": 50,
|
||||
},
|
||||
)
|
||||
|
||||
@ -658,7 +623,6 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
"hs": True,
|
||||
"rgb": True,
|
||||
"xy": True,
|
||||
"white_value": True,
|
||||
"qos": 2,
|
||||
}
|
||||
},
|
||||
@ -672,7 +636,6 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
assert state.attributes.get("hs_color") == (100, 100)
|
||||
assert state.attributes.get("effect") == "random"
|
||||
assert state.attributes.get("color_temp") == 100
|
||||
assert state.attributes.get("white_value") == 50
|
||||
expected_features = (
|
||||
light.SUPPORT_BRIGHTNESS
|
||||
| light.SUPPORT_COLOR
|
||||
@ -680,7 +643,6 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
| light.SUPPORT_EFFECT
|
||||
| light.SUPPORT_FLASH
|
||||
| light.SUPPORT_TRANSITION
|
||||
| light.SUPPORT_WHITE_VALUE
|
||||
)
|
||||
assert state.attributes.get(ATTR_SUPPORTED_FEATURES) == expected_features
|
||||
assert state.attributes.get(ATTR_ASSUMED_STATE)
|
||||
@ -720,9 +682,7 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
hass, "light.test", brightness=50, xy_color=[0.123, 0.123]
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", brightness=50, hs_color=[359, 78])
|
||||
await common.async_turn_on(
|
||||
hass, "light.test", rgb_color=[255, 128, 0], white_value=80
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[255, 128, 0])
|
||||
|
||||
mqtt_mock.async_publish.assert_has_calls(
|
||||
[
|
||||
@ -750,8 +710,7 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
"test_light_rgb/set",
|
||||
JsonValidator(
|
||||
'{"state": "ON", "color": {"r": 255, "g": 128, "b": 0,'
|
||||
' "x": 0.611, "y": 0.375, "h": 30.118, "s": 100.0},'
|
||||
' "white_value": 80}'
|
||||
' "x": 0.611, "y": 0.375, "h": 30.118, "s": 100.0}}'
|
||||
),
|
||||
2,
|
||||
False,
|
||||
@ -765,7 +724,6 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
assert state.attributes["rgb_color"] == (255, 128, 0)
|
||||
assert state.attributes["brightness"] == 50
|
||||
assert state.attributes["hs_color"] == (30.118, 100)
|
||||
assert state.attributes["white_value"] == 80
|
||||
assert state.attributes["xy_color"] == (0.611, 0.375)
|
||||
|
||||
|
||||
@ -783,7 +741,6 @@ async def test_sending_mqtt_commands_and_optimistic2(
|
||||
"color_mode": "rgb",
|
||||
"effect": "random",
|
||||
"hs_color": [100, 100],
|
||||
"white_value": 50,
|
||||
},
|
||||
)
|
||||
|
||||
@ -831,7 +788,6 @@ async def test_sending_mqtt_commands_and_optimistic2(
|
||||
assert state.attributes.get("rgbw_color") is None
|
||||
assert state.attributes.get("rgbww_color") is None
|
||||
assert state.attributes.get("supported_color_modes") == supported_color_modes
|
||||
assert state.attributes.get("white_value") is None
|
||||
assert state.attributes.get("xy_color") is None
|
||||
assert state.attributes.get(ATTR_ASSUMED_STATE)
|
||||
|
||||
@ -876,7 +832,6 @@ async def test_sending_mqtt_commands_and_optimistic2(
|
||||
assert state.attributes["xy_color"] == (0.654, 0.301)
|
||||
assert "rgbw_color" not in state.attributes
|
||||
assert "rgbww_color" not in state.attributes
|
||||
assert "white_value" not in state.attributes
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set",
|
||||
JsonValidator(
|
||||
@ -887,10 +842,8 @@ async def test_sending_mqtt_commands_and_optimistic2(
|
||||
)
|
||||
mqtt_mock.async_publish.reset_mock()
|
||||
|
||||
# Set rgb color, white value should be discarded
|
||||
await common.async_turn_on(
|
||||
hass, "light.test", rgb_color=[255, 128, 0], white_value=80
|
||||
)
|
||||
# Set rgb color
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[255, 128, 0])
|
||||
state = hass.states.get("light.test")
|
||||
assert state.state == STATE_ON
|
||||
assert state.attributes["brightness"] == 75
|
||||
@ -900,7 +853,6 @@ async def test_sending_mqtt_commands_and_optimistic2(
|
||||
assert state.attributes["xy_color"] == (0.611, 0.375)
|
||||
assert "rgbw_color" not in state.attributes
|
||||
assert "rgbww_color" not in state.attributes
|
||||
assert "white_value" not in state.attributes
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set",
|
||||
JsonValidator('{"state": "ON", "color": {"r": 255, "g": 128, "b": 0} }'),
|
||||
@ -910,9 +862,7 @@ async def test_sending_mqtt_commands_and_optimistic2(
|
||||
mqtt_mock.async_publish.reset_mock()
|
||||
|
||||
# Set rgbw color
|
||||
await common.async_turn_on(
|
||||
hass, "light.test", rgbw_color=[255, 128, 0, 123], white_value=80
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", rgbw_color=[255, 128, 0, 123])
|
||||
state = hass.states.get("light.test")
|
||||
assert state.state == STATE_ON
|
||||
assert state.attributes["brightness"] == 75
|
||||
@ -921,7 +871,6 @@ async def test_sending_mqtt_commands_and_optimistic2(
|
||||
assert state.attributes["hs_color"] == (30.0, 67.451)
|
||||
assert state.attributes["rgb_color"] == (255, 169, 83)
|
||||
assert "rgbww_color" not in state.attributes
|
||||
assert "white_value" not in state.attributes
|
||||
assert state.attributes["xy_color"] == (0.526, 0.393)
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set",
|
||||
@ -943,7 +892,6 @@ async def test_sending_mqtt_commands_and_optimistic2(
|
||||
assert state.attributes["hs_color"] == (29.872, 92.157)
|
||||
assert state.attributes["rgb_color"] == (255, 137, 20)
|
||||
assert "rgbw_color" not in state.attributes
|
||||
assert "white_value" not in state.attributes
|
||||
assert state.attributes["xy_color"] == (0.596, 0.382)
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set",
|
||||
@ -968,7 +916,6 @@ async def test_sending_mqtt_commands_and_optimistic2(
|
||||
assert state.attributes["xy_color"] == (0.123, 0.223)
|
||||
assert "rgbw_color" not in state.attributes
|
||||
assert "rgbww_color" not in state.attributes
|
||||
assert "white_value" not in state.attributes
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set",
|
||||
JsonValidator(
|
||||
@ -993,7 +940,6 @@ async def test_sending_hs_color(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"command_topic": "test_light_rgb/set",
|
||||
"brightness": True,
|
||||
"hs": True,
|
||||
"white_value": True,
|
||||
}
|
||||
},
|
||||
)
|
||||
@ -1008,9 +954,7 @@ async def test_sending_hs_color(hass, mqtt_mock_entry_with_yaml_config):
|
||||
hass, "light.test", brightness=50, xy_color=[0.123, 0.123]
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", brightness=50, hs_color=[359, 78])
|
||||
await common.async_turn_on(
|
||||
hass, "light.test", rgb_color=[255, 128, 0], white_value=80
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[255, 128, 0])
|
||||
|
||||
mqtt_mock.async_publish.assert_has_calls(
|
||||
[
|
||||
@ -1034,10 +978,7 @@ async def test_sending_hs_color(hass, mqtt_mock_entry_with_yaml_config):
|
||||
),
|
||||
call(
|
||||
"test_light_rgb/set",
|
||||
JsonValidator(
|
||||
'{"state": "ON", "color": {"h": 30.118, "s": 100.0},'
|
||||
' "white_value": 80}'
|
||||
),
|
||||
JsonValidator('{"state": "ON", "color": {"h": 30.118, "s": 100.0}}'),
|
||||
0,
|
||||
False,
|
||||
),
|
||||
@ -1193,7 +1134,6 @@ async def test_sending_rgb_color_with_brightness(
|
||||
"command_topic": "test_light_rgb/set",
|
||||
"brightness": True,
|
||||
"rgb": True,
|
||||
"white_value": True,
|
||||
}
|
||||
},
|
||||
)
|
||||
@ -1208,9 +1148,7 @@ async def test_sending_rgb_color_with_brightness(
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", brightness=255, hs_color=[359, 78])
|
||||
await common.async_turn_on(hass, "light.test", brightness=1)
|
||||
await common.async_turn_on(
|
||||
hass, "light.test", rgb_color=[255, 128, 0], white_value=80
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[255, 128, 0])
|
||||
|
||||
mqtt_mock.async_publish.assert_has_calls(
|
||||
[
|
||||
@ -1240,10 +1178,7 @@ async def test_sending_rgb_color_with_brightness(
|
||||
),
|
||||
call(
|
||||
"test_light_rgb/set",
|
||||
JsonValidator(
|
||||
'{"state": "ON", "color": {"r": 255, "g": 128, "b": 0},'
|
||||
' "white_value": 80}'
|
||||
),
|
||||
JsonValidator('{"state": "ON", "color": {"r": 255, "g": 128, "b": 0}}'),
|
||||
0,
|
||||
False,
|
||||
),
|
||||
@ -1267,7 +1202,6 @@ async def test_sending_rgb_color_with_scaled_brightness(
|
||||
"brightness": True,
|
||||
"brightness_scale": 100,
|
||||
"rgb": True,
|
||||
"white_value": True,
|
||||
}
|
||||
},
|
||||
)
|
||||
@ -1282,9 +1216,7 @@ async def test_sending_rgb_color_with_scaled_brightness(
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", brightness=255, hs_color=[359, 78])
|
||||
await common.async_turn_on(hass, "light.test", brightness=1)
|
||||
await common.async_turn_on(
|
||||
hass, "light.test", rgb_color=[255, 128, 0], white_value=80
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[255, 128, 0])
|
||||
|
||||
mqtt_mock.async_publish.assert_has_calls(
|
||||
[
|
||||
@ -1314,10 +1246,7 @@ async def test_sending_rgb_color_with_scaled_brightness(
|
||||
),
|
||||
call(
|
||||
"test_light_rgb/set",
|
||||
JsonValidator(
|
||||
'{"state": "ON", "color": {"r": 255, "g": 128, "b": 0},'
|
||||
' "white_value": 80}'
|
||||
),
|
||||
JsonValidator('{"state": "ON", "color": {"r": 255, "g": 128, "b": 0}}'),
|
||||
0,
|
||||
False,
|
||||
),
|
||||
@ -1338,7 +1267,6 @@ async def test_sending_xy_color(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"command_topic": "test_light_rgb/set",
|
||||
"brightness": True,
|
||||
"xy": True,
|
||||
"white_value": True,
|
||||
}
|
||||
},
|
||||
)
|
||||
@ -1352,9 +1280,7 @@ async def test_sending_xy_color(hass, mqtt_mock_entry_with_yaml_config):
|
||||
hass, "light.test", brightness=50, xy_color=[0.123, 0.123]
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", brightness=50, hs_color=[359, 78])
|
||||
await common.async_turn_on(
|
||||
hass, "light.test", rgb_color=[255, 128, 0], white_value=80
|
||||
)
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[255, 128, 0])
|
||||
|
||||
mqtt_mock.async_publish.assert_has_calls(
|
||||
[
|
||||
@ -1378,10 +1304,7 @@ async def test_sending_xy_color(hass, mqtt_mock_entry_with_yaml_config):
|
||||
),
|
||||
call(
|
||||
"test_light_rgb/set",
|
||||
JsonValidator(
|
||||
'{"state": "ON", "color": {"x": 0.611, "y": 0.375},'
|
||||
' "white_value": 80}'
|
||||
),
|
||||
JsonValidator('{"state": "ON", "color": {"x": 0.611, "y": 0.375}}'),
|
||||
0,
|
||||
False,
|
||||
),
|
||||
@ -1605,7 +1528,7 @@ async def test_brightness_scale(hass, mqtt_mock_entry_with_yaml_config):
|
||||
|
||||
|
||||
async def test_invalid_values(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"""Test that invalid color/brightness/white/etc. values are ignored."""
|
||||
"""Test that invalid color/brightness/etc. values are ignored."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
light.DOMAIN,
|
||||
@ -1619,7 +1542,6 @@ async def test_invalid_values(hass, mqtt_mock_entry_with_yaml_config):
|
||||
"brightness": True,
|
||||
"color_temp": True,
|
||||
"rgb": True,
|
||||
"white_value": True,
|
||||
"qos": "0",
|
||||
}
|
||||
},
|
||||
@ -1635,12 +1557,10 @@ async def test_invalid_values(hass, mqtt_mock_entry_with_yaml_config):
|
||||
| light.SUPPORT_COLOR_TEMP
|
||||
| light.SUPPORT_FLASH
|
||||
| light.SUPPORT_TRANSITION
|
||||
| light.SUPPORT_WHITE_VALUE
|
||||
)
|
||||
assert state.attributes.get(ATTR_SUPPORTED_FEATURES) == expected_features
|
||||
assert state.attributes.get("rgb_color") is None
|
||||
assert state.attributes.get("brightness") is None
|
||||
assert state.attributes.get("white_value") is None
|
||||
assert state.attributes.get("color_temp") is None
|
||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||
|
||||
@ -1651,7 +1571,6 @@ async def test_invalid_values(hass, mqtt_mock_entry_with_yaml_config):
|
||||
'{"state":"ON",'
|
||||
'"color":{"r":255,"g":255,"b":255},'
|
||||
'"brightness": 255,'
|
||||
'"white_value": 255,'
|
||||
'"color_temp": 100,'
|
||||
'"effect": "rainbow"}',
|
||||
)
|
||||
@ -1660,7 +1579,6 @@ async def test_invalid_values(hass, mqtt_mock_entry_with_yaml_config):
|
||||
assert state.state == STATE_ON
|
||||
assert state.attributes.get("rgb_color") == (255, 255, 255)
|
||||
assert state.attributes.get("brightness") == 255
|
||||
assert state.attributes.get("white_value") == 255
|
||||
assert state.attributes.get("color_temp") == 100
|
||||
|
||||
# Empty color value
|
||||
@ -1721,16 +1639,6 @@ async def test_invalid_values(hass, mqtt_mock_entry_with_yaml_config):
|
||||
assert state.state == STATE_ON
|
||||
assert state.attributes.get("brightness") == 255
|
||||
|
||||
# Bad white value
|
||||
async_fire_mqtt_message(
|
||||
hass, "test_light_rgb", '{"state":"ON",' '"white_value": "badValue"}'
|
||||
)
|
||||
|
||||
# White value should not have changed
|
||||
state = hass.states.get("light.test")
|
||||
assert state.state == STATE_ON
|
||||
assert state.attributes.get("white_value") == 255
|
||||
|
||||
# Bad color temperature
|
||||
async_fire_mqtt_message(
|
||||
hass, "test_light_rgb", '{"state":"ON",' '"color_temp": "badValue"}'
|
||||
@ -2071,8 +1979,6 @@ async def test_publishing_with_custom_encoding(
|
||||
config = copy.deepcopy(DEFAULT_CONFIG[domain])
|
||||
if topic == "effect_command_topic":
|
||||
config["effect_list"] = ["random", "color_loop"]
|
||||
elif topic == "white_command_topic":
|
||||
config["rgb_command_topic"] = "some-cmd-topic"
|
||||
|
||||
await help_test_publishing_with_custom_encoding(
|
||||
hass,
|
||||
|
Reference in New Issue
Block a user