diff --git a/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/handler/ZonePlayerHandler.java b/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/handler/ZonePlayerHandler.java index 75c685ca1a81e..3d638bc9b5361 100644 --- a/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/handler/ZonePlayerHandler.java +++ b/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/handler/ZonePlayerHandler.java @@ -165,21 +165,25 @@ public void initialize() { @Override public void thingDiscovered(DiscoveryService source, DiscoveryResult result) { - if (getThing().getConfiguration().get(UDN) - .equals(result.getProperties().get(UDN))) { - logger.debug("Discovered UDN '{}' for thing '{}'", result - .getProperties().get(UDN), getThing().getUID()); - getThing().setStatus(ThingStatus.ONLINE); - onSubscription(); - onUpdate(); + if(result.getThingUID().equals(this.getThing().getUID())) { + if (getThing().getConfiguration().get(UDN) + .equals(result.getProperties().get(UDN))) { + logger.debug("Discovered UDN '{}' for thing '{}'", result + .getProperties().get(UDN), getThing().getUID()); + getThing().setStatus(ThingStatus.ONLINE); + onSubscription(); + onUpdate(); + } } } @Override public void thingRemoved(DiscoveryService source, ThingUID thingUID) { - logger.debug("Setting status for thing '{}' to OFFLINE", getThing() - .getUID()); - getThing().setStatus(ThingStatus.OFFLINE); + if(thingUID.equals(this.getThing().getUID())) { + logger.debug("Setting status for thing '{}' to OFFLINE", getThing() + .getUID()); + getThing().setStatus(ThingStatus.OFFLINE); + } } @Override @@ -1210,7 +1214,7 @@ public void setPosition(String relTime) { public void setPositionTrack(long tracknr) { seek("TRACK_NR", Long.toString(tracknr)); } - + public void setPositionTrack(String tracknr) { seek("TRACK_NR", tracknr); }