Add nested light group test (#41764)
parent
9877e8e25b
commit
64d3cdfb41
|
@ -764,5 +764,41 @@ async def test_reload_with_base_integration_platform_not_setup(hass):
|
||||||
assert hass.states.get("light.outside_patio_lights_g").state == STATE_OFF
|
assert hass.states.get("light.outside_patio_lights_g").state == STATE_OFF
|
||||||
|
|
||||||
|
|
||||||
|
async def test_nested_group(hass):
|
||||||
|
"""Test nested light group."""
|
||||||
|
hass.states.async_set("light.kitchen", "on")
|
||||||
|
await async_setup_component(
|
||||||
|
hass,
|
||||||
|
LIGHT_DOMAIN,
|
||||||
|
{
|
||||||
|
LIGHT_DOMAIN: [
|
||||||
|
{
|
||||||
|
"platform": DOMAIN,
|
||||||
|
"entities": ["light.bedroom_group"],
|
||||||
|
"name": "Nested Group",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"platform": DOMAIN,
|
||||||
|
"entities": ["light.kitchen", "light.bedroom"],
|
||||||
|
"name": "Bedroom Group",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
await hass.async_start()
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
state = hass.states.get("light.bedroom_group")
|
||||||
|
assert state is not None
|
||||||
|
assert state.state == STATE_ON
|
||||||
|
assert state.attributes.get(ATTR_ENTITY_ID) == ["light.kitchen", "light.bedroom"]
|
||||||
|
|
||||||
|
state = hass.states.get("light.nested_group")
|
||||||
|
assert state is not None
|
||||||
|
assert state.state == STATE_ON
|
||||||
|
assert state.attributes.get(ATTR_ENTITY_ID) == ["light.bedroom_group"]
|
||||||
|
|
||||||
|
|
||||||
def _get_fixtures_base_path():
|
def _get_fixtures_base_path():
|
||||||
return path.dirname(path.dirname(path.dirname(__file__)))
|
return path.dirname(path.dirname(path.dirname(__file__)))
|
||||||
|
|
Loading…
Reference in New Issue