Sonos binding help

Just saw that you wrote sonos in camelcase for defining your next and play item. Please stick to lowercase.when defining binding like {sonos= "[ON: …

hi… im at work now. i will check it when im comming home around 14:00. no its still dosnt work :frowning: its a bit strange

I just successfully tested the following setup with my Sonos Play:1

items:

Switch Sonos_playpause { sonos=“[ON:S1:play],[OFF:S1:pause]” }
Switch Sonos_next { sonos=“[ON:S1:next]” }

sitemap:

Switch item=Sonos_playpause mappings=[ON=“Afspil”, OFF=“Pause”]
Switch item=Sonos_next mappings=[ON=“næste”]

Please mind the upper/lower case!

Hi… How i coppied these to things, but i still cant get it to work… have i missed something, some settings? someting? this is strange

In the log file i can see these:

16:32:08.050 [DEBUG] [.r.i.resources.SitemapResource:107 ] - Received HTTP GET request at ‘sitemaps’ for media type ‘null’.
16:32:08.054 [DEBUG] [.r.i.resources.SitemapResource:228 ] - Received HTTP GET request at ‘http://192.168.0.13:8080/rest/sitemaps’.
16:32:08.143 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at ‘sitemaps/default/default’ for media type ‘null’.
16:32:08.238 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at ‘sitemaps/default/default’ for media type ‘null’.
16:32:15.172 [DEBUG] [o.i.r.i.resources.ItemResource:193 ] - Received HTTP POST request at ‘items/Sonos_playpause’ with value ‘ON’.
16:32:15.197 [DEBUG] [.b.sonos.internal.SonosBinding:318 ] - Executing command: item:Sonos_playpause, command:ON, ID:S1, CommandType:PLAY, commandString:ON
16:32:15.507 [DEBUG] [o.o.i.r.i.b.GeneralBroadcaster:46 ] - broadcaster ‘org.openhab.io.rest.internal.broadcaster.GeneralBroadcaster$1@f7c509’ is empty
16:32:15.635 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at ‘sitemaps/default/default’ for media type ‘null’.
16:32:15.677 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at ‘sitemaps/default/default’ for media type ‘null’.
16:32:16.240 [DEBUG] [.myopenhab.internal.MyOHClient:150 ] - Transport.EVENT_REQUEST_HEADERS
16:32:16.511 [DEBUG] [.myopenhab.internal.MyOHClient:150 ] - Transport.EVENT_REQUEST_HEADERS
16:32:28.990 [DEBUG] [o.i.r.i.resources.ItemResource:193 ] - Received HTTP POST request at ‘items/Sonos_playpause’ with value ‘OFF’.
16:32:28.994 [DEBUG] [.b.sonos.internal.SonosBinding:318 ] - Executing command: item:Sonos_playpause, command:OFF, ID:S1, CommandType:PAUSE, commandString:OFF
16:32:29.311 [DEBUG] [o.o.i.r.i.b.GeneralBroadcaster:46 ] - broadcaster ‘org.openhab.io.rest.internal.broadcaster.GeneralBroadcaster$1@f7c509’ is empty
16:32:30.117 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at ‘sitemaps/default/default’ for media type ‘null’.
16:32:30.324 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at ‘sitemaps/default/default’ for media type ‘null’.
16:32:37.696 [DEBUG] [o.i.r.i.resources.ItemResource:193 ] - Received HTTP POST request at ‘items/Sonos_next’ with value ‘ON’.
16:32:37.700 [DEBUG] [.b.sonos.internal.SonosBinding:318 ] - Executing command: item:Sonos_next, command:ON, ID:S1, CommandType:NEXT, commandString:ON
16:32:38.060 [DEBUG] [o.o.i.r.i.b.GeneralBroadcaster:46 ] - broadcaster ‘org.openhab.io.rest.internal.broadcaster.GeneralBroadcaster$1@f7c509’ is empty
16:32:38.161 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at ‘sitemaps/default/default’ for media type ‘null’.
16:32:38.206 [DEBUG] [.r.i.resources.SitemapResource:146 ] - Received HTTP GET request at ‘sitemaps/default/default’ for media type ‘null’.
16:32:41.509 [DEBUG] [.myopenhab.internal.MyOHClient:150 ] - Transport.EVENT_REQUEST_HEADERS
16:32:41.791 [DEBUG] [.myopenhab.internal.MyOHClient:150 ] - Transport.EVENT_REQUEST_HEADERS

What exactly does not work?
Do you access your sitemap with a browser on a local network?
Could you please post the Sonos part of your openhab.cfg, your *.items file and *.sitemaps file?

I use Chrome and enter: http://192.168.0.13:8080/openhab.app?sitemap=default

OPENHAB.CFG
Sonos Binding

Add a line for each Sonos device you want to pre-define
The format is .udn=

sonos:S1.udn=RINCON_B8E937E56DF201400

Interval, in milliseconds, to poll the Sonos devices for status variables
sonos:pollingPeriod=1000

ITEMS:
/* Sonos */
Switch Sonos_playpause {sonos="[ON:S1:play],[OFF:S1:pause]"}
Switch Sonos_next {sonos="[ON:S1:next]"}

SITEMAP:
Frame {
Switch item=Sonos_playpause mappings=[ON=“play”, OFF=“Pause”]
Switch item=Sonos_next mappings=[ON=“next”]
}

EVENTS:
2016-01-09 20:20:54 - Sonos_playpause received command ON
2016-01-09 20:21:00 - Sonos_playpause received command OFF
2016-01-09 20:21:12 - Sonos_next received command ON

OPENHAB.LOG
20:21:00.452 [DEBUG] [.b.sonos.internal.SonosBinding:318 ] - Executing command: item:Sonos_playpause, command:OFF, ID:S1, CommandType:PAUSE, commandString:OFF
20:21:12.591 [DEBUG] [.b.sonos.internal.SonosBinding:318 ] - Executing command: item:Sonos_next, command:ON, ID:S1, CommandType:NEXT, commandString:ON

Well, this looks good to me. So what does not work?

Do you have something in your Sonos playlist, which can be played/paused or is it empty?

The problem is that sonos speaker dont react on this… its a play 1. In the Sonos Controller i have set the UPNP to on and the same on the router, because the wiki write something avout that.

But when I run the app in chrome, the speaker dosnt react.

I dont have anything on a playlist, i just found some songs, and played them, but they are not in a playlist

So I think, if the Sonos is not playing anything, you can’t pause it and start playing again…
Try to start playing a playlist and then use openHAB to control.

just tried… no reaction… :frowning:

i just tried to add musik to: Sonos playlist, sonos favorite and music libary… but still nothing happening

a screen shot from start.bat

and its still dosnt work :frowning:

As I could see out of your logs and Infos, the currenttrack item was working, correct ?
The difference here is, that you are using the UDN for currenttrack.

So please try to use this for the other items as well, you can just copy and paste the following, it uses your UDN already :

ITEMS
/* Sonos */
String Currenttrack “Aktuelt nummer [%s]” (Sonos) {sonos="[RINCON_B8E937E56DF201400:currenttrack]" }
Switch Play “Play/pause” (Sonos) {sonos="[ON:RINCON_B8E937E56DF201400:play],[OFF:RINCON_B8E937E56DF201400:pause]"}
Switch Next “Næste” (Sonos) {sonos="[ON:RINCON_B8E937E56DF201400:next]"}

Sitemap:
Frame {
Switch item=Play label=“Afspil”
Switch item=Next label=“Næste” mappings=[ON=“næste”]
Text item=Currenttrack label=“Aktuelt nummer”
}

Hi

No, I havnt got any reaction yet… nothings happings… the same with current track, I cant see anything on the browser…

Even with the new codes, i cant get the sonos to react

That’s strange, cause this is what is working on my side.

Could you please try the following :

Let your Sonos play something by using your smartphone app or desktop software.
When it’s playing, try to pause it through openhab with the switch item.

ohhhh… now somethings is working… now i can play / pause and next. but i sill cant current tract in the current track…

I just remembered that I had to do this after power-cycling my sonos. Before you can control play/pause etc. The sonos has to know what to play.
With upcoming version 1.8, you can set the source e.g. radiostation to play. Please read the WIKI how to do that.
According to currenttrack, this also depends on what you are playing currently.
Try to define an item to show the current title and see if this works.
If so, you can work through the different options to achieve what you want to be shown.

can you give me a hint to, how the code should look like regarding current track?

another thing, volume, can you also help with that…

how should the ITEM and SITEMAP look like?

Something like this maybe?

ITEM
Dimmer Volume “Volume” (Sonos) {sonos="[Percent:RINCON_B8E937E56DF201400:volume]"}

SITEMAP.
Slider item=Volume label=“Volume”