Squeezebox favorites

Tags: #<Tag:0x00007faf7edcebc0> #<Tag:0x00007faf7edcea30>

Please run this on the console and report back the output.

services | grep StateDescriptionProvider

Hi Mark,

Thanks for helping me!

This is the output:

[org.eclipse.smarthome.core.thing.type.DynamicStateDescriptionProvider, org.openhab.binding.mqtt.generic.MqttChannelStateDescriptionProvider]
[org.eclipse.smarthome.core.thing.type.DynamicStateDescriptionProvider, org.openhab.binding.sonos.internal.SonosStateDescriptionOptionProvider]
[org.eclipse.smarthome.core.thing.type.DynamicStateDescriptionProvider, org.openhab.binding.squeezebox.internal.SqueezeBoxStateDescriptionOptionsProvider]

Those bindings all have well-behaved StateDescriptionProviders, so that doesn’t appear to be an issue.

And from the log you posted, the SqueezeBoxServerHandler clearly is sending the favorites to the Player Handler.

Can you share your item and sitemap definitions for the Player Handler’s playFavorite channel?

Also, if you have an item linked to the SqueezeBox Server’s favoritesList channel, can you share the state of that item?

From the console, run this and post the result.

smarthome:items list | grep NameOfTheItem

The output from the console:

wkradio_fav (Type=StringItem, State=NULL, Label=Play Favorite, Category=null)

Item:

String wkradio_fav    "Play Favorite [%s]"  { channel="squeezebox:squeezeboxplayer:squeezeserver:b827eb422cf4:playFavorite" }

Sitemap:

Selection item=wkradio_fav label="Favorites" icon="office"

Item and sitemap look OK.

But I actually was looking for the state of the server’s favoritesList channel.

Also, can you try doing a restart of the binding.

bundle:restart org.openhab.binding.squeezebox

The output for the server:

serverfav (Type=StringItem, State=NULL, Label=null, Category=null)

And if i change the checkbox in PaperUI:

serverfav (Type=StringItem, State=0="NPO Radio 2",1="Omroep Venlo",2="Radio 10 103.8 (Classic Hits)",3="Arrow Classic Rock (Classic Rock)", Label=null, Category=null)

The favorites do show up and are working in my player in the PaperUI btw.

Restart does not change anything, tried it several times.

I’m running out of ideas…

Can you try removing the label tag on the sitemap Selection widget?

Tried removing label, icon and restart the binding, but nothing happens…
And i ran out of ideas a few hours ago :wink:

I’m now officially out of ideas. If I can think of anything else to try I’ll post back here.

Thanks for your help, i’ll try installing a second raspberry pi and try some more.

Hi! Some update from myself after upgrading Openhab to latest version. So, after I did it OH restarted and the favorites don’t show under their assigned item. However they are going back when I add or remove one of the favorites on LMS. I didn’t try restarting LMS so I can’t tell now if this would be enough. Restart of OH doesn’t fix it. I don’t know how it works, but does the binding request for favorities update when starting?

The binding requests the favorites when the binding starts, and when the favorites are changed on the LMS.

In the released version of the binding, there’s a race condition at startup where sometimes the player handler is not fully initialized when the server handler tries to send it the favorites. This is fixed in a PR that hasn’t been merged yet.

1 Like

Found your question looking for the same answer. As I did not liked the answer, and I dont know if you are still looking for it, but I found a workaround, all you have do do is copy the URI from the playlist, as a share, in the spotify app, and create a favorite with a name you can give and URI you just got on the LMS interface. Worked for me

1 Like

Thanks for sharing.
Will try it out next time OH gets some TLC :slight_smile:

Hi there

I’m using this functionality booth in rules and sitemaps superb jobb. Maybe I’m missing something in my rule functionality, but I woluld like to find a way to send Favorites Name and not only ID wich I can now. I have a special button triggering my morning routine starting radio and send a messeage containing temperature and stuff.


squeezekokfavorite.sendCommand(“1”)
sendBroadcastNotification(“Lugna favoriter” + squeezekokfavorite.state.toString)

You should be able to pull the favorites list from the favoritesList channel of the squeezebox server thing, then use the ID to lookup the favorite name. You would need to first split the list on "," to create an array of favorites, then iterate through the favorites splitting each favorite on "=" to separate the id from the name. I can post a code snippet if you’re not sure how to do this.

Something like this:

    val String theOne = "1"

    for(String favorite : FavoritesListItem.state.toString.split(",")) {
        val String[] fav = favorite.split("=")
        val String id = fav.get(0)
        val String name = fav.get(1)
        //logInfo("test", "(id,name) = ({},{})", id, name)
        if (theOne.equals(id)) {
            // Do something with name
        }
    }

Hi Mark

Thanks for your example I would never figured that out myself. Right now I’ve got it working sort of, but allways get Favorit number one in my messeage, I assume that have something to do with the one val. But no idea how to make it better.

05:50:25.026 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘squeezekokfavorite’ received command 2
05:50:25.058 [INFO ] [arthome.event.ItemStatePredictedEvent] - squeezekokfavorite predicted to become 2
05:50:25.159 [INFO ] [smarthome.event.ItemStateChangedEvent] - squeezeKokPower changed from OFF to ON
05:50:25.498 [INFO ] [smarthome.event.ItemStateChangedEvent] - squeezeKokControl changed from PAUSE to PLAY
05:50:25.502 [INFO ] [g.eclipse.smarthome.model.script.test] - (id,name) = (1,Lugna Favoriter)
05:50:25.503 [INFO ] [smarthome.event.ItemStateChangedEvent] - squeezeKokPlay changed from OFF to ON
05:50:25.515 [INFO ] [g.eclipse.smarthome.model.script.test] - (id,name) = (2,Vinyl FM)
05:50:25.524 [INFO ] [g.eclipse.smarthome.model.script.test] - (id,name) = (3,Rockklassiker)
05:50:25.532 [INFO ] [g.eclipse.smarthome.model.script.test] - (id,name) = (4,Bandit Rock)
05:50:36.347 [INFO ] [smarthome.event.ItemStateChangedEvent] - g1_Innetemp changed from 15.25 to 15.37