home-assistant-libs / netdisco

:mag_right: Python library to scan local network for services and devices.
Other
268 stars 147 forks source link

Yamaha discoverables are obsolete with MusicCast #248

Closed cadavre closed 5 years ago

cadavre commented 5 years ago

Where is the bug?

Discoverable: discoverables/yamaha.py

Description

The way this implementation discovers yamaha platform is not taking into consideration newer platforms of Yamaha MusicCast.

I can see that there was in fact already a try to fix it with N301 model: https://github.com/home-assistant/netdisco/issues?utf8=%E2%9C%93&q=yamaha But it is not the only INCOMPATIBLE_MODEL out there, others are: N303, N402, N602, N803 and others...

Above models are in fact supported but by new yamaha_musiccast platform. Discovery made by manufacturer and deviceType is not sufficient anymore, because both same values can describe two different platforms.

How to fix?

  1. I would duplicate discoverables/yamaha.py into discoverables/yamaha_musiccast.py.
  2. I would check prefix of device parameter model_name. 3.a. I would exclude all starting with R-N inside discoverables/yamaha.py. 3.b. I would exclude all starting with RX-V inside discoverables/yamaha_musiccast.py.
cadavre commented 5 years ago

Please compare:

  1. Old platform yamaha desc.xml: https://github.com/home-assistant/netdisco/blob/master/tests/discoverables/yamaha_files/desc_RX-V481.xml

  2. New platform yamaha_musiccast:

    <root xmlns="urn:schemas-upnp-org:device-1-0" xmlns:yamaha="urn:schemas-yamaha-com:device-1-0">
    <specVersion>
    <major>1</major>
    <minor>0</minor>
    </specVersion>
    <device>
    <dlna:X_DLNADOC xmlns:dlna="urn:schemas-dlna-org:device-1-0">DMR-1.50</dlna:X_DLNADOC>
    <deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
    <friendlyName>Yamaha R-N602</friendlyName>
    <manufacturer>Yamaha Corporation</manufacturer>
    <manufacturerURL>http://www.yamaha.com/</manufacturerURL>
    <modelDescription>MusicCast</modelDescription>
    <modelName>R-N602</modelName>
    <modelNumber>N602</modelNumber>
    <modelURL>http://www.yamaha.com/</modelURL>
    <serialNumber>0549EDB3</serialNumber>
    <UDN>uuid:9ab0c000-f668-11de-9976-ac44f24f28e4</UDN>
    <iconList>
    <icon>
    <mimetype>image/jpeg</mimetype>
    <width>48</width>
    <height>48</height>
    <depth>24</depth>
    <url>/Icons/48x48.jpg</url>
    </icon>
    <icon>
    <mimetype>image/jpeg</mimetype>
    <width>120</width>
    <height>120</height>
    <depth>24</depth>
    <url>/Icons/120x120.jpg</url>
    </icon>
    <icon>
    <mimetype>image/png</mimetype>
    <width>48</width>
    <height>48</height>
    <depth>24</depth>
    <url>/Icons/48x48.png</url>
    </icon>
    <icon>
    <mimetype>image/png</mimetype>
    <width>120</width>
    <height>120</height>
    <depth>24</depth>
    <url>/Icons/120x120.png</url>
    </icon>
    </iconList>
    <serviceList>
    <service>
    <serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
    <serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
    <SCPDURL>/AVTransport/desc.xml</SCPDURL>
    <controlURL>/AVTransport/ctrl</controlURL>
    <eventSubURL>/AVTransport/event</eventSubURL>
    </service>
    <service>
    <serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
    <serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
    <SCPDURL>/RenderingControl/desc.xml</SCPDURL>
    <controlURL>/RenderingControl/ctrl</controlURL>
    <eventSubURL>/RenderingControl/event</eventSubURL>
    </service>
    <service>
    <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
    <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
    <SCPDURL>/ConnectionManager/desc.xml</SCPDURL>
    <controlURL>/ConnectionManager/ctrl</controlURL>
    <eventSubURL>/ConnectionManager/event</eventSubURL>
    </service>
    </serviceList>
    <presentationURL>http://192.168.1.33/</presentationURL>
    </device>
    <yamaha:X_device>
    <yamaha:X_URLBase>http://192.168.1.33:80/</yamaha:X_URLBase>
    <yamaha:X_serviceList>
    <yamaha:X_service>
    <yamaha:X_specType>
    urn:schemas-yamaha-com:service:X_YamahaRemoteControl:1
    </yamaha:X_specType>
    <yamaha:X_controlURL>/YamahaRemoteControl/ctrl</yamaha:X_controlURL>
    <yamaha:X_unitDescURL>/YamahaRemoteControl/desc.xml</yamaha:X_unitDescURL>
    </yamaha:X_service>
    <yamaha:X_service>
    <yamaha:X_specType>
    urn:schemas-yamaha-com:service:X_YamahaExtendedControl:1
    </yamaha:X_specType>
    <yamaha:X_yxcControlURL>/YamahaExtendedControl/v1/</yamaha:X_yxcControlURL>
    <yamaha:X_yxcVersion>1812 </yamaha:X_yxcVersion>
    </yamaha:X_service>
    </yamaha:X_serviceList>
    </yamaha:X_device>
    </root>