1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Flag brightness support for MQTT RGB lights (#48718)

This commit is contained in:
Erik Montnemery
2021-04-06 12:39:29 +02:00
committed by GitHub
parent b57d02d786
commit 9f2fb37e17
5 changed files with 90 additions and 3 deletions

View File

@@ -188,6 +188,33 @@ async def test_fail_setup_if_color_mode_deprecated(hass, mqtt_mock, deprecated):
assert hass.states.get("light.test") is None
async def test_rgb_light(hass, mqtt_mock):
"""Test RGB light flags brightness support."""
assert await async_setup_component(
hass,
light.DOMAIN,
{
light.DOMAIN: {
"platform": "mqtt",
"schema": "json",
"name": "test",
"command_topic": "test_light_rgb/set",
"rgb": True,
}
},
)
await hass.async_block_till_done()
state = hass.states.get("light.test")
expected_features = (
light.SUPPORT_TRANSITION
| light.SUPPORT_COLOR
| light.SUPPORT_FLASH
| light.SUPPORT_BRIGHTNESS
)
assert state.attributes.get(ATTR_SUPPORTED_FEATURES) == expected_features
async def test_no_color_brightness_color_temp_white_val_if_no_topics(hass, mqtt_mock):
"""Test for no RGB, brightness, color temp, effect, white val or XY."""
assert await async_setup_component(