mirror of
https://github.com/esphome/esphome.git
synced 2025-02-19 11:28:18 +00:00
* Add push to talk voice assistant * Refactor most code into voice_assistant * Make voice_assistant the component and remove push_to_talk (can be done in yaml) * Fix component setup * Always AF_INET to match serverside * Fix microphone and media player co-existence * Format * Update codeowners * Update test file * Fix endifs * nullptr not NULL * clang-tidy * Format * fixup: Add VA event data * Generate proto * Parse and log events * Add default to switch * Fix * Add mic/va to test5
33 lines
765 B
C++
33 lines
765 B
C++
#include "improv_base.h"
|
|
|
|
#include "esphome/components/network/util.h"
|
|
#include "esphome/core/application.h"
|
|
|
|
namespace esphome {
|
|
namespace improv_base {
|
|
|
|
std::string ImprovBase::get_formatted_next_url_() {
|
|
if (this->next_url_.empty()) {
|
|
return "";
|
|
}
|
|
std::string copy = this->next_url_;
|
|
// Device name
|
|
std::size_t pos = this->next_url_.find("{{device_name}}");
|
|
if (pos != std::string::npos) {
|
|
const std::string &device_name = App.get_name();
|
|
copy.replace(pos, 15, device_name);
|
|
}
|
|
|
|
// Ip address
|
|
pos = this->next_url_.find("{{ip_address}}");
|
|
if (pos != std::string::npos) {
|
|
std::string ip = network::get_ip_address().str();
|
|
copy.replace(pos, 14, ip);
|
|
}
|
|
|
|
return copy;
|
|
}
|
|
|
|
} // namespace improv_base
|
|
} // namespace esphome
|