mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-11-23 12:15:13 +01:00
Add use_vad flag to VA start request (#438)
This commit is contained in:
parent
dc7d13f64a
commit
8340d2a6b8
@ -1424,6 +1424,7 @@ message VoiceAssistantRequest {
|
||||
|
||||
bool start = 1;
|
||||
string conversation_id = 2;
|
||||
bool use_vad = 3;
|
||||
}
|
||||
|
||||
message VoiceAssistantResponse {
|
||||
|
File diff suppressed because one or more lines are too long
@ -1266,7 +1266,7 @@ class APIClient:
|
||||
|
||||
async def subscribe_voice_assistant(
|
||||
self,
|
||||
handle_start: Callable[[str], Coroutine[Any, Any, Optional[int]]],
|
||||
handle_start: Callable[[str, bool], Coroutine[Any, Any, Optional[int]]],
|
||||
handle_stop: Callable[[], Coroutine[Any, Any, None]],
|
||||
) -> Callable[[], None]:
|
||||
"""Subscribes to voice assistant messages from the device.
|
||||
@ -1294,7 +1294,9 @@ class APIClient:
|
||||
def on_msg(msg: VoiceAssistantRequest) -> None:
|
||||
command = VoiceAssistantCommand.from_pb(msg)
|
||||
if command.start:
|
||||
start_task = asyncio.create_task(handle_start(command.conversation_id))
|
||||
start_task = asyncio.create_task(
|
||||
handle_start(command.conversation_id, command.use_vad)
|
||||
)
|
||||
start_task.add_done_callback(_started)
|
||||
# We hold a reference to the start_task in unsub function
|
||||
# so we don't need to add it to the background tasks.
|
||||
|
@ -990,6 +990,7 @@ class BluetoothDeviceRequestType(APIIntEnum):
|
||||
class VoiceAssistantCommand(APIModelBase):
|
||||
start: bool = False
|
||||
conversation_id: str = ""
|
||||
use_vad: bool = False
|
||||
|
||||
|
||||
class LogLevel(APIIntEnum):
|
||||
|
Loading…
Reference in New Issue
Block a user