Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Added Cambridge Audio discoverable. #191

Merged
merged 4 commits into from
May 8, 2018
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions netdisco/discoverables/cambridgeaudio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
""" Discover Cambridge Audio StreamMagic devices. """
from . import SSDPDiscoverable
from ..const import ATTR_NAME, ATTR_MODEL_NAME


class Discoverable(SSDPDiscoverable):
"""Add support for discovering Cambridge Audio StreamMagic devices."""

def get_entries(self):
"""Get all Cambridge Audio MediaRenderer uPnP entries."""
return self.find_by_device_description({
"manufacturer": "Cambridge Audio",
"deviceType": "urn:schemas-upnp-org:device:MediaRenderer:1"
})

def info_from_entry(self, entry):
"""Get most important info, which is name, model and host."""
info = super().info_from_entry(entry)
info[ATTR_NAME] = entry.description['device']['friendlyName']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This info is already available?

info[ATTR_MODEL_NAME] = entry.description['device']['modelName']
return info