[sonos] Filter Sonos Sub from discovery (#10925)
Fix #10777 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
225cb9ed38
commit
03d9281c0b
@ -80,6 +80,7 @@ public class ZonePlayerDiscoveryParticipant implements UpnpDiscoveryParticipant
|
|||||||
public @Nullable ThingUID getThingUID(RemoteDevice device) {
|
public @Nullable ThingUID getThingUID(RemoteDevice device) {
|
||||||
if (device.getDetails().getManufacturerDetails().getManufacturer() != null) {
|
if (device.getDetails().getManufacturerDetails().getManufacturer() != null) {
|
||||||
if (device.getDetails().getManufacturerDetails().getManufacturer().toUpperCase().contains("SONOS")) {
|
if (device.getDetails().getManufacturerDetails().getManufacturer().toUpperCase().contains("SONOS")) {
|
||||||
|
boolean ignored = false;
|
||||||
String modelName = getModelName(device);
|
String modelName = getModelName(device);
|
||||||
switch (modelName) {
|
switch (modelName) {
|
||||||
case "ZP80":
|
case "ZP80":
|
||||||
@ -94,22 +95,28 @@ public class ZonePlayerDiscoveryParticipant implements UpnpDiscoveryParticipant
|
|||||||
case "Arc SL":
|
case "Arc SL":
|
||||||
modelName = "ArcSL";
|
modelName = "ArcSL";
|
||||||
break;
|
break;
|
||||||
|
case "Sub":
|
||||||
|
// The Sonos Sub is ignored
|
||||||
|
ignored = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ThingTypeUID thingUID = new ThingTypeUID(SonosBindingConstants.BINDING_ID, modelName);
|
if (!ignored) {
|
||||||
if (!SonosBindingConstants.SUPPORTED_KNOWN_THING_TYPES_UIDS.contains(thingUID)) {
|
ThingTypeUID thingUID = new ThingTypeUID(SonosBindingConstants.BINDING_ID, modelName);
|
||||||
// Try with the model name all in uppercase
|
|
||||||
thingUID = new ThingTypeUID(SonosBindingConstants.BINDING_ID, modelName.toUpperCase());
|
|
||||||
// In case a new "unknown" Sonos player is discovered a generic ThingTypeUID will be used
|
|
||||||
if (!SonosBindingConstants.SUPPORTED_KNOWN_THING_TYPES_UIDS.contains(thingUID)) {
|
if (!SonosBindingConstants.SUPPORTED_KNOWN_THING_TYPES_UIDS.contains(thingUID)) {
|
||||||
thingUID = SonosBindingConstants.ZONEPLAYER_THING_TYPE_UID;
|
// Try with the model name all in uppercase
|
||||||
|
thingUID = new ThingTypeUID(SonosBindingConstants.BINDING_ID, modelName.toUpperCase());
|
||||||
|
// In case a new "unknown" Sonos player is discovered a generic ThingTypeUID will be used
|
||||||
|
if (!SonosBindingConstants.SUPPORTED_KNOWN_THING_TYPES_UIDS.contains(thingUID)) {
|
||||||
|
thingUID = SonosBindingConstants.ZONEPLAYER_THING_TYPE_UID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
logger.debug("Discovered a Sonos '{}' thing with UDN '{}'", thingUID,
|
logger.debug("Discovered a Sonos '{}' thing with UDN '{}'", thingUID,
|
||||||
device.getIdentity().getUdn().getIdentifierString());
|
device.getIdentity().getUdn().getIdentifierString());
|
||||||
return new ThingUID(thingUID, device.getIdentity().getUdn().getIdentifierString());
|
return new ThingUID(thingUID, device.getIdentity().getUdn().getIdentifierString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user