Skip to content
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

Device discovery requires a fixed timeout #5

Closed
zehnm opened this issue Oct 18, 2023 · 1 comment · Fixed by #12
Closed

Device discovery requires a fixed timeout #5

zehnm opened this issue Oct 18, 2023 · 1 comment · Fixed by #12
Labels
bug Something isn't working

Comments

@zehnm
Copy link
Contributor

zehnm commented Oct 18, 2023

Issue: no overall discovery timeout like 30sec, but a socket read timeout while receiving SSDP records. With many devices this can easily take over a minute and the UI times out!

This happens to me now, with just 2 Sonos, 1 LG TV, 1 Hue Bridge and an AVR. Not really a big setup, but the discovery almost always times out. Even if the integration discovered the AVR, I can't finish the setup process.

The socket read timeout cannot be used for a discovery timeout. You might get 100 devices, and the first ones start sending messages again, while still processing the remaining records.

Another issue which increases the discovery timeout is #4:

  • Lots of devices are discovered which match the search query, like Sonos, LG, Hue, ...
  • Each device (IP address to be precise) is used to try creating denonavr.DenonAVR(ipaddress).
  • The denonavr library then tries to fetch all required information. In my environment this takes around 2-3 seconds for the Hue bridge alone. And the Hue bridge sends a record every few seconds! This is the time between these two log messages:
DEBUG:avr:Trying to get device info for 172.16.16.5
ERROR:avr:Failed to get device info. Maybe not a Denon device.

--> the number of attempts to create a DenonAVR object for every found SSDP record has to be decreased! Suggestion: create a list of well known header keys of 3rd party devices, that can be immediatly filtered out.

Known headers so far:

  • hue-bridgeid: Philips Hue bridge
  • X-RINCON-HOUSEHOLD: Sonos speakers
  • DLNADeviceName.lge.com: LG TV

TODO study SSDP protocol and HA implementation.
It would be great if Denon receivers could be clearly identifiable either by:

  • USN: The unique service name to identify the device.
    --> is that just the generic upnp service?
  • SERVER: The server system information value providing information in the following format: [OS-Name] UPnP/[Version] [Product-Name]/[Product-Version].
    --> is OS-Nameusable?
    Probably the XML file has to be loaded from LOCATION and parsed for the required information...

Home Assistant has a central SSDP discovery:

@zehnm
Copy link
Contributor Author

zehnm commented Oct 24, 2023

The denonavr library already comes with its own SSDP discovery function async_identify_denonavr_receivers: https://github.com/ol-iver/denonavr/blob/0.11.4/denonavr/ssdp.py#L81

Why not use this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant