-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Allow Config Entries to be discovered #121
Comments
What do you mean with the last point?
|
When we drop legacy discovery mode based on Netdisco, we would no longer discover integrations that rely on passing |
So it's been a while since I pondered about making the discovery nicer, so I'm definitely 👍 for getting this cleaned. In contrast to @balloob's proposal, I think that instead of making it harder to make devices discoverable, we should empower everyone to make their components/platforms more discoverable (adding discoverability to IQS?). Note that I'm not against sunsetting netdisco nor against the idea of enabling the component/platform developers to implement their custom discovery handling where it is supposed to be (that is, near the component/platform code), merely pointing out that we can do better for the regular developers with no special needs. As this comment snowballed into way bigger than I expected, here's a short overview of what I propose (on top of @balloob's proposal):
I'll start by defining a couple of user stories to show how my proposed changes would improve the situation even further. User stories
Developer stories
ImplementationIn order to making the implementation as straightforward as possible, a new meta-data file called The components/platforms who have registered their wish to support the new device are loaded on demand and their respective The biggest change besides the new metadata file is that the platforms are to be moved into their own directories. NOTE: Nothing here is set in stone, these are just to give an idea how different platforms could define what they support. The available configuration keys for the metadata are based on checking the current netdisco implementations, there is a list at the end of what types of checks the implemented discoveries do. Reasoning for a new file and structureAdding a new file and modifying the source tree structure should not be taken lightly, so I'm listing here some advantages and disadvantages of this change. Some of these are completely unrelated to discoverability, but, in my opinion worthy reasons to make the change for the future's sake. Advantages
Disadvantages
Backwards compatibility & required changes from developersThe existing implementations SHALL continue working without any changes for some later determined time period, and the conversion shall be made straightforward. Component developers
Platform developers
Implementation detailsSSDP
Note, that the file format is not important here, these examples just try to give an idea how such configuration would look like. Instead of ini files this could be YAML or JSON. Generic media renderer (dlna_dmr)
Huawei
Deconz
Hue
mDNS
Yeelight bulbs
HP printers
Custom discovery protocols
Appendix 1. Common discovery protocols
UPnP/SSDPHow does it workThe gruntwork here is (to be) done in the backend library, but I think describing how these work will help to understand the big picture better.
Implementation
mDNS (multicast DNS)How does it work
Implementation
Appendix 2. current netdisco discoverables
mDNS
SSDP
Custom
|
Just wondering if a decision was ever finalised around this? Are PRs to Netdisco no longer allowed? I have a very standard PR open to discover Enigma2 based devices. Please let me know if this needs to be done in a different fashion. Thanks. |
Right now the netdisco package is used for discovery. Routing all discovery through netdisco has the problem that we now have a centralized place that has to support an ever growing list of devices that can be discovered, some of them with custom discovery protocol implementations. We also discover things that Home Assistant doesn't support. Result is that netdisco is getting bloated. I've already stopped approving new discovery protocols and plan to remove all non-standard discovery protocols.
But this will leave a discovery gap. And I do think that discovery is important to get users up and running during onboarding and when they want to set up things later.
Proposal
We freeze adding any custom protocols to netdisco (as per home-assistant-libs/netdisco#230)
We will no longer discover every X minutes. Instead we discover once during onboarding and when the user navigates to the integrations page in the UI. We will initially allow a discovery legacy mode to keep running netdisco each X minutes.
Config Entries will be able to register how they can be discovered: upnp/SSDP, mDNS/zeroconf/bonjour or with their own custom method. Our new discovery mechanism will loop over all config entries and see how they can be discovered.
If integration defines a custom discovery, we will install the component requirements and will call that method, the config entry can now leverage the lib for discovery. Installing requirements seem like a lot of useless installation and loading modules, but it's not that bad: on Hass.io/Docker the packages are already installed. We also will only run discovery during onboarding and whenever the user navigates to the integration page. So during normal operation, these packages won't be loaded.
We will keep a list of popular config entries that will be included when doing discovery. This list contains all that rely on standard protocols and a couple popular integrations that use a custom discovery (ie Philips Hue nupnp). A user can have the option to do an "extended" discovery that will include all integrations with custom discovery.
Eventually I want to deprecate the netdisco package. The code from netdisco that we depend on will be included in Home Assistant as part of the discovery component.
Some code to illustrate
Advantages
Disadvantages
The text was updated successfully, but these errors were encountered: