Squeezebox favorites

Tags: #<Tag:0x00007f616e71dde8> #<Tag:0x00007f616e71dd20>

is it correct that the “playFavorite” channel is not updated when i change to another favorite direct on lms (and not from openhab)?

i have serverchannel “favoritesList” working and updated on every change:

the player-channes are ok except the playFavorite, this stays NULL as long as i do not send any command from openhab side:

background is that i don´t use habpanel, only the openhab-app. to be able to choose a favorite i added a webview of lms to the sitemap.

to enable the possibillity of a fast change of the favorites (from an external switch) i need to know the actual favorite number to be able to:
playfavorite.sendcommand(actualfavorite + 1)

another question: is there a way to find out how many favorites exist?

would be glad about help, thanks

I haven’t looked at the code in a while, but yes, I’m pretty sure that’s correct.

By “openhab-app”, do you mean Basic UI? If so, why not just use a Selection widget to expose and select from the favorites list? Or, is there something I’m not understanding?

You could count them in a rule using this code fragment…

    var Number numberOfFavorites = 0
    Source1_PlayFavorite.getStateDescription.getOptions.forEach[option |
        logInfo("test", "Option {}: {}", option.getValue, option.getLabel)
        numberOfFavorites = numberOfFavorites + 1
    ]
    logInfo("test", "Number of Favorites: {}", numberOfFavorites)
1 Like

thanks mhilbush, i´m glad about your answer :slight_smile:

yes i use basic ui. when i am right it is not possible to insert the favouritesList automatically in sitemap. so always when favourites change i have to update sitemap manually - not really a big problem but i wanted to have it more comfortable.

next problem for me is that the favouritesList is shown in logfile in onyl one entry and i cannot figure out how to split this:

2019-10-24 15:04:53.885 [ERROR] [el.script.Squeezebox Favoriten liste] - Squeezebox Favoriten geändert: 0=NJOY Radio,1=DASDING 98.9 (Euro-Hits),2=Absolut musicXL (Alternative Rock),3=SWR3 95.5 (Top 40/Pop),4=RT1 SÜDSCHWABEN 93.9 (Deutsche Musik),5=Ostseewelle HIT-RADIO Mecklenburg-Vorpommern (Adult Contemporary),6=fantasy lounge (Electro),7=bigFM Deutschland 89.5 (Top 40/Pop),8=1LIVE diggi (Top 40/Pop),9=ANTENNE BAYERN 92.6 (Adult Contemporary),10=ENERGY - HIT MUSIC ONLY ! (Top 40/Pop),11=Radio Arabella München 105.2 (Deutsche Musik),12=Radio 7 Ravensburg 101.8 (Top 40/Pop),13=MDR JUMP 90.4 (Adult Contemporary),14=MDR SPUTNIK 104.4 (Top 40/Pop),15=Bayern 3 98.4 (Hot AC),16=DONAU 3 FM 105.9 (Adult Contemporary),17=Virgin Radio Rock Switzerland (Schweiz),18=ANTENNE BAYERN Classic Rock Live (Deutschland),19=ROCK ANTENNE 94.5 (Rock),20=Bayern 1 91.3 (Hit-Klassiker),21=Absolut relax (Easy Listening),22=DONAU 3 FM Rock 105.9 (Hit-Klassiker)

i remark that i configured items manually and don´t know how to enable quoting on the favoritesList channel because i only found how to activate this for auto discovered items.

this i don´t get work, because my playFavourite item stays NULL - here i suppose i´m doing something wrong or i misunderstood: you write the playFavourite item will not be updated from lms, but how are you able to read out the number of favourites when i managed them from outside of openhab?

If you have an item linked to the player’s playFavorite channel, you can put that item on a Selection widget without the mapping tag. When rendered in Basic UI, it will pull the list from the channel’s state options. Like this.

Selection item=PlayerItem_PlayFavorite label="Play a Favorite"

That’s correct, the state of the item is not updated when a favorite is selected in the LMS. However, the player’s playFavorite channel state options contain the complete list of favorites defines in the LMS.

So, with an item defined on the player’s playFavorite channel, like this.

String                      Source1_PlayFavorite
                            "Play Favorite [%s]"
                            { channel="squeezebox:squeezeboxplayer:BD72319C-1EC2-4FD3-8A1C-877B6796A80C:b827ebc7d4cc:playFavorite" }

This sitemap widget should allow you to select from the list of favorites.

Selection item=Source1_PlayFavorite label="Play a Favorite"

that is exact what i would like to have but i´m not successfull. in basic ui when entering the site that i call “stationmanagement” it looks pretty normal:
grafik

when i click the arrow to open the favourites list the only thing that happens is that the whole site becomes a little grey but nothing else happens (tested in firefox and edge):
grafik

on openhab-app (android) i see this:

what am i doing wrong? my things file:

Bridge squeezebox:squeezeboxserver:squeezeboxServer [ ipAddress="x.x.x.x", webport=9000, cliport=9090 ]
{
    Thing squeezeboxplayer SqueezeboxPlayer [ mac="xx:xx:xx:xx:xx:xx", notificationTimeout=30, notificationVolume=75 ]
}

my items-file:

Switch iSbPlayer_AusEin "Squeezebox" { channel="squeezebox:squeezeboxplayer:squeezeboxServer:SqueezeboxPlayer:power" }
Player iSbPlayer_Funktionen "Navigation" <none> {channel="squeezebox:squeezeboxplayer:squeezeboxServer:SqueezeboxPlayer:control" }
Number iSbPlayer_Zufall "Zufallswiedergabe" <none> {channel="squeezebox:squeezeboxplayer:squeezeboxServer:SqueezeboxPlayer:currentPlaylistShuffle" }
Dimmer iSbPlayer_Laut "Lautstärke [%s]" { channel="squeezebox:squeezeboxplayer:squeezeboxServer:SqueezeboxPlayer:volume" }
String iSbPlayer_Titel "Titel [%s]" <microphone> { channel="squeezebox:squeezeboxplayer:squeezeboxServer:SqueezeboxPlayer:title" }
String iSbPlayer_Sender "Sender [%s]" <receiver> { channel="squeezebox:squeezeboxplayer:squeezeboxServer:SqueezeboxPlayer:remotetitle" }
String iSbPlayer_Favorit "Favorit Nr [%s]" <none> { channel="squeezebox:squeezeboxplayer:squeezeboxServer:SqueezeboxPlayer:playFavorite" }

String iSbServer_FavListe "Favoritenliste [%s]" { channel="squeezebox:squeezeboxserver:squeezeboxServer:favoritesList" }

and the sitemap:

Text label="Senderverwaltung" icon="squeeze"{
	Default item=iSbPlayer_Titel
	Default item=iSbPlayer_Sender
	Selection item=iSbPlayer_Favorit label="Play a Favorite"
}

I have the same issue… it does not seem to work unfortunately.

So, you have favorites defined in the LMS, and they’re not showing up as options on the player’s playFavorite channel? By any chance are you also using the Sony binding?

I do have an item
String SqueezeBoxServerFavoritesList "Favorites list" (gSqueezebox) {channel="squeezebox:squeezeboxserver:xxxxx:favoritesList"}

And I can see it contains my favorites.

The player has an item:

String SqueezeBoxPlayerVolumioJBPlayFavorite "Play a favorite" (gSqueezeboxBR) {channel="squeezebox:squeezeboxplayer:b5b2a51d:b827ebb5a6ed:playFavorite"}

and I put it in the sitemap like this:

Selection item=SqueezeBoxBathroomPlayFavorite label="Play Favorite"

I also confirm I have the new Sony binding (still in development) installed.

Do you have the very latest version? There was a fix that resolved an issue that prevented other bindings from getting their state options.

I have this:
324 │ Active │ 80 │ 2.5.4.202004131804 │ openHAB Add-ons :: Bundles :: Sony Binding

It is the latest one I could find… only 5 days old.

Ok, great. That version has the fix.

Have you restarted openHAB, or restarted the squeezebox binding, since installing the latest Sony binding? If not, could you please try that (first try restarting the squeezebox binding).

That worked! Wow, awesome! Thanks a lot :slight_smile:

1 Like

Excellent. The binding gets the favorites at startup, and whenever they are changed on the LMS. So once the sony binding fix was in, a restart of squeezebox caused squeezebox to get the favs.

Maybe a bit off-topic, but is it also possible (for a squeezebox-unrelated item) to define the selections in a rule and not in the sitemap?

You can get the state options from within a rule like this.

    YourItem.getStateDescription.getOptions.forEach[option |
        // Do stuff
    ]

Unfortunately I’m not aware of a way to set the state options.

I basically have the same issue yet no Sony binding installed.
My Server lists the Favorites (meanwhile eliminated all but one) yet the Selection item will only “grey out” the page and not show any states to select.

Logging does not yield anything. I basically copied the config in my item/sitemap files. Am I missing any pre-requisite to install?

Openhab is on 2.5.4

During the course of investigating the issue with the Sony binding, I found one other case where the favorites on the player’s playFavorites channel can be empty. There’s a timing issue at binding startup that can cause the problem. A fix for this issue will be in 2.5.5. If you want to try it sooner, a version with that fix is here.

Edit: This version also adds like/unlike for Pandora, Slacker, and other services that support rating songs.

Just tried the new version but it did not change my case. Is the Selection item supposed to work in Basic UI? Or only in Habpanel?

Isd a specific LMS software required? I am running 7.9.2

Yes. Both Basic UI and HABpanel.

7.9.2 is fine.

Using the console, can you put the binding in debug mode, then restart the binding? Post the resulting log here.

Also, please confirm you’re running the latest version.

openhab> list -s | grep squeeze
303 │ Active │  80 │ 2.5.5.202005011155      │ org.openhab.binding.squeezebox