Sonos binding

Hello,

I have made a sonos binding with openhab. Now I want to execute the command for playing a certain radio station.
I have following code:

in the items:
Number Radio_Station "Radio" <network>
in the sitemap:
Selection item=Radio_Station mappings=[1=MNM, 2=JoeFM, 3=StuBru]
in the rules:
rule “Select Radio Station”
when
Item Radio_Station received command
then
switch(receivedCommand) {
case 1 : {sonos="[MNM:RINCON_B8E9375A1DFE01400:radio]"}
case 2 : {sonos="[JoeFM:RINCON_B8E9375A1DFE01400:radio]"}
case 3 : {sonos="[VRT Studio Brussel:RINCON_B8E9375A1DFE01400:radio]"}
}
end
this give and error in my log:

2016-01-04 13:45:31.156 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Select Radio Station2': org.eclipse.xtext.util.PolymorphicDispatcher$NoSuchMethodException: Couldn't find method ''_assignValue'' for objects [JvmVoid: (eProxyURI: default.rules#xtextLink_::0.2.1.2.0.0.1.1.1.0.0::0::/1), <null> sonos <XStringLiteralImpl>, [JoeFM:RINCON_B8E9375A1ECE01400:radio], org.eclipse.xtext.xbase.interpreter.impl.DefaultEvaluationContext@27cf0, org.eclipse.xtext.util.CancelIndicator$1@190bff9]

Does anyone know why it can’t execute the command?
Kind regards

You do not send any command to your Sonos in the switch-case-statement.

Maybe you could try the following:

A. Define a Sonos-radio-item:

String Sonos_playradio { sonos="[RINCON_B8E9375A1DFE01400:radio]" }

B. Change your rule to send a command to that item:

switch(receivedCommand) {
    case 1 : sendCommand(Sonos_playradio, "MNM")
    case 2 : sendCommand(Sonos_playradio, "JoeFM")
    case 3 : sendCommand(Sonos_playradio, "StuBru")
}

Keep in mind that you have to add these radio stations to your Sonos favorites list using the app.

done and working, Thanks !

Is there a reason you did not use the existing binding?
Maybe you should contact the developer and share your knowledge to improve the binding if it did not meet your needs.

Hello,

The Sonos binding is great and works fine.
Is it possible to get a channel to lock/unlock the touch elements on the devices?
Then the control during the lock state is only possible from the openhab widget or Spotify app.
Should avoid avoid stop the playlist in multiroom mode e.g. by guests or kids.

Kind regards
Tobi