mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 23:22:02 +01:00
[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) {
|
||||
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,22 +95,28 @@ public class ZonePlayerDiscoveryParticipant implements UpnpDiscoveryParticipant
|
||||
case "Arc SL":
|
||||
modelName = "ArcSL";
|
||||
break;
|
||||
case "Sub":
|
||||
// The Sonos Sub is ignored
|
||||
ignored = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
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
|
||||
thingUID = new ThingTypeUID(SonosBindingConstants.BINDING_ID, modelName.toUpperCase());
|
||||
// In case a new "unknown" Sonos player is discovered a generic ThingTypeUID will be used
|
||||
if (!ignored) {
|
||||
ThingTypeUID thingUID = new ThingTypeUID(SonosBindingConstants.BINDING_ID, modelName);
|
||||
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,
|
||||
device.getIdentity().getUdn().getIdentifierString());
|
||||
return new ThingUID(thingUID, device.getIdentity().getUdn().getIdentifierString());
|
||||
logger.debug("Discovered a Sonos '{}' thing with UDN '{}'", thingUID,
|
||||
device.getIdentity().getUdn().getIdentifierString());
|
||||
return new ThingUID(thingUID, device.getIdentity().getUdn().getIdentifierString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user