mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-26 17:27:40 +01:00
Add conversation_id to VA start request (#437)
This commit is contained in:
parent
8a661bb673
commit
b1bfabacc7
@ -1423,6 +1423,7 @@ message VoiceAssistantRequest {
|
||||
option (ifdef) = "USE_VOICE_ASSISTANT";
|
||||
|
||||
bool start = 1;
|
||||
string conversation_id = 2;
|
||||
}
|
||||
|
||||
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[[], Coroutine[Any, Any, Optional[int]]],
|
||||
handle_start: Callable[[str], 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,7 @@ class APIClient:
|
||||
def on_msg(msg: VoiceAssistantRequest) -> None:
|
||||
command = VoiceAssistantCommand.from_pb(msg)
|
||||
if command.start:
|
||||
start_task = asyncio.create_task(handle_start())
|
||||
start_task = asyncio.create_task(handle_start(command.conversation_id))
|
||||
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.
|
||||
|
@ -989,6 +989,7 @@ class BluetoothDeviceRequestType(APIIntEnum):
|
||||
@dataclass(frozen=True)
|
||||
class VoiceAssistantCommand(APIModelBase):
|
||||
start: bool = False
|
||||
conversation_id: str = ""
|
||||
|
||||
|
||||
class LogLevel(APIIntEnum):
|
||||
|
Loading…
Reference in New Issue
Block a user