[sonos] Avoid empty thing (type) ID in discovery (#12626)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
e42202d2e5
commit
6b56b40fe1
@ -82,7 +82,8 @@ public class ZonePlayerDiscoveryParticipant implements UpnpDiscoveryParticipant
|
|||||||
if (device.getDetails().getManufacturerDetails().getManufacturer().toUpperCase().contains("SONOS")) {
|
if (device.getDetails().getManufacturerDetails().getManufacturer().toUpperCase().contains("SONOS")) {
|
||||||
String id = SonosXMLParser
|
String id = SonosXMLParser
|
||||||
.buildThingTypeIdFromModelName(device.getDetails().getModelDetails().getModelName());
|
.buildThingTypeIdFromModelName(device.getDetails().getModelDetails().getModelName());
|
||||||
if (!"Sub".equalsIgnoreCase(id)) {
|
String udn = device.getIdentity().getUdn().getIdentifierString();
|
||||||
|
if (!id.isEmpty() && !"Sub".equalsIgnoreCase(id) && !udn.isEmpty()) {
|
||||||
ThingTypeUID thingTypeUID = new ThingTypeUID(SonosBindingConstants.BINDING_ID, id);
|
ThingTypeUID thingTypeUID = new ThingTypeUID(SonosBindingConstants.BINDING_ID, id);
|
||||||
if (!SonosBindingConstants.SUPPORTED_KNOWN_THING_TYPES_UIDS.contains(thingTypeUID)) {
|
if (!SonosBindingConstants.SUPPORTED_KNOWN_THING_TYPES_UIDS.contains(thingTypeUID)) {
|
||||||
// Try with the model name all in uppercase
|
// Try with the model name all in uppercase
|
||||||
@ -96,9 +97,8 @@ public class ZonePlayerDiscoveryParticipant implements UpnpDiscoveryParticipant
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Discovered a Sonos '{}' thing with UDN '{}'", thingTypeUID,
|
logger.debug("Discovered a Sonos '{}' thing with UDN '{}'", thingTypeUID, udn);
|
||||||
device.getIdentity().getUdn().getIdentifierString());
|
return new ThingUID(thingTypeUID, udn);
|
||||||
return new ThingUID(thingTypeUID, device.getIdentity().getUdn().getIdentifierString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user