[heos] Fix runtime error; Support for new Denon "Home" speaker added (#9935)

* Support for Denon "Home" speaker as bridge added
* Fixed a runtime issue if no serial number is provided by the player, by using the PID as a fallback if no serial number is available

Signed-off-by: Wire82 <johannes.einig@me.com>
This commit is contained in:
Johannes Einig 2021-01-28 22:41:28 +01:00 committed by GitHub
parent 6473935482
commit 2127ac23c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -79,7 +79,8 @@ public class HeosDiscoveryParticipant implements UpnpDiscoveryParticipant {
DeviceDetails details = device.getDetails(); DeviceDetails details = device.getDetails();
String modelName = details.getModelDetails().getModelName(); String modelName = details.getModelDetails().getModelName();
String modelManufacturer = details.getManufacturerDetails().getManufacturer(); String modelManufacturer = details.getManufacturerDetails().getManufacturer();
if ("Denon".equals(modelManufacturer) && (modelName.startsWith("HEOS") || modelName.endsWith("H"))) { if ("Denon".equals(modelManufacturer)
&& (modelName.startsWith("HEOS") || modelName.endsWith("H") || modelName.contains("Home"))) {
String deviceType = device.getType().getType(); String deviceType = device.getType().getType();
if (deviceType.startsWith("ACT") || deviceType.startsWith("Aios")) { if (deviceType.startsWith("ACT") || deviceType.startsWith("Aios")) {
return new ThingUID(THING_TYPE_BRIDGE, device.getIdentity().getUdn().getIdentifierString()); return new ThingUID(THING_TYPE_BRIDGE, device.getIdentity().getUdn().getIdentifierString());

View File

@ -179,6 +179,10 @@ public class HeosPlayerHandler extends HeosThingBaseHandler {
String serialNumber = player.serial; String serialNumber = player.serial;
if (serialNumber != null) { if (serialNumber != null) {
prop.put(Thing.PROPERTY_SERIAL_NUMBER, serialNumber); prop.put(Thing.PROPERTY_SERIAL_NUMBER, serialNumber);
} else {
prop.put(Thing.PROPERTY_SERIAL_NUMBER, String.valueOf(player.playerId)); // If no serial number is provided,
// write an empty string to
// prevent error during runtime
} }
} }
} }