Fix group platform dependencies (#118499)

This commit is contained in:
Jan Bouwhuis 2024-05-30 19:14:54 +02:00 committed by Paulus Schoutsen
parent 7646d853f4
commit ea44b534e6
2 changed files with 56 additions and 8 deletions

View File

@ -1,6 +1,15 @@
{
"domain": "group",
"name": "Group",
"after_dependencies": [
"alarm_control_panel",
"climate",
"device_tracker",
"person",
"plant",
"vacuum",
"water_heater"
],
"codeowners": ["@home-assistant/core"],
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/group",

View File

@ -1487,28 +1487,67 @@ async def test_group_vacuum_on(hass: HomeAssistant) -> None:
assert hass.states.get("group.group_zero").state == STATE_ON
async def test_device_tracker_not_home(hass: HomeAssistant) -> None:
@pytest.mark.parametrize(
("entity_state_list", "group_state"),
[
(
{
"device_tracker.one": "not_home",
"device_tracker.two": "not_home",
"device_tracker.three": "not_home",
},
"not_home",
),
(
{
"device_tracker.one": "home",
"device_tracker.two": "not_home",
"device_tracker.three": "not_home",
},
"home",
),
(
{
"device_tracker.one": "home",
"device_tracker.two": "elsewhere",
"device_tracker.three": "not_home",
},
"home",
),
(
{
"device_tracker.one": "not_home",
"device_tracker.two": "elsewhere",
"device_tracker.three": "not_home",
},
"not_home",
),
],
)
async def test_device_tracker_or_person_not_home(
hass: HomeAssistant,
entity_state_list: dict[str, str],
group_state: str,
) -> None:
"""Test group of device_tracker not_home."""
await async_setup_component(hass, "device_tracker", {})
await async_setup_component(hass, "person", {})
await hass.async_block_till_done()
hass.states.async_set("device_tracker.one", "not_home")
hass.states.async_set("device_tracker.two", "not_home")
hass.states.async_set("device_tracker.three", "not_home")
for entity_id, state in entity_state_list.items():
hass.states.async_set(entity_id, state)
assert await async_setup_component(
hass,
"group",
{
"group": {
"group_zero": {
"entities": "device_tracker.one, device_tracker.two, device_tracker.three"
},
"group_zero": {"entities": ", ".join(entity_state_list)},
}
},
)
await hass.async_block_till_done()
assert hass.states.get("group.group_zero").state == "not_home"
assert hass.states.get("group.group_zero").state == group_state
async def test_light_removed(hass: HomeAssistant) -> None: