Sonos binding help

Hi all.

I have posted some posts before, but i still have problems with connecting my sonos to OpenHAB. As it is now, I have 1 Sonos play 1 speaker for test. This sonos speaker I would like to get running before i go into the whole system that i want. The Sonos name is Sonos.The setup in config are right.

This is how it is now:

ITEM:
Group All
Group gIN (All)
Group gOU (All)
Group Shutters (All)
Group Weather (All)
Group Status (All)

Group IN_Stue “Stue” (gIN)
Group IN_kitchen “Køkken” (gIN)
Group IN_Bathroom “Badeværelse” (gIN)
Group IN_Toilet “Toilet” (gIN)
Group IN_Vicktoria “Vicktoria” (gIN)
Group IN_Bedroom “Soveværelse” (gIN)
Group IN_Guestroom “Gæsteværelse” (gIN)
Group IN_Office “Kontor” (gIN)
Group IN_Hall “Gang” (gIN)
Group IN_Entre “Forgang” (gIN)

Group OU_outlight “Udelys” (gOU)
Group OU_Garage “Garage” (gOU)
Group OU_Jazucci “Jazucci” (gOU)
Group OU_Garden “Haven” (gOU)

/* Musik */
Switch ledstatus “LedStatus” (Sonos) {sonos="[ON:S1:led], [OFF:S1:led]", autoupdate=“false”}
String currenttrack “CurrentTrack [%s]” (Sonos) {sonos="[RINCON_000E581369DC01400:currenttrack]", autoupdate=“false”}
String radiostation “RadioStation [%s]” (Sonos) {sonos="[S1:radio]", autoupdate=“false”}
Switch PlayLivingRoom “Play/Pause” (Sonos) {sonos="[ON:S1:play],[OFF:S1:pause]"}
Switch next “Next track” (Sonos) {sonos="[ON:S1:next]"}

Sitemap:
sitemap default label=“Plejlen 61”
{
Frame {
Group item=gIN label=“Inde” icon=“firstfloor”
Group item=gOU label=“Udenfor” icon=“garden”
}

Frame  {
		Switch item=S1 mappings=["ON"="play"]
		}

}

Your sitemap includes only one Sonos item “S1”, but I don’t see any item called “S1” in your items definition.

Best
Hans-Jörg

Hi

If I ask nice would you help me to make this work?

I need the sonos to do:

currenttrack
Play/Pause
Next track

the sonos unit is called S1

Reading the WIKI should have helped.

Sitemap
Frame {
Switch item=PlayLivingRoom mappings=[“ON”=“play”]
Switch item=next mappings=[“ON”=“next”]
Text item=currenttrack
}
This should work.
Best
Hans-Jörg

Sorry for asking again, but i sill cant get it to work… my log says:

2016-01-08 20:05:59.850 [WARN ] [.w.internal.servlet.CmdServlet] - Received command ‘TOGGLE’ for item ‘play’, but the item does not exist in the registry

I am not used to mapings but think to have found the issue:
Frame {
Switch item=PlayLivingRoom mappings=[ON=“play”]
Switch item=next mappings=[ON=“next”]
Text item=currenttrack
}

okay… what would you du insted of mappings?

Okay, sorry, I overlooked some errors in the items mapping. Please try this sitemap :

Frame {
Switch item=PlayLivingRoom mappings=[ON=“ON”]
Switch item=next mappings=[ON=“ON”]
Text item=currenttrack
}

no… its strange… im newbee… but now i have tried so many times… this is the code that i have now:

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

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

I edited my last post same time you posted again.
Please try the sitemap definition of my last post.
The mapping should be ON=“ON” for both switches

this is strange… i cant get it work…

Mu Rule folder is emty, but its schould be okay… i have only edited ITEM, SITEMAP and CONFIG

What do you expect in your rule folder ???

could you please again post your edited icon and sitemap definition as well as your logfile.

I dont expect anything, its was just if there schould something… but its emty…

Sonos Name from

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

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

CONFIG:
S1.udn=RINCON_B8E937E56DF201400

FROM SONOS SYSTEM:
ZoneName S1
ZoneIcon x-rincon-roomicon:living
Configuration 1
LocalUID RINCON_B8E937E56DF201400

didn’t you forget the “sonos:” prefix? I think it should be:

sonos:S1.udn=RINCON_B8E937E56DF201400

You could try to remove the “mappings” from the “Play” item in the sitemap and in the items file please try it with the correct case:

Switch Play “Play/pause” (Sonos) {sonos=“[ON:S1:play],[OFF:S1:pause]”}

→ lower case for the binding name and the commands “play” and “pause”

BTW: What messages are in your logfile?

Edited the config file to: sonos:S1.udn=RINCON_B8E937E56DF201400

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

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

LOG:
2016-01-09 00:33:26.816 [INFO ] [.o.u.w.i.servlet.WebAppServlet] - Started Classic UI at /openhab.app
2016-01-09 00:33:30.092 [INFO ] [.service.AbstractActiveService] - Sonos Refresh Service has been started
2016-01-09 00:33:30.409 [INFO ] [.b.sonos.internal.SonosBinding] - Querying the network for any other Sonos device
2016-01-09 00:33:30.423 [INFO ] [.b.sonos.internal.SonosBinding] - Querying the network for a predefined Sonos device with UDN ‘uuid:RINCON_B8E937E56DF201400’
2016-01-09 00:33:31.590 [INFO ] [.b.sonos.internal.SonosBinding] - Found a Sonos device (S1) with UDN uuid:RINCON_B8E937E56DF201400
2016-01-09 00:33:36.111 [INFO ] [c.internal.ModelRepositoryImpl] - Loading model ‘demo.rules’
2016-01-09 00:33:36.151 [WARN ] [c.internal.ModelRepositoryImpl] - Configuration model ‘demo.rules’ is either empty or cannot be parsed correctly!
2016-01-09 00:34:46.174 [INFO ] [c.internal.ModelRepositoryImpl] - Refreshing model ‘demo.items’
2016-01-09 00:40:36.314 [INFO ] [c.internal.ModelRepositoryImpl] - Refreshing model ‘default.sitemap’
2016-01-09 00:40:47.595 [WARN ] [.w.internal.servlet.CmdServlet] - Received unknown command ‘off’ for item ‘Play’
2016-01-09 00:41:36.349 [INFO ] [c.internal.ModelRepositoryImpl] - Refreshing model ‘default.sitemap’
2016-01-09 00:41:37.421 [WARN ] [.w.internal.servlet.CmdServlet] - Received unknown command ‘off’ for item ‘Play’
2016-01-09 00:41:38.396 [WARN ] [.w.internal.servlet.CmdServlet] - Received unknown command ‘off’ for item ‘Play’
2016-01-09 00:42:16.378 [INFO ] [c.internal.ModelRepositoryImpl] - Refreshing model ‘default.sitemap’
2016-01-09 00:42:46.395 [INFO ] [c.internal.ModelRepositoryImpl] - Refreshing model ‘default.sitemap’

in the event log i now recive:

2016-01-09 00:50:08 - Play received command ON
2016-01-09 00:50:10 - Play received command ON
2016-01-09 00:50:14 - Play received command OFF
2016-01-09 00:50:17 - Play received command ON
2016-01-09 00:51:19 - Play received command OFF
2016-01-09 00:51:20 - Play received command OFF
2016-01-09 00:51:22 - Play received command ON

i just started the start.bat again, and now i can see in the event log:

