mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Set assist_satellite preannounce default to True (#148060)
This commit is contained in:
parent
6a88ee7a8f
commit
4e71745c62
@ -72,7 +72,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
{
|
||||
vol.Optional("message"): str,
|
||||
vol.Optional("media_id"): _media_id_validator,
|
||||
vol.Optional("preannounce"): bool,
|
||||
vol.Optional("preannounce", default=True): bool,
|
||||
vol.Optional("preannounce_media_id"): _media_id_validator,
|
||||
}
|
||||
),
|
||||
@ -89,7 +89,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
{
|
||||
vol.Optional("start_message"): str,
|
||||
vol.Optional("start_media_id"): _media_id_validator,
|
||||
vol.Optional("preannounce"): bool,
|
||||
vol.Optional("preannounce", default=True): bool,
|
||||
vol.Optional("preannounce_media_id"): _media_id_validator,
|
||||
vol.Optional("extra_system_prompt"): str,
|
||||
}
|
||||
@ -114,7 +114,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
ask_question_args = {
|
||||
"question": call.data.get("question"),
|
||||
"question_media_id": call.data.get("question_media_id"),
|
||||
"preannounce": call.data.get("preannounce", False),
|
||||
"preannounce": call.data.get("preannounce", True),
|
||||
"answers": call.data.get("answers"),
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
vol.Required(ATTR_ENTITY_ID): cv.entity_domain(DOMAIN),
|
||||
vol.Optional("question"): str,
|
||||
vol.Optional("question_media_id"): _media_id_validator,
|
||||
vol.Optional("preannounce"): bool,
|
||||
vol.Optional("preannounce", default=True): bool,
|
||||
vol.Optional("preannounce_media_id"): _media_id_validator,
|
||||
vol.Optional("answers"): [
|
||||
{
|
||||
|
@ -793,12 +793,19 @@ async def test_start_conversation_default_preannounce(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("service_data", "response_text", "expected_answer"),
|
||||
("service_data", "response_text", "expected_answer", "should_preannounce"),
|
||||
[
|
||||
(
|
||||
{},
|
||||
"jazz",
|
||||
AssistSatelliteAnswer(id=None, sentence="jazz"),
|
||||
True,
|
||||
),
|
||||
(
|
||||
{"preannounce": False},
|
||||
"jazz",
|
||||
AssistSatelliteAnswer(id=None, sentence="jazz"),
|
||||
False,
|
||||
),
|
||||
(
|
||||
{
|
||||
@ -810,6 +817,7 @@ async def test_start_conversation_default_preannounce(
|
||||
},
|
||||
"Some Rock, please.",
|
||||
AssistSatelliteAnswer(id="rock", sentence="Some Rock, please."),
|
||||
False,
|
||||
),
|
||||
(
|
||||
{
|
||||
@ -827,7 +835,7 @@ async def test_start_conversation_default_preannounce(
|
||||
"sentences": ["artist {artist} [please]"],
|
||||
},
|
||||
],
|
||||
"preannounce": False,
|
||||
"preannounce": True,
|
||||
},
|
||||
"artist Pink Floyd",
|
||||
AssistSatelliteAnswer(
|
||||
@ -835,6 +843,7 @@ async def test_start_conversation_default_preannounce(
|
||||
sentence="artist Pink Floyd",
|
||||
slots={"artist": "Pink Floyd"},
|
||||
),
|
||||
True,
|
||||
),
|
||||
],
|
||||
)
|
||||
@ -845,6 +854,7 @@ async def test_ask_question(
|
||||
service_data: dict,
|
||||
response_text: str,
|
||||
expected_answer: AssistSatelliteAnswer,
|
||||
should_preannounce: bool,
|
||||
) -> None:
|
||||
"""Test asking a question on a device and matching an answer."""
|
||||
entity_id = "assist_satellite.test_entity"
|
||||
@ -868,6 +878,9 @@ async def test_ask_question(
|
||||
async def async_start_conversation(start_announcement):
|
||||
# Verify state change
|
||||
assert entity.state == AssistSatelliteState.RESPONDING
|
||||
assert (
|
||||
start_announcement.preannounce_media_id is not None
|
||||
) is should_preannounce
|
||||
await original_start_conversation(start_announcement)
|
||||
|
||||
audio_stream = object()
|
||||
|
Loading…
x
Reference in New Issue
Block a user