From f6244c197dcd1d9b48f7bf92e8c2b09b495850ef Mon Sep 17 00:00:00 2001 From: touchgadget Date: Fri, 11 Jun 2021 14:19:17 -0700 Subject: [PATCH 1/3] Fix MDNS --- examples/IRMQTTServer/IRMQTTServer.ino | 3 +++ examples/IRServer/IRServer.ino | 3 +++ 2 files changed, 6 insertions(+) diff --git a/examples/IRMQTTServer/IRMQTTServer.ino b/examples/IRMQTTServer/IRMQTTServer.ino index fcb5ea034..294f8ae1c 100644 --- a/examples/IRMQTTServer/IRMQTTServer.ino +++ b/examples/IRMQTTServer/IRMQTTServer.ino @@ -2143,6 +2143,8 @@ void setup(void) { if (mdns.begin(Hostname)) { #endif // ESP8266 debug("MDNS responder started"); + // Announce esp tcp service on port 8080 + mdns.addService("esp", "tcp", 8080); } #endif // MDNS_ENABLE @@ -2591,6 +2593,7 @@ void sendMQTTDiscovery(const char *topic) { #endif // MQTT_ENABLE void loop(void) { + mdns.update(); server.handleClient(); // Handle any web activity #if MQTT_ENABLE diff --git a/examples/IRServer/IRServer.ino b/examples/IRServer/IRServer.ino index c585847ad..9d9b92f98 100644 --- a/examples/IRServer/IRServer.ino +++ b/examples/IRServer/IRServer.ino @@ -132,6 +132,8 @@ void setup(void) { if (mdns.begin(HOSTNAME)) { #endif // ESP8266 Serial.println("MDNS responder started"); + // Announce esp tcp service on port 8080 + mdns.addService("esp", "tcp", 8080); } server.on("/", handleRoot); @@ -148,5 +150,6 @@ void setup(void) { } void loop(void) { + mdns.update(); server.handleClient(); } From 37b2fe40035362244b0ab8ff0b949e026b8311f1 Mon Sep 17 00:00:00 2001 From: touchgadget Date: Fri, 11 Jun 2021 16:42:05 -0700 Subject: [PATCH 2/3] Add MDNS conditional --- examples/IRMQTTServer/IRMQTTServer.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/IRMQTTServer/IRMQTTServer.ino b/examples/IRMQTTServer/IRMQTTServer.ino index 294f8ae1c..7538b3ae6 100644 --- a/examples/IRMQTTServer/IRMQTTServer.ino +++ b/examples/IRMQTTServer/IRMQTTServer.ino @@ -2593,7 +2593,9 @@ void sendMQTTDiscovery(const char *topic) { #endif // MQTT_ENABLE void loop(void) { +#if MDNS_ENABLE mdns.update(); +#endif // MDNS_ENABLE server.handleClient(); // Handle any web activity #if MQTT_ENABLE From d79d369bb2ba0295b299e892604d2548d4cec9fd Mon Sep 17 00:00:00 2001 From: touchgadget Date: Fri, 11 Jun 2021 17:57:23 -0700 Subject: [PATCH 3/3] Fixes for ESP32 and correct tcp port and service --- examples/IRMQTTServer/IRMQTTServer.ino | 8 ++++---- examples/IRServer/IRServer.ino | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/IRMQTTServer/IRMQTTServer.ino b/examples/IRMQTTServer/IRMQTTServer.ino index 7538b3ae6..fefd743d8 100644 --- a/examples/IRMQTTServer/IRMQTTServer.ino +++ b/examples/IRMQTTServer/IRMQTTServer.ino @@ -2143,8 +2143,8 @@ void setup(void) { if (mdns.begin(Hostname)) { #endif // ESP8266 debug("MDNS responder started"); - // Announce esp tcp service on port 8080 - mdns.addService("esp", "tcp", 8080); + // Announce http tcp service on kHttpPort + mdns.addService("http", "tcp", kHttpPort); } #endif // MDNS_ENABLE @@ -2593,9 +2593,9 @@ void sendMQTTDiscovery(const char *topic) { #endif // MQTT_ENABLE void loop(void) { -#if MDNS_ENABLE +#if MDNS_ENABLE && defined(ESP8266) mdns.update(); -#endif // MDNS_ENABLE +#endif // MDNS_ENABLE and ESP8266 server.handleClient(); // Handle any web activity #if MQTT_ENABLE diff --git a/examples/IRServer/IRServer.ino b/examples/IRServer/IRServer.ino index 9d9b92f98..d811c8ff1 100644 --- a/examples/IRServer/IRServer.ino +++ b/examples/IRServer/IRServer.ino @@ -132,8 +132,8 @@ void setup(void) { if (mdns.begin(HOSTNAME)) { #endif // ESP8266 Serial.println("MDNS responder started"); - // Announce esp tcp service on port 8080 - mdns.addService("esp", "tcp", 8080); + // Announce http tcp service on port 80 + mdns.addService("http", "tcp", 80); } server.on("/", handleRoot); @@ -150,6 +150,8 @@ void setup(void) { } void loop(void) { +#if defined(ESP8266) mdns.update(); +#endif server.handleClient(); }