2016-01-09 00:59:16 - play received command OFF
2016-01-09 00:59:21 - play received command ON
2016-01-09 00:59:24 - next received command ON
2016-01-09 01:00:19 - currenttrack state updated to Juicy M - - Yearmix 2015 vol. 2 (JuicyLand #132)

but i cant controll anything yet

In my last post I wrote that the mapping shall be ON=“ON”, but this is not what you have in your sitemap.
Sitemap:
Frame {
Switch item=Play label=“Afspil”
Switch item=Next label=“Næste” mappings=[ON=“ON”]
Text item=Currenttrack label=“Aktuelt nummer”
}

okay… now its like that:

SITEMAP
Frame {
Switch item=play label=“Afspil”
Switch item=next label=“Næste” mappings=[ON=“on”]
Text item=currenttrack label=“Aktuelt nummer”
}

ITEM
String currenttrack “Aktuelt nummer [%s]” (Sonos) {sonos="[RINCON_B8E937E56DF201400:currenttrack]", autoupdate=“false”}
Switch play “Play/pause” (Sonos) {Sonos="[on:S1:play],[off:S1:pause]"}
Switch next “Næste” (Sonos) {Sonos="[on:S1:next]"}

LOG:
192.168.0.13 - - [09/jan/2016:00:14:24 +0000] “GET /CMD?play=TOGGLE&__async=true&__source=waHome HTTP/1.1” 200 13
192.168.0.13 - - [09/jan/2016:00:14:19 +0000] “GET /openhab.app?sitemap=default&poll=true&__async=true&__source=waHome HTTP/1.1” 200 1286
192.168.0.13 - - [09/jan/2016:00:14:23 +0000] “GET /openhab.app?sitemap=default&poll=true&__async=true&__source=waHome HTTP/1.1” 200 1286
192.168.0.13 - - [09/jan/2016:00:14:24 +0000] “GET /images/switch-on.png HTTP/1.1” 304 0
192.168.0.13 - - [09/jan/2016:00:14:24 +0000] “GET /WebApp/Design/Img/button-back.png HTTP/1.1” 304 0
192.168.0.13 - - [09/jan/2016:00:14:24 +0000] “GET /WebApp/Design/Img/button-simple.png HTTP/1.1” 304 0
192.168.0.13 - - [09/jan/2016:00:14:17 +0000] “GET /openhab.app?sitemap=default&poll=true&__async=true&__source=waHome HTTP/1.1” 200 1286
192.168.0.13 - - [09/jan/2016:00:14:32 +0000] “GET /CMD?play=TOGGLE&__async=true&__source=waHome HTTP/1.1” 200 13
192.168.0.13 - - [09/jan/2016:00:14:24 +0000] “GET /openhab.app?sitemap=default&poll=true&__async=true&__source=waHome HTTP/1.1” 200 1275
192.168.0.13 - - [09/jan/2016:00:14:32 +0000] “GET /images/switch-off.png HTTP/1.1” 304 0
192.168.0.13 - - [09/jan/2016:00:14:33 +0000] “GET /CMD?next=ON&__async=true&__source=waHome HTTP/1.1” 200 13
192.168.0.13 - - [09/jan/2016:00:14:32 +0000] “GET /openhab.app?sitemap=default&poll=true&__async=true&__source=waHome HTTP/1.1” 200 1278
192.168.0.13 - - [09/jan/2016:00:14:34 +0000] “GET /CMD?next=ON&__async=true&__source=waHome HTTP/1.1” 200 13
192.168.0.13 - - [09/jan/2016:00:14:34 +0000] “GET /openhab.app?sitemap=default&poll=true&__async=true&__source=waHome HTTP/1.1” 200 1278

Event log:

2016-01-09 01:12:16 - next received command ON
2016-01-09 01:13:55 - currenttrack state updated to Juicy M - - Yearmix 2015 vol. 2 (JuicyLand #132)
2016-01-09 01:14:24 - play received command ON
2016-01-09 01:14:32 - play received command OFF
2016-01-09 01:14:33 - next received command ON
2016-01-09 01:14:34 - next received command ON

So is it working then ?