mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2025-01-25 22:12:28 +01:00
Add wake word capability to voice assistant (#519)
This commit is contained in:
parent
53074cfd3c
commit
2c7b2ed1a0
@ -1445,7 +1445,7 @@ message VoiceAssistantRequest {
|
||||
|
||||
bool start = 1;
|
||||
string conversation_id = 2;
|
||||
bool use_vad = 3;
|
||||
int32 flags = 3;
|
||||
}
|
||||
|
||||
message VoiceAssistantResponse {
|
||||
@ -1467,6 +1467,8 @@ enum VoiceAssistantEvent {
|
||||
VOICE_ASSISTANT_INTENT_END = 6;
|
||||
VOICE_ASSISTANT_TTS_START = 7;
|
||||
VOICE_ASSISTANT_TTS_END = 8;
|
||||
VOICE_ASSISTANT_WAKE_WORD_START = 9;
|
||||
VOICE_ASSISTANT_WAKE_WORD_END = 10;
|
||||
}
|
||||
|
||||
message VoiceAssistantEventData {
|
||||
|
File diff suppressed because one or more lines are too long
@ -1342,7 +1342,7 @@ class APIClient:
|
||||
|
||||
async def subscribe_voice_assistant(
|
||||
self,
|
||||
handle_start: Callable[[str, bool], Coroutine[Any, Any, int | None]],
|
||||
handle_start: Callable[[str, int], Coroutine[Any, Any, int | None]],
|
||||
handle_stop: Callable[[], Coroutine[Any, Any, None]],
|
||||
) -> Callable[[], None]:
|
||||
"""Subscribes to voice assistant messages from the device.
|
||||
@ -1371,7 +1371,7 @@ class APIClient:
|
||||
command = VoiceAssistantCommand.from_pb(msg)
|
||||
if command.start:
|
||||
start_task = asyncio.create_task(
|
||||
handle_start(command.conversation_id, command.use_vad)
|
||||
handle_start(command.conversation_id, command.flags)
|
||||
)
|
||||
start_task.add_done_callback(_started)
|
||||
# We hold a reference to the start_task in unsub function
|
||||
|
@ -1063,11 +1063,16 @@ class BluetoothDeviceRequestType(APIIntEnum):
|
||||
CLEAR_CACHE = 6
|
||||
|
||||
|
||||
class VoiceAssistantCommandFlag(enum.IntFlag):
|
||||
USE_VAD = 1 << 0
|
||||
USE_WAKE_WORD = 1 << 1
|
||||
|
||||
|
||||
@_frozen_dataclass_decorator
|
||||
class VoiceAssistantCommand(APIModelBase):
|
||||
start: bool = False
|
||||
conversation_id: str = ""
|
||||
use_vad: bool = False
|
||||
flags: int = False
|
||||
|
||||
|
||||
class LogLevel(APIIntEnum):
|
||||
@ -1091,3 +1096,5 @@ class VoiceAssistantEventType(APIIntEnum):
|
||||
VOICE_ASSISTANT_INTENT_END = 6
|
||||
VOICE_ASSISTANT_TTS_START = 7
|
||||
VOICE_ASSISTANT_TTS_END = 8
|
||||
VOICE_ASSISTANT_WAKE_WORD_START = 9
|
||||
VOICE_ASSISTANT_WAKE_WORD_END = 10
|
||||
|
Loading…
Reference in New Issue
Block a user