1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00

Add voice assistant methods for configuration (#7459)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Michael Hansen
2024-09-17 18:38:39 -05:00
committed by GitHub
parent cb86749545
commit 5a3e1d5792
8 changed files with 119 additions and 33 deletions

View File

@@ -77,6 +77,18 @@ struct Timer {
}
};
struct WakeWord {
std::string id;
std::string wake_word;
std::vector<std::string> trained_languages;
};
struct Configuration {
std::vector<WakeWord> available_wake_words;
std::vector<std::string> active_wake_words;
uint32_t max_active_wake_words;
};
class VoiceAssistant : public Component {
public:
void setup() override;
@@ -133,6 +145,8 @@ class VoiceAssistant : public Component {
void on_audio(const api::VoiceAssistantAudio &msg);
void on_timer_event(const api::VoiceAssistantTimerEventResponse &msg);
void on_announce(const api::VoiceAssistantAnnounceRequest &msg);
void on_set_configuration(const std::vector<std::string> &active_wake_words){};
const Configuration &get_configuration() { return this->config_; };
bool is_running() const { return this->state_ != State::IDLE; }
void set_continuous(bool continuous) { this->continuous_ = continuous; }
@@ -279,6 +293,8 @@ class VoiceAssistant : public Component {
AudioMode audio_mode_{AUDIO_MODE_UDP};
bool udp_socket_running_{false};
bool start_udp_socket_();
Configuration config_{};
};
template<typename... Ts> class StartAction : public Action<Ts...>, public Parented<VoiceAssistant> {