diff --git a/addons/binding/org.openhab.binding.sonos/ESH-INF/thing/thing-types.xml b/addons/binding/org.openhab.binding.sonos/ESH-INF/thing/thing-types.xml
index b14c669fa130e..f7dc175dc2eee 100644
--- a/addons/binding/org.openhab.binding.sonos/ESH-INF/thing/thing-types.xml
+++ b/addons/binding/org.openhab.binding.sonos/ESH-INF/thing/thing-types.xml
@@ -25,6 +25,8 @@
+
+
@@ -150,6 +152,18 @@
Play the given playlist. The playlist has to predefined in the Sonos Controller app
+
+ Switch
+
+ Play the songs from the current queue
+
+
+
+ Number
+
+ Play the given track number from the current queue
+
+
String
diff --git a/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/SonosBindingConstants.java b/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/SonosBindingConstants.java
index ad1338d8c4b70..5234f51528775 100644
--- a/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/SonosBindingConstants.java
+++ b/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/SonosBindingConstants.java
@@ -39,6 +39,8 @@ public class SonosBindingConstants {
public final static String MUTE = "mute";
public final static String PLAYLINEIN = "playlinein";
public final static String PLAYLIST = "playlist";
+ public final static String PLAYQUEUE = "playqueue";
+ public final static String PLAYTRACK = "playtrack";
public final static String PLAYURI = "playuri";
public final static String PUBLICADDRESS = "publicaddress";
public final static String RADIO = "radio";
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 eb4015551362d..75c685ca1a81e 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
@@ -233,6 +233,12 @@ public void handleCommand(ChannelUID channelUID, Command command) {
case PLAYLIST:
playPlayList(command);
break;
+ case PLAYQUEUE:
+ playQueue(command);
+ break;
+ case PLAYTRACK:
+ playTrack(command);
+ break;
case PLAYURI:
playURI(command);
break;
@@ -653,7 +659,7 @@ protected void updateCurrentURIFormatted(String URI) {
// currentURI = getCurrentURI();
currentTrack = getTrackMetadata();
}
-
+
if (currentURI != null) {
String title = stateMap.get("CurrentTitle");
String resultString = stateMap.get("CurrentURIFormatted");
@@ -1204,6 +1210,10 @@ 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);
+ }
protected void seek(String unit, String target) {
if (unit != null && target != null) {
@@ -1639,6 +1649,19 @@ public void playURI(Command command) {
}
+ public void playQueue(Command command) {
+ ZonePlayerHandler coordinator = getHandlerByName(getCoordinator());
+
+ // set the current playlist to our new queue
+ coordinator.setCurrentURI("x-rincon-queue:" + getUDN() + "#0", "");
+
+ // take the system off mute
+ coordinator.setMute(OnOffType.OFF);
+
+ // start jammin'
+ coordinator.play();
+ }
+
public void setLed(Command command) {
if (command != null) {
if (command instanceof OnOffType
@@ -1723,6 +1746,25 @@ public void playRadio(Command command) {
}
+ public void playTrack(Command command) {
+
+ if(command != null && command instanceof DecimalType) {
+ ZonePlayerHandler coordinator = getHandlerByName(getCoordinator());
+
+ String trackNumber = command.toString();
+
+ // seek the track - warning, we do not check if the tracknumber falls in the boundary of the queue
+ setPositionTrack(trackNumber);
+
+ // take the system off mute
+ coordinator.setMute(OnOffType.OFF);
+
+ // start jammin'
+ coordinator.play();
+ }
+
+ }
+
public void playPlayList(Command command) {
List playlists = getPlayLists();
SonosEntry theEntry = null;