1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-03 03:42:20 +01:00

Added an option to disable mDNS (#1716)

* Added an option to disable mDNS

* Fixed linter issues

* Moved the enable_mdns option to WiFi and Ethernet components

* extracted common method for add mdns library

* lint

Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
Farzad E
2021-05-06 08:31:42 -07:00
committed by GitHub
parent f7232b199a
commit 2225594ee8
13 changed files with 45 additions and 15 deletions

View File

@@ -62,7 +62,7 @@ void WiFiComponent::setup() {
}
this->wifi_apply_hostname_();
#ifdef ARDUINO_ARCH_ESP32
#if defined(ARDUINO_ARCH_ESP32) && defined(USE_MDNS)
network_setup_mdns();
#endif
}
@@ -171,7 +171,7 @@ void WiFiComponent::setup_ap_config_() {
this->ap_setup_ = this->wifi_start_ap_(this->ap_);
ESP_LOGCONFIG(TAG, " IP Address: %s", this->wifi_soft_ap_ip().toString().c_str());
#ifdef ARDUINO_ARCH_ESP8266
#if defined(ARDUINO_ARCH_ESP8266) && defined(USE_MDNS)
network_setup_mdns(this->wifi_soft_ap_ip(), 1);
#endif
@@ -466,7 +466,7 @@ void WiFiComponent::check_connecting_finished() {
ESP_LOGD(TAG, "Disabling AP...");
this->wifi_mode_({}, false);
}
#ifdef ARDUINO_ARCH_ESP8266
#if defined(ARDUINO_ARCH_ESP8266) && defined(USE_MDNS)
network_setup_mdns(this->wifi_sta_ip_(), 0);
#endif
this->state_ = WIFI_COMPONENT_STATE_STA_CONNECTED;