[sonos] Filter Sonos Sub from discovery (#10925)

Fix #10777

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
pull/10993/head
lolodomo 2021-07-13 12:29:54 +02:00 committed by GitHub
parent 225cb9ed38
commit 03d9281c0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 10 deletions

View File

@ -80,6 +80,7 @@ public class ZonePlayerDiscoveryParticipant implements UpnpDiscoveryParticipant
public @Nullable ThingUID getThingUID(RemoteDevice device) {
if (device.getDetails().getManufacturerDetails().getManufacturer() != null) {
if (device.getDetails().getManufacturerDetails().getManufacturer().toUpperCase().contains("SONOS")) {
boolean ignored = false;
String modelName = getModelName(device);
switch (modelName) {
case "ZP80":
@ -94,9 +95,14 @@ public class ZonePlayerDiscoveryParticipant implements UpnpDiscoveryParticipant
case "Arc SL":
modelName = "ArcSL";
break;
case "Sub":
// The Sonos Sub is ignored
ignored = true;
break;
default:
break;
}
if (!ignored) {
ThingTypeUID thingUID = new ThingTypeUID(SonosBindingConstants.BINDING_ID, modelName);
if (!SonosBindingConstants.SUPPORTED_KNOWN_THING_TYPES_UIDS.contains(thingUID)) {
// Try with the model name all in uppercase
@ -112,6 +118,7 @@ public class ZonePlayerDiscoveryParticipant implements UpnpDiscoveryParticipant
return new ThingUID(thingUID, device.getIdentity().getUdn().getIdentifierString());
}
}
}
return null;
}