Skip to content

Commit

Permalink
Add VoiceAssistantAnnounce
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Aug 29, 2024
1 parent 1c16555 commit 82f204f
Show file tree
Hide file tree
Showing 6 changed files with 1,428 additions and 168 deletions.
28 changes: 2 additions & 26 deletions aioesphomeapi/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,6 @@ message VoiceAssistantRequest {
uint32 flags = 3;
VoiceAssistantAudioSettings audio_settings = 4;
string wake_word_phrase = 5;
VoiceAssistantPipelineRunConfig run_config = 6;
}

message VoiceAssistantResponse {
Expand Down Expand Up @@ -1571,35 +1570,12 @@ message VoiceAssistantTimerEventResponse {
bool is_active = 6;
}

message VoiceAssistantTriggerPipeline {
message VoiceAssistantAnnounce {
option (id) = 120;
option (source) = SOURCE_SERVER;
option (ifdef) = "USE_VOICE_ASSISTANT";

VoiceAssistantPipelineRunConfig run_config = 1;
}

message VoiceAssistantSetConfiguration {
option (id) = 121;
option (source) = SOURCE_SERVER;
option (ifdef) = "USE_VOICE_ASSISTANT";

repeated string active_wake_words = 1;
}

message VoiceAssistantAvailableWakeWord {
string wake_word = 1;
bool is_active = 2;
repeated string trained_languages = 3;
}

message VoiceAssistantConfiguration {
option (id) = 122;
option (source) = SOURCE_CLIENT;
option (ifdef) = "USE_VOICE_ASSISTANT";

repeated VoiceAssistantAvailableWakeWord available_wake_words = 1;
uint32 max_active_wake_words = 2;
string media_id = 1;
}

// ==================== ALARM CONTROL PANEL ====================
Expand Down
35 changes: 32 additions & 3 deletions aioesphomeapi/api_options_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,523 changes: 1,384 additions & 139 deletions aioesphomeapi/api_pb2.py

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions aioesphomeapi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
VoiceAssistantRequest,
VoiceAssistantResponse,
VoiceAssistantTimerEventResponse,
VoiceAssistantAnnounce,
)
from .client_callbacks import (
on_bluetooth_connections_free_response,
Expand Down Expand Up @@ -1417,6 +1418,12 @@ def send_voice_assistant_timer_event(
)
self._get_connection().send_message(req)

def send_voice_assistant_announce(self, media_id: str) -> None:
req = VoiceAssistantAnnounce(
media_id=media_id,
)
self._get_connection().send_message(req)

def alarm_control_panel_command(
self,
key: int,
Expand Down
2 changes: 2 additions & 0 deletions aioesphomeapi/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
VoiceAssistantRequest,
VoiceAssistantResponse,
VoiceAssistantTimerEventResponse,
VoiceAssistantAnnounce,
)

TWO_CHAR = re.compile(r".{2}")
Expand Down Expand Up @@ -392,4 +393,5 @@ def __init__(self, error: BluetoothGATTError) -> None:
116: ListEntitiesUpdateResponse,
117: UpdateStateResponse,
118: UpdateCommandRequest,
120: VoiceAssistantAnnounce,
}
1 change: 1 addition & 0 deletions aioesphomeapi/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class VoiceAssistantFeature(enum.IntFlag):
SPEAKER = 1 << 1
API_AUDIO = 1 << 2
TIMERS = 1 << 3
ANNOUNCE = 1 << 4


class VoiceAssistantSubscriptionFlag(enum.IntFlag):
Expand Down

0 comments on commit 82f204f

Please sign in to comment.