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

Conversation

sebk-666
Copy link
Contributor

@sebk-666 sebk-666 commented May 4, 2018

I wrote a media_player platform module for Home-Assistant to support Cambridge Audio network audio streamers.
This is one piece of the puzzle that allows the device to be auto-discovered on the local network.

Sebastian

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?

@sebk-666
Copy link
Contributor Author

sebk-666 commented May 7, 2018

Yes, it's all there.

entry.description:

{
	'specVersion': {'major': '1', 'minor': '0'}, 
 	'device': {
		'deviceType': 'urn:schemas-upnp-org:device:MediaRenderer:1', 
		'friendlyName': '851N', 
		'manufacturer': 'Cambridge Audio', 
		'manufacturerURL': 'http://www.cambridgeaudio.com/', 
		'modelName': '851N', 
		'modelNumber': '2503', 
		'UDN': 'uuid:8fe5ece8-fa26-4d56-a0a7-8e9fa6fa1cb0', 
		'serialNumber': '0******0', 
	        'iconList': { ... }, 
		'serviceList': {...}, 
		'X_DLNADOC': ['DMR-1.50', 'M-DMP-1.50']
	}
}

info:

{'host': '192.168.xx.yy', 
 'port': 8050, 
 'ssdp_description': 'http://192.168.xx.yy:8050/8fe5ece8-fa26-4d56-a0a7-8e9fa6fa1cb0/description.xml', 
 'name': '851N', 
 'model_name': '851N', 
 'model_number': '2503', 
 'serial': '0******0', 
 'manufacturer': 'Cambridge Audio', 
 'udn': 'uuid:8fe5ece8-fa26-4d56-a0a7-8e9fa6fa1cb0'
}

Sebastian

@balloob
Copy link
Collaborator

balloob commented May 8, 2018

I mean that we already extract the name and that you don't have to do that manually.

@sebk-666
Copy link
Contributor Author

sebk-666 commented May 8, 2018

Ah, I misunderstood. I removed those lines now.

@balloob balloob merged commit 317c3b0 into home-assistant-libs:master May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants