New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added an option to disable mDNS #1716
Conversation
I'm ok with this but I believe it will be better if the options is under wifi and ethernet to maintain cohesion |
That is what I initially had in mind but I noticed that for some reason the include flags for mDNS libraries were added in I will move the inclusion of mDNS libraries to WiFi and ethernet components and move the config option with them. |
Done! Now
|
is there a validation rule that must be done? e.g. disabling mdns and using dhcp should not validate? |
No, there's no need for enforcing that. Since as you pointed out the user can assign a static lease or determine the IP address in some other way. The most common use case however is going to be MQTT and static IP addresses which I mentioned I'll cover in the docs. I did consider having a static IP OR not enabling the API server to imply not enabling mDNS by default but ultimately I decided against it since it's possible some users might be relying on mDNS for discovery in Hass even when they're using a static IP. With that said, it might be worth considering changing the default behavior to disable mDNS when MQTT is solely used. |
@glmnet added a PR for docs |
Please add this on docs too. E.g If you disable mdns then you will need to set an static IP and use ping for online status to work in the dashboard. (You can link to the faq note about that, see docker entry) Also please test this, we definitely are going to get issue reports about this otherwise |
Done. I added a section on this to the FAQ and linked to it from the components. See: esphome/esphome-docs#1118 As for testing, I've fully tested this on ESP32 and ESP8266 nodes using WiFi. Feel free to tag me on any issues that are opened about this. |
Looks good to me, we don't use hass.io anymore, in this case you mean Home Assistant itself, you can say Home Assistant Supervisor if you mean old hass.io specifically |
I can test Ethernet What should I check? |
First we need to make sure that the existing mDNS functionality continues to work when this flag is enabled. Then change the |
@glmnet were you able to do these tests? Can we get this and esphome/esphome-docs#1118 merged? |
Hey there @esphome/core, mind taking a look at this pull request as its been labeled with an integration ( |
Thanks 🦙 |
* 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>
What does this implement/fix?
This PR adds a boolean config option
enable_mdns
(default=true) to theesphome
section that can be used to enable/disable mDNS in firmware codegen.Type of changes
Related issues:
esphome/feature-requests#983
esphome/feature-requests#769
Pull request in esphome-docs with documentation:
esphome/esphome-docs#1118
Test Environment
Example entry for
config.yaml
:Explain your changes
The
enable_mdns
option will control the inclusion ofESPmDNS
andESP8266mDNS
libraries AND defines theUSE_MDNS
flag for the preprocessor.All the related mDNS code is wrapped around conditional preprocessor directives so they are omitted when
enable_mdns
is set to false.I have tested this with ESP32, ESP8266 using WiFi.
I don't have access to an ESP32 ethernet module, so I would appreciate it if someone can test this change with an ethernet shield.
Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: