mirror of
https://github.com/esphome/esphome.git
synced 2024-12-25 17:07:50 +01:00
Remove my.ha links from improv (#2695)
This commit is contained in:
parent
bb9793d5b7
commit
f11220da3a
esphome/components
@ -11,6 +11,7 @@ namespace esphome {
|
|||||||
namespace esp32_improv {
|
namespace esp32_improv {
|
||||||
|
|
||||||
static const char *const TAG = "esp32_improv.component";
|
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; }
|
ESP32ImprovComponent::ESP32ImprovComponent() { global_improv_component = this; }
|
||||||
|
|
||||||
@ -124,8 +125,13 @@ void ESP32ImprovComponent::loop() {
|
|||||||
this->cancel_timeout("wifi-connect-timeout");
|
this->cancel_timeout("wifi-connect-timeout");
|
||||||
this->set_state_(improv::STATE_PROVISIONED);
|
this->set_state_(improv::STATE_PROVISIONED);
|
||||||
|
|
||||||
std::string url = "https://my.home-assistant.io/redirect/config_flow_start?domain=esphome";
|
std::vector<std::string> urls = {ESPHOME_MY_LINK};
|
||||||
std::vector<uint8_t> data = improv::build_rpc_response(improv::WIFI_SETTINGS, {url});
|
#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->send_response_(data);
|
||||||
this->set_timeout("end-service", 1000, [this] {
|
this->set_timeout("end-service", 1000, [this] {
|
||||||
this->service_->stop();
|
this->service_->stop();
|
||||||
|
@ -92,8 +92,7 @@ void ImprovSerialComponent::loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint8_t> ImprovSerialComponent::build_rpc_settings_response_(improv::Command command) {
|
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;
|
||||||
std::vector<std::string> urls = {url};
|
|
||||||
#ifdef USE_WEBSERVER
|
#ifdef USE_WEBSERVER
|
||||||
auto ip = wifi::global_wifi_component->wifi_sta_ip();
|
auto ip = wifi::global_wifi_component->wifi_sta_ip();
|
||||||
std::string webserver_url = "http://" + ip.str() + ":" + to_string(WEBSERVER_PORT);
|
std::string webserver_url = "http://" + ip.str() + ":" + to_string(WEBSERVER_PORT);
|
||||||
|
Loading…
Reference in New Issue
Block a user