Squeezebox favorites

I’m getting a bit weary of manually updating my playlists in HABpanel every time I add, change, or delete one on the LMS.

So, I’ve been thinking of extending the squeezebox binding to pull the list of Favorites from the Squeezebox Server. That way I’ll never need to update HABpanel when I change a playlist.

I already have a very basic prototype running on my test box.

Here’s what I’m considering:

  • add a new String channel to the SqueezeBoxServer thing called favoritesList
  • the list will be updated periodically (like every minute) with the most current favorites from the LMS
  • items linked to favoritesList will be populated with a comma-separated list of favoriteId=favoriteName
  • add a new String channel to the SqueezeBoxPlayer thing called favoritesPlay
  • items linked to favoritesPlay will cause a favorite to play when sent a command with a favoriteId

Favorites can reflect local music playlists, stations from streaming services like Pandora, Slacker, and Spotify, and streaming radio stations.

For this to work, HABpanel needs to be modified as described here.



Very cool.
Honestly, I have been using the squeezebox binding just for volume control and on/off for this very reason (just was not in the mood to manually keep playlists updated). The rest in my oh2 is mostly just automatically happening and hence I had not a lot of interactions with the UI of OH2 and did not get around to setup habpanel (despite it being cool and visually very appealing); this may just tip the balance and get me to work up a habpanel UI

As i don’t use HABpanel currently, would it possible to use the list somehow with BasicUI?

I also synchronize the list of favorites manually, having the favorites selectable in a sitemap is the most important feature with squeezeboxes here.

The mappings for the Selection widget would be the obvious place to do it, but I don’t think it’s possible to set those from an Item. Unfortunately, it looks like the mappings have to be hard-coded into the sitemap.


So, I have this working.

  • the SqueezeBox Server favorites channel (favoritesList) is updated immediately when the binding starts, and when the favorites list is updated on the LMS (lucky for me there’s a notification from the LMS when the favs are updated).
  • the channel is formatted with comma-separated values, like this:
1=Rock,2=Folk,3=Classic Alternative
  • there’s a config option that allows you to wrap the label with double quotes
1="Rock",2="Folk",3="Classic Alternative"
  • when you send the number to the SqueezeBoxPlayer channel (playFavorite), it plays the favorite on that player. Yay!
  • Right now, it just pulls the first level of favorites (the LMS supports a hierarchy of folders and favorites). I’m inclined to leave it like this, because 1) the way the LMS API works, supporting the hierarchy adds a good bit of complexity to the implementation, and 2) I’m not aware of any UI that will consume a hierarchy like that (it would require something other than the comma-separated list of choices, probably JSON). WDYT about this?

Speaking of UIs…

Now I just need a UI that can consume it!

1 Like

Great @mhilbush! :+1:

I would be nice, if this list could be sorted by name instead of favorite number/id.

I wouldn’t do this. Maybe an option to prefix the folder to the favorite name, then sorted by name (incl. prefix)
A simple list solves in my opinion at least 95% of the usage. Added complexity with a hierarchy just raises the bar for implementation and also usage in an UI.

Another idea would be to just import one favorite folder (incl. subfolder or not), to let the user choose the favorites to see in openHAB.

A workaround until the UIs are capable of this may be to do some sed magic to create a dynamic sitemap. Not sure if this is possible with HABpanel as well.

The order shown reflects the order of the favs on the LMS. The numbers are assigned sequentially based on that order. Since LMS lets you define the order (drag and drop works in the LMS web interface), would it be ok to define your preferred order in the LMS?

I’ll see if the LMS API provides a way to do this. Maybe if it’s a subfolder off the root, it might be possible.

I suppose you could write a rule that does a received update on the favorites list item, then exec a sed script to do the substitution on the sitemap. Shouldn’t be too difficult as long as you keep the Selection on one line (mine is currently split over 4 or 5 lines because it’s so long).

It’s completely ok. I must admit i did not use the favorites much, i’m just using playlists. I would have never thought this favorite number would be something else than static. :open_mouth:

I submitted a PR last night of an initial implementation. There’s some ongoing discussion about how to get that into sitemap and HABpanel. But, just copying the list manually is sweet.

I have a little rule that logs the favs whenever they change. Then I copy those directly into HABpanel. I think you can do the same with sitemap, just enable quoting in the server thing config.

rule "Favorites Updated"
    Item FavoritesList received update
    logInfo("favs-updated", "New favs: " + FavoritesList.state.toString)

If you decide to try it out, let me know if you run into issues.

The latest version of the PR pushes the favorites list to all players. The players then use that list to update the playFavorite channel’s state options. This means that you can use the “Server-provided item options” in the HABpanel selection widget and it will use the channel’s state options to populate the choices. :smile: The functionality to do that doesn’t exist in sitemap (yet).

String SBP_NJ_Office_PlayFavorite "Play a Favorite [%s]" { channel="squeezebox:squeezeboxplayer:36b70fd1:b827eb163f1e:playFavorite" }

Just FYI. This feature was merged today, so it should be in the next OH build.

Adding some instructions for how to set this up.

This feature should be in OH build 1208.

  • Add some favorites to your favorites list in LMS (local music playlists, Pandora, Slacker, Internet radio, etc.). Keep all favorites at the root level (i.e. favorites in sub-folders will be ignored).
  • Install latest OH build or get latest squeezebox binding
  • Delete and readd your squeezebox server and player things to pick up the new channels.
  • Create a new item on each player
String YourPlayer_PlayFavorite "Favs Play [%s]" { channel="squeezebox:squeezeboxplayer:36b70fd1:000420165ee2:playFavorite" }

For HABpanel (do this for each player):

  • Add a Selection widget to your dashboard
  • In Selection widget settings
    • enter the YourPlayer_PlayFavorite item
    • select Choices source of Server-provided item options
    • modify other settings to suite your taste
  • That should be it. When you load the dashboard and click on the selection widget, you should see the favorites. Selecting one will play it.

For Basic UI, the Selection widget doesn’t use the state options (yet). Setup can be done manually. If there’s interest, I can post the directions.

1 Like

Hi Mark,
how can I start a favorite playlist by rule? Could you please provide an example. Thank you.

Just FYI, OH build 1208 hasn’t been built yet, so none of this will work…

In a rule, the following will play the favorite whose id is “3”.


In a rule, you can get the entire favorite list one of two ways.

Using YourPlayer_PlayFavorite, you can do the following.

YourPlayer_PlayFavorite.getStateDescription.getOptions.forEach[option |
    logInfo("rule", "Favorite " + option.getValue + ": " + option.getLabel)

Using the favoritesList channel on the server you can do the following.

  • Define an item linked to the server’s favoritesList channel. This item will be updated when the binding starts, and whenever you change the favorites list on the LMS.
String YourServer_FavoritesList "Favs List [%s]" { channel="squeezebox:squeezeboxserver:36b70fd1:favoritesList" }
  • Then in a rule
rule "Server Favorites Updated"
    Item YourServer_FavoritesList received update
    logInfo("rule", "LMS list of favorites was updated: " + YourServer_FavoritesList.state.toString)

will generate a string of the form.

1=Rock,2=Folk,3=Classic Alternative

or, if you enable quoting on the favoritesList channel

1="Rock",2="Folk",3="Classic Alternative"

Using the latter, until the Basic UI Selection widget can use the state options for the choice list, you can copy that string directly into the Selection widget mappings in your sitemap, like this.

Selection item=YourPlayer_PlayFavorite label="Play a Favorite" mappings=[1="Rock",2="Folk",3="Classic Alternative"]

Hopefully, this is what you were looking for. If not, let me know.

1 Like

That’s exactly, what I was looking for. Thank you so much.
At least I need to wait for the build.

Please can you tell me, whats the difference between playFavorite and favoritePlay channel?

One time you speak of the first and one time you speak of the second.

Is this the same? Is playFavorite the only new channel?

Sorry, the channel was originally name favoritesPlay, but was changed to playFavorite during development. I believe I’ve fixed all the references to the old name.


I am trying to implment the favorites play option and am having issues - I get NULL for the favoritesList in the server.

  • The server is online.
  • The Radio is ON
  • The favorites list is not empty on the server and is in the root favorites folder
  • Created playFavorite for the Radio
String Squeezebox_Radio_playFavorite "Play Favorite [%s]" { channel="squeezebox:squeezeboxplayer:b5a75b44:0004202b7a24:playFavorite" }

When I run

smarthome:status Squeezebox_Server_favoritesList

it returns NULL

I am using HABPanel.

All other radio controls are working fine

In Paper UI, does the playFavorite channel show up in the list of channels?

No it does not. What does that mean? and how can I get it to appear?