You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
750 B

4 years ago
  1. """Discover Denon AVR devices."""
  2. from urllib.parse import urlparse
  3. from . import SSDPDiscoverable
  4. from ..const import ATTR_HOST
  5. class Discoverable(SSDPDiscoverable):
  6. """Add support for discovering Denon AVR devices."""
  7. def get_entries(self):
  8. """Get all Denon AVR uPnP entries."""
  9. return self.find_by_device_description({
  10. "manufacturer": "Denon",
  11. "deviceType": "urn:schemas-upnp-org:device:MediaRenderer:1"
  12. })
  13. def info_from_entry(self, entry):
  14. """Get most important info, which is name, model and host."""
  15. info = super().info_from_entry(entry)
  16. info[ATTR_HOST] = urlparse(
  17. entry.description['device']['presentationURL']).hostname
  18. return info