mirror of
https://github.com/esphome/esphome.git
synced 2025-09-04 20:32:21 +01:00
Add voice assistant methods for configuration (#7459)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -7124,18 +7124,12 @@ void VoiceAssistantAnnounceFinished::dump_to(std::string &out) const {
|
||||
out.append("}");
|
||||
}
|
||||
#endif
|
||||
bool VoiceAssistantWakeWord::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||
switch (field_id) {
|
||||
case 1: {
|
||||
this->id = value.as_uint32();
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bool VoiceAssistantWakeWord::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
|
||||
switch (field_id) {
|
||||
case 1: {
|
||||
this->id = value.as_string();
|
||||
return true;
|
||||
}
|
||||
case 2: {
|
||||
this->wake_word = value.as_string();
|
||||
return true;
|
||||
@@ -7149,7 +7143,7 @@ bool VoiceAssistantWakeWord::decode_length(uint32_t field_id, ProtoLengthDelimit
|
||||
}
|
||||
}
|
||||
void VoiceAssistantWakeWord::encode(ProtoWriteBuffer buffer) const {
|
||||
buffer.encode_uint32(1, this->id);
|
||||
buffer.encode_string(1, this->id);
|
||||
buffer.encode_string(2, this->wake_word);
|
||||
for (auto &it : this->trained_languages) {
|
||||
buffer.encode_string(3, it, true);
|
||||
@@ -7160,8 +7154,7 @@ void VoiceAssistantWakeWord::dump_to(std::string &out) const {
|
||||
__attribute__((unused)) char buffer[64];
|
||||
out.append("VoiceAssistantWakeWord {\n");
|
||||
out.append(" id: ");
|
||||
sprintf(buffer, "%" PRIu32, this->id);
|
||||
out.append(buffer);
|
||||
out.append("'").append(this->id).append("'");
|
||||
out.append("\n");
|
||||
|
||||
out.append(" wake_word: ");
|
||||
@@ -7184,10 +7177,6 @@ void VoiceAssistantConfigurationRequest::dump_to(std::string &out) const {
|
||||
#endif
|
||||
bool VoiceAssistantConfigurationResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||
switch (field_id) {
|
||||
case 2: {
|
||||
this->active_wake_words.push_back(value.as_uint32());
|
||||
return true;
|
||||
}
|
||||
case 3: {
|
||||
this->max_active_wake_words = value.as_uint32();
|
||||
return true;
|
||||
@@ -7202,6 +7191,10 @@ bool VoiceAssistantConfigurationResponse::decode_length(uint32_t field_id, Proto
|
||||
this->available_wake_words.push_back(value.as_message<VoiceAssistantWakeWord>());
|
||||
return true;
|
||||
}
|
||||
case 2: {
|
||||
this->active_wake_words.push_back(value.as_string());
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -7211,7 +7204,7 @@ void VoiceAssistantConfigurationResponse::encode(ProtoWriteBuffer buffer) const
|
||||
buffer.encode_message<VoiceAssistantWakeWord>(1, it, true);
|
||||
}
|
||||
for (auto &it : this->active_wake_words) {
|
||||
buffer.encode_uint32(2, it, true);
|
||||
buffer.encode_string(2, it, true);
|
||||
}
|
||||
buffer.encode_uint32(3, this->max_active_wake_words);
|
||||
}
|
||||
@@ -7227,8 +7220,7 @@ void VoiceAssistantConfigurationResponse::dump_to(std::string &out) const {
|
||||
|
||||
for (const auto &it : this->active_wake_words) {
|
||||
out.append(" active_wake_words: ");
|
||||
sprintf(buffer, "%" PRIu32, it);
|
||||
out.append(buffer);
|
||||
out.append("'").append(it).append("'");
|
||||
out.append("\n");
|
||||
}
|
||||
|
||||
@@ -7239,10 +7231,10 @@ void VoiceAssistantConfigurationResponse::dump_to(std::string &out) const {
|
||||
out.append("}");
|
||||
}
|
||||
#endif
|
||||
bool VoiceAssistantSetConfiguration::decode_varint(uint32_t field_id, ProtoVarInt value) {
|
||||
bool VoiceAssistantSetConfiguration::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
|
||||
switch (field_id) {
|
||||
case 1: {
|
||||
this->active_wake_words.push_back(value.as_uint32());
|
||||
this->active_wake_words.push_back(value.as_string());
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
@@ -7251,7 +7243,7 @@ bool VoiceAssistantSetConfiguration::decode_varint(uint32_t field_id, ProtoVarIn
|
||||
}
|
||||
void VoiceAssistantSetConfiguration::encode(ProtoWriteBuffer buffer) const {
|
||||
for (auto &it : this->active_wake_words) {
|
||||
buffer.encode_uint32(1, it, true);
|
||||
buffer.encode_string(1, it, true);
|
||||
}
|
||||
}
|
||||
#ifdef HAS_PROTO_MESSAGE_DUMP
|
||||
@@ -7260,8 +7252,7 @@ void VoiceAssistantSetConfiguration::dump_to(std::string &out) const {
|
||||
out.append("VoiceAssistantSetConfiguration {\n");
|
||||
for (const auto &it : this->active_wake_words) {
|
||||
out.append(" active_wake_words: ");
|
||||
sprintf(buffer, "%" PRIu32, it);
|
||||
out.append(buffer);
|
||||
out.append("'").append(it).append("'");
|
||||
out.append("\n");
|
||||
}
|
||||
out.append("}");
|
||||
|
Reference in New Issue
Block a user