mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Add required domain to vacuum intents (#133166)
This commit is contained in:
parent
3a622218f4
commit
308200781f
@ -18,6 +18,7 @@ async def async_setup_intents(hass: HomeAssistant) -> None:
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_START,
|
SERVICE_START,
|
||||||
description="Starts a vacuum",
|
description="Starts a vacuum",
|
||||||
|
required_domains={DOMAIN},
|
||||||
platforms={DOMAIN},
|
platforms={DOMAIN},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -28,6 +29,7 @@ async def async_setup_intents(hass: HomeAssistant) -> None:
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_RETURN_TO_BASE,
|
SERVICE_RETURN_TO_BASE,
|
||||||
description="Returns a vacuum to base",
|
description="Returns a vacuum to base",
|
||||||
|
required_domains={DOMAIN},
|
||||||
platforms={DOMAIN},
|
platforms={DOMAIN},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -37,6 +37,27 @@ async def test_start_vacuum_intent(hass: HomeAssistant) -> None:
|
|||||||
assert call.data == {"entity_id": entity_id}
|
assert call.data == {"entity_id": entity_id}
|
||||||
|
|
||||||
|
|
||||||
|
async def test_start_vacuum_without_name(hass: HomeAssistant) -> None:
|
||||||
|
"""Test starting a vacuum without specifying the name."""
|
||||||
|
await vacuum_intent.async_setup_intents(hass)
|
||||||
|
|
||||||
|
entity_id = f"{DOMAIN}.test_vacuum"
|
||||||
|
hass.states.async_set(entity_id, STATE_IDLE)
|
||||||
|
calls = async_mock_service(hass, DOMAIN, SERVICE_START)
|
||||||
|
|
||||||
|
response = await intent.async_handle(
|
||||||
|
hass, "test", vacuum_intent.INTENT_VACUUM_START, {}
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
assert response.response_type == intent.IntentResponseType.ACTION_DONE
|
||||||
|
assert len(calls) == 1
|
||||||
|
call = calls[0]
|
||||||
|
assert call.domain == DOMAIN
|
||||||
|
assert call.service == SERVICE_START
|
||||||
|
assert call.data == {"entity_id": entity_id}
|
||||||
|
|
||||||
|
|
||||||
async def test_stop_vacuum_intent(hass: HomeAssistant) -> None:
|
async def test_stop_vacuum_intent(hass: HomeAssistant) -> None:
|
||||||
"""Test HassTurnOff intent for vacuums."""
|
"""Test HassTurnOff intent for vacuums."""
|
||||||
await vacuum_intent.async_setup_intents(hass)
|
await vacuum_intent.async_setup_intents(hass)
|
||||||
@ -59,3 +80,24 @@ async def test_stop_vacuum_intent(hass: HomeAssistant) -> None:
|
|||||||
assert call.domain == DOMAIN
|
assert call.domain == DOMAIN
|
||||||
assert call.service == SERVICE_RETURN_TO_BASE
|
assert call.service == SERVICE_RETURN_TO_BASE
|
||||||
assert call.data == {"entity_id": entity_id}
|
assert call.data == {"entity_id": entity_id}
|
||||||
|
|
||||||
|
|
||||||
|
async def test_stop_vacuum_without_name(hass: HomeAssistant) -> None:
|
||||||
|
"""Test stopping a vacuum without specifying the name."""
|
||||||
|
await vacuum_intent.async_setup_intents(hass)
|
||||||
|
|
||||||
|
entity_id = f"{DOMAIN}.test_vacuum"
|
||||||
|
hass.states.async_set(entity_id, STATE_IDLE)
|
||||||
|
calls = async_mock_service(hass, DOMAIN, SERVICE_RETURN_TO_BASE)
|
||||||
|
|
||||||
|
response = await intent.async_handle(
|
||||||
|
hass, "test", vacuum_intent.INTENT_VACUUM_RETURN_TO_BASE, {}
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
assert response.response_type == intent.IntentResponseType.ACTION_DONE
|
||||||
|
assert len(calls) == 1
|
||||||
|
call = calls[0]
|
||||||
|
assert call.domain == DOMAIN
|
||||||
|
assert call.service == SERVICE_RETURN_TO_BASE
|
||||||
|
assert call.data == {"entity_id": entity_id}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user