Remove my.ha links from improv (#2695)

This commit is contained in:
Jesse Hills 2021-11-11 15:15:37 +13:00
parent b976ac54c8
commit 38cb988809
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
2 changed files with 9 additions and 4 deletions

View File

@ -11,6 +11,7 @@ namespace esphome {
namespace esp32_improv {
static const char *const TAG = "esp32_improv.component";
static const char *const ESPHOME_MY_LINK = "https://my.home-assistant.io/redirect/config_flow_start?domain=esphome";
ESP32ImprovComponent::ESP32ImprovComponent() { global_improv_component = this; }
@ -124,8 +125,13 @@ void ESP32ImprovComponent::loop() {
this->cancel_timeout("wifi-connect-timeout");
this->set_state_(improv::STATE_PROVISIONED);
std::string url = "https://my.home-assistant.io/redirect/config_flow_start?domain=esphome";
std::vector<uint8_t> data = improv::build_rpc_response(improv::WIFI_SETTINGS, {url});
std::vector<std::string> urls = {ESPHOME_MY_LINK};
#ifdef USE_WEBSERVER
auto ip = wifi::global_wifi_component->wifi_sta_ip();
std::string webserver_url = "http://" + ip.str() + ":" + to_string(WEBSERVER_PORT);
urls.push_back(webserver_url);
#endif
std::vector<uint8_t> data = improv::build_rpc_response(improv::WIFI_SETTINGS, urls);
this->send_response_(data);
this->set_timeout("end-service", 1000, [this] {
this->service_->stop();

View File

@ -92,8 +92,7 @@ void ImprovSerialComponent::loop() {
}
std::vector<uint8_t> ImprovSerialComponent::build_rpc_settings_response_(improv::Command command) {
std::string url = "https://my.home-assistant.io/redirect/config_flow_start?domain=esphome";
std::vector<std::string> urls = {url};
std::vector<std::string> urls;
#ifdef USE_WEBSERVER
auto ip = wifi::global_wifi_component->wifi_sta_ip();
std::string webserver_url = "http://" + ip.str() + ":" + to_string(WEBSERVER_PORT);