Sonos - how to switch to radio station?

2,125 views
Skip to first unread message

jk2...@web.de

unread,
Oct 13, 2013, 4:22:46 AM10/13/13
to ope...@googlegroups.com

Can anybody help to solve following idea.

Like in demo file for multimedia I would like to have a list of 3-5 Radio stations which can be easily selected and will play by selecting in sitemap.

My sonos binding works fine for other functionality, like plays, stop, mute, so no issues with binding itself.

I have created in demo.items following entry

String SO_Living_StationV "Radio Vitamine"     (SO_Living, gSonos)  {sonos=">[living:radio]", autoupdate="false"}

From what I understand only String is accepted for function "radio"

So how do I create a switch at the demo.sitemap for this radio station or lateron for a list of radio stations?

Jens

jk2...@web.de

unread,
Oct 16, 2013, 5:02:26 PM10/16/13
to ope...@googlegroups.com
Have tried following, but it does not work yet.

in file demo.items:
String     SO_Living_Station                (SO_Living, gSonos)  {sonos=">[living:radio]", autoupdate="false"}
Number  Sonos_Radio_Station           "Radio Station"            <network>

in file demo.sitemap:
Selection item=Sonos_Radio_Station mappings=[0="off", 1="BR3", 2="SWR3", 3="HR3"]

in file demo.rules:
/* Sonos Radio Station */
rule "Select Sonos Radio Station"
    when
        Item Sonos_Radio_Station received command
    then
        switch (receivedCommand)
        {
            case 0 : {
            postUpdate(SO_Living_Station, null )
            sendCommand(SO_Living_Station, null )
            }
           
            case 1 : {
            postUpdate(SO_Living_Station, "BR3")
            sendCommand(SO_Living_Station, "BR3")
            }
       
            case 2 : {
            postUpdate(SO_Living_Station, "SWR3")
            sendCommand(SO_Living_Station, "SWR3")
            }
       
            case 3 : {
            postUpdate(SO_Living_Station, "HR3")
            sendCommand(SO_Living_Station, "HR3")
            }
        }
end

Karel Goderis

unread,
Oct 17, 2013, 12:51:23 AM10/17/13
to ope...@googlegroups.com
Have you defined these radio stations in the "favorite radios" listing using the Sonos Controller?

K

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
For more options, visit https://groups.google.com/groups/opt_out.

jk2...@web.de

unread,
Oct 17, 2013, 4:12:02 AM10/17/13
to ope...@googlegroups.com
Hi Karel,

Thanks for your answer and help.

Yes, all radio stations are in sonos list of "favorite radios"

Got it working with the changes below, however not sure what the problem was.

However it looks like there is a problem with some radio stations, not sure why. Perhaps the string displayed for the radio station is not the "real" string.

Is there a way to read the strings from sonos favorite list (web interface or anything else) to check this?

Regards Jens


/* Sonos Radio Station */
rule "Select Sonos Radio Station"
    when
        Item Sonos_Radio_Station received command
    then
        switch (receivedCommand)
        {
            case 0 : {
            sendCommand(SO_Living_Station, "NDR N-Joy" )
            }
           
            case 1 : {
            sendCommand(SO_Living_Station, "BAYERN 3")
            }
       
            case 2 : {
            sendCommand(SO_Living_Station, "Radio Rivera")
            }
       
            case 3 : {
            sendCommand(SO_Living_Station, "Radio Vitamine") //does not work with this radio station
            //sendCommand(SO_Living_Station, "100 HIT radio") //works with this station
            }
        }
end
Message has been deleted
Message has been deleted

jk2...@web.de

unread,
Oct 17, 2013, 5:21:39 AM10/17/13
to ope...@googlegroups.com
SOLVED!!!

Follwing was the problem:

Radio station needs to be NOT in the "favorate radios" list BUT in list of "My radio stations"

My confusion was: Had all radio stations in both above mentioned lists, but new station "Radio Vitamine" only in "favorate list"

After added same station to list "my stations" it worked.
Now deleted new station in list "favorite stations" and it still works

so finding is: radio stations need to be ONLY in "my radio stations" list

So you pointed me into right direction.
Many thanks.

Now next challenge I face is following:
Want to select different groups of sonos devices, like 1=living-nogroup, 2=living+kitchen-group, 3=all-group
any ideas?

Regards
Jens


Am Donnerstag, 17. Oktober 2013 06:51:23 UTC+2 schrieb karel....@me.com:

Karel Goderis

unread,
Oct 17, 2013, 6:37:00 AM10/17/13
to ope...@googlegroups.com
Jens

On 17 Oct 2013, at 11:09, jk2...@web.de wrote:

SOLVED - Found the problem

Radio station needs to be NOT JUST in the "favorate radios" list BUT ALSO in list of "My radio stations"

All others which worked before had been already in both lists, only new radio station was added only to "favoritate radios" which caused the problem.

Ok - that's definitely a problem in the code then, because it seems that I query the two different lists at different locations. Can you open an issue for this on the issue list


So you pointed me into right direction.
Many thanks.

Now next challenge I face is foloowing:

Want to select different groups of sonos devices, like 1=living-nogroup, 2=living+kitchen-group, 3=all-group
any ideas?

Scripts and Rules for the time being, using the "add" and "remove" commands (define a String item with add command for 'living', then update that item with string through Rules in order to add a player to that player's group)


Regards
Jens

Am Donnerstag, 17. Oktober 2013 06:51:23 UTC+2 schrieb karel....@me.com:
Have you defined these radio stations in the "favorite radios" listing using the Sonos Controller?

K
Reply all
Reply to author
Forward
0 new messages