Is there any way to select a playlist for a squeezebox in openhab 2? And what does playlistindex do? there is very little documentation and examples, unless i just cant find it. Also any example on playing a radio station? Im new so i dont know how to use the stream channel or how to find the radio ip.
Can’t help too much with openhab 2 as I’m still on 1.8 at the moment until it comes out of beta and has an apt-get install all done. It’s on the to do list with everything else.
It can be done on openhab 1 with playlists (it is manual with rules though). I’m pretty sure there is something with it and radio streams on the wiki as I did write some a while ago.
@joshpond80 There is a stream channel for openhab 2 but im fairly new and i have set up some different rules for other stuff so know a little thing or two about rules, but i dont know how to send the url to the squeezebox. There is no documentation for the stream channel. And i couldnt get the oh 1 rules to work. That though may be my fault, i dont know
I included the second thread because I have a post in there that describes how to play pandora stations thinking that the same approach might be used for radio stations.
Also realised that “val org.eclipse.xtext.xbase.lib.Functions$Function2” is giving me a notice that “Function2 is a raw type. References to generic type Function2<P1,
P2, Result> should be parameterized”
Its in the designer yes. Otherwise everything looks fine. Ive changed out the items, and the request url but still, doesnt work. Its on port 9002 if that matters?
And here it is inserted into the logitech URL. You need to replace hostname with the name or IP of your LMS server, replace MACaddress with the MAC address of the Logitech player, and replace 9000 with the port number for your LMS.
Still doesnt work. I get send to a page with simple controls over the radio and status of currently playing station. Here is my rule, if have time i’d appreciate if you could check it out
val String Squeeze_OliverMAC = “myadressehere”
val org.eclipse.xtext.xbase.lib.Functions$Function2 squeezePlayPlaylist = [
String player,
String playlist |
logInfo(“squeezeplaylist.rules”, "In squeezePlayPlaylist with player of " + player)
var String station
var String requestURL
var boolean success = true
switch(playlist) {
case “0” :
station = “http%3A%2F%2Fopml.radiotime.com%2FTune.ashx%3Fid%3Ds87164%26formats%3Daac%2Cogg%2Cmp3%2Cwmpro%2Cwma%2Cwmvoice%26partnerId%3D16%26serial%3Df29bc9c96a57a8e16b521da616db3839”
case “1” :
station = “spotify:track:124NFj84ppZ5pAxTuVQYCQ”
case “2” :
station = “http://opml.radiotime.com/Tune.ashx?id=s24861&formats=aac,ogg,mp3,wmpro,wma,wmvoice&partnerId=16&serial=2f8e3d8bf8c32452f470e9e55461fb14”
case “3” :
station = “pandora%3A%2F%2F79741376504106105.mp3”
case “4” :
station = “pandora%3A%2F%2F3230131829791886457.mp3”
case “5” :
station = “pandora%3A%2F%2F72031231602953337.mp3”
default : {
logError(“squeezeplaylist.rules”, “Received a request for an unknown playlist!”)
success = false
}
}
if (success == true) {
requestURL = “http://192.168.1.11:9002/status.html?p0=playlist&p1=play&p2=” + station + “&player=” + player
logInfo(“squeezeplaylist.rules”, "Sending playlist request to server: " + requestURL)
sendHttpGetRequest(requestURL)
}
]
rule “Squeeze_Oliver_Play_PlayList”
when
Item Squeeze_Oliver_Play_Playlist received command
then
logInfo(“squeezeplaylist.rules”, “Playing playlist on Oliver Squeezebox”)
squeezePlayPlaylist.apply(Squeeze_OliverMAC, receivedCommand.toString)
end
I’ve tried many things with the adresses, trial and error but nothing works out for me.The sitemap and items are just renamed to fit my layout. Ill check back tomorrow and try to figure it out.
Thank you very much for the help, much appreciated
Try pasting this into your web browser (after changing the hostname, port, and mac address to match your settings). It should play the College Sports Now radio station.
Go here, copy the radiotime URL into the box, and click encode. Then copy the encoded URL and paste it into your logitech URL after the p2= and before the &player=
Thanks @mhilbush. The url i get from the lms encoded now works in the direct url, but sadly not in the rule you provided. Any way to fix this issue? Or am i missing a obvious step here?
Thats exactly what i have. The items is that and this is the sitemap Selection item=Squeeze_Oliver_Play_PlayList label="Play a Playlist" mappings=[0="Playlist0", 1="Playlist1", 2="Playlist2", 3="Playlist3", 4="Playlist4", 5="Playlist5"]