You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When connecting to an MQTT broker, please allow putting an mDNS domain into the "broker" field. Currently (on version 0.15.1.beta2) it seems only IP addresses and regular DNS names are supported.
MQTT broker is considered a "server" and as such should have a static IP address.
Adding ability to enter FQDN (or at least hotname) adds to complexity and increases code size.
Agree that servers have in general a static IP. Nevertheless even in my LAN i don't put an IP address in any config. My mqtt broker has mqtt.lan as DNS name for example. Don't agree that it puts a lot of code to resolve the DNS name in an IP address. It makes it a lot easier to maintain stuff. If the IP address changes of a server it is a lot of "fun" to change all the addresses in all devices. Imho it is a no go not to support DNS name resolution.
A lot of flash space can be saved to drop support for the crappy mDNS which brings as "benefit" a lot of issues when used with an esp8266 / esp32.
Tasmota does not support mDNS
@schildbach I am a member of Tasmota dev core crew. The post ist really old you linked. I convinced Theo to remove mDNS support in all precompiled binaries one or two years later ;-)
As an Apple user I have yet to find an issue with mDNS. My experience is that incorrectly set up networks may exhibit issues with mDNS. And once those are resolved it is up to devices to support it.
That being said, I fully understand the benefits of DNS (or mDNS) resolution. Unfortunately the issue #4586 will add headeaches if only DNS is used, and I have no idea on how to resolve that.
As for WLED to support DNS/mDNS resolution, plenty of UI fields would need to be updated adding code (JS/HTML) as well as backend validation and DNS resolution. If someone finds the time and will to comb through all of it I will be more than happy to help.
Anyone interested may want to try adding this in mqtt.cpp to initMqtt() function:
...
#ifdef ARDUINO_ARCH_ESP32
if (strlen(cmDNS) > 0 && strchr(mqttServer, '.') == nullptr) { // if mDNS is enabled and server does not have domain
mqttIP = MDNS.queryHost(mqttServer);
if (mqttIP != IPAddress()) // if MDNS resolved the hostname
mqtt->setServer(mqttIP, mqttPort);
else
mqtt->setServer(mqttServer, mqttPort);
} else
#endif
...
in the elseportion of if (mqttIP.fromString(mqttServer).
Is there any way to build WLED in a container, like within Docker or Podman? Or do you have WLED images for pull requests somewhere? I don't have the dev environment available, in particular no Visual Studio.
If you don't need customised binary, please use Github's CI builds. You can find them in PR.
Otherwise follow instructions in KB. AFAIK VSC is free but is not needed. You do need PlatformIO, though.
Activity
blazoncek commentedon May 1, 2025
MQTT broker is considered a "server" and as such should have a static IP address.
Adding ability to enter FQDN (or at least hotname) adds to complexity and increases code size.
schildbach commentedon May 1, 2025
Just for reference, both mDNS and DNS can point to static IP addresses as well.
DNS is already supported in the field.
Tasmota can resolve both mDNS and DNS as well.
Jason2866 commentedon May 1, 2025
Agree that servers have in general a static IP. Nevertheless even in my LAN i don't put an IP address in any config. My mqtt broker has mqtt.lan as DNS name for example. Don't agree that it puts a lot of code to resolve the DNS name in an IP address. It makes it a lot easier to maintain stuff. If the IP address changes of a server it is a lot of "fun" to change all the addresses in all devices. Imho it is a no go not to support DNS name resolution.
A lot of flash space can be saved to drop support for the crappy mDNS which brings as "benefit" a lot of issues when used with an esp8266 / esp32.
Tasmota does not support mDNS
blazoncek commentedon May 1, 2025
I did not say it won't or shouldn't be implemented. 😄
schildbach commentedon May 1, 2025
I think it does: arendst/Tasmota#6866 (comment)
Jason2866 commentedon May 1, 2025
@schildbach I am a member of Tasmota dev core crew. The post ist really old you linked. I convinced Theo to remove mDNS support in all precompiled binaries one or two years later ;-)
blazoncek commentedon May 2, 2025
As an Apple user I have yet to find an issue with mDNS. My experience is that incorrectly set up networks may exhibit issues with mDNS. And once those are resolved it is up to devices to support it.
That being said, I fully understand the benefits of DNS (or mDNS) resolution. Unfortunately the issue #4586 will add headeaches if only DNS is used, and I have no idea on how to resolve that.
As for WLED to support DNS/mDNS resolution, plenty of UI fields would need to be updated adding code (JS/HTML) as well as backend validation and DNS resolution. If someone finds the time and will to comb through all of it I will be more than happy to help.
blazoncek commentedon Jul 8, 2025
Anyone interested may want to try adding this in
mqtt.cpptoinitMqtt()function:... #ifdef ARDUINO_ARCH_ESP32 if (strlen(cmDNS) > 0 && strchr(mqttServer, '.') == nullptr) { // if mDNS is enabled and server does not have domain mqttIP = MDNS.queryHost(mqttServer); if (mqttIP != IPAddress()) // if MDNS resolved the hostname mqtt->setServer(mqttIP, mqttPort); else mqtt->setServer(mqttServer, mqttPort); } else #endif ...in the
elseportion ofif (mqttIP.fromString(mqttServer).And then, please, report back.
Add mDNS support for MQTT server
Add mDNS support for MQTT server
blazoncek commentedon Jul 14, 2025
@schildbach please test #4769 and report back (in PR).
schildbach commentedon Jul 14, 2025
Is there any way to build WLED in a container, like within Docker or Podman? Or do you have WLED images for pull requests somewhere? I don't have the dev environment available, in particular no Visual Studio.
blazoncek commentedon Jul 14, 2025
If you don't need customised binary, please use Github's CI builds. You can find them in PR.
Otherwise follow instructions in KB. AFAIK VSC is free but is not needed. You do need PlatformIO, though.
Add mDNS support for MQTT server
Add mDNS support for MQTT server