On line radio

Hallo to all,

I’m new here and playng with tis nice fully featured softuare.
Unfortunately I’m facing a small problem, like I can not add/edit radio stations in multimedia section.
Actualy rule section looks like this:

rule “Select Radio Station”
Item Radio_Station received command
switch(receivedCommand) {
case 0 : playStream(null)
case 1 : playStream(“http://metafiles.gl-systemhaus.de/hr/hr3_2.m3u”)
case 2 : playStream(“http://www.radio21.ro/Radio21Live.m3u”)
case 3 : playStream(“http://edge.live.mp3.mdn.newmedia.nacamar.net/radioffh/livestream.mp3.m3u”)
case 4 : playStream(“http://stream.hitradio-rtl.de/HRRTL/mp3.m3u”)

.sitemap looks like this:

Text label=“Multimedia” icon=“radio” {
Frame label=“Radio Control” {
Selection item=Radio_Station mappings=[0=off, 1=HR3, 2=r21, 3=FFH, 4=hRTL]
Slider item=Volume

But when I chose option 2 or 4 is nothing playing.

Does anyone have any ideea? Any answer will be aprecieted.

1 Like

First let’s get the basics out of the way.

  • Are the URL’s valid? From a clean browser can you launch these streams without logging in? OH has its own web client built in so it will not have access to any authentication tokens or cookies or anything that might be needed to access some or all of these streams.
  • Is the volume turned up and speakers working on your openHAB server? NOTE that playStream will play through the openHAB server’s speakers, not through the speakers of whatever computer or phone you have accessed the sitemap from.
  • Is Radio_Station actually getting set to these expected states? Add a logInfo to print out receivedCommand to make sure that it is being set as you expect.
  • Is the rule being triggered at all? Again, a logInfo can help answer that.

Thank you for the fast answer.

  1. yes, the URL’s are valid
  2. I run OH on raspberry PI2 which is connected via HDMI to an TV, for the moment because is still in testing.
  3. OH takes the command as long for the radio station 1 and 3 he plays the expected link. But when I change to 2 and 4, it stops, like the link is “dead”.
  4. idem

Any forward help wold be appreciated

Given that I would say there is something about the links for 2 and 4 that the code in openHAB to play them can’t handle.

hr3 and hitradio rtl seem to be mpeg1 Layer 2 Stereo @ 128kBit/s,
ffh is mpeg1 Layer2 Stereo @ 64kBit/s and
Radio21 is AAC Stereo (mp4a) 48k with SBR

So between hr3 and Hit Radio RTL is no difference, but when I select Hit Radio RTL is not working…

Hi guys, a bit late but does anyone know how to i get this widget to my openhab2 paper ui ,server based on pc? is there any addon for this or smth?

Configuration should work the same way as in openHAB1, use an unbound number item to select the radio station (through selection widget) and use a rule to switch to the station ‘for real’.

Which internet radio do you use?

im not sure yet , just wanted to create some list with different radios. but not so sure how should i do it. do i need to make .rules conf file with like the top post have and radio.sitemap too ?

I meant the hardware :slight_smile:

erm, i was hoping that if i set radio to play my Kodi homecenter would play it on tv

That should definitely be possible :slight_smile:

I don’t have a kodi system here (well, in fact, I have… yavdr…, so, I actually have kodi, but I make no use of it, as I only use the vdr part).

You have to install the kodi binding, and there will be a channel named playuri, which would be used to send the stream url to the kodi system. In fact, the kodi instances would be registered as audio sinks, so audiostreams would be sent to kodi when used as audio sink, but I did not test this yet.

The “rule way” would be to create some items:

Number Radio_Station "Station [%d]" 
String MyKodiUri "Kodi URI [%s]" {channel="kodi:kodi:myKodi:playuri"}

a sitemap (snippet):

        Selection item=Radio_Station mappings=[0="off", 1="HR3", 2="r21", 3="FFH", 4="hRTL"]

and a rule:

rule "Select Radio Station"
    Item Radio_Station received command
    switch(receivedCommand) {
        case 0 : MyKodiUri.sendCommand(null)
        case 1 : MyKodiUri.sendCommand("http://metafiles.gl-systemhaus.de/hr/hr3_2.m3u")
        case 2 : MyKodiUri.sendCommand("http://www.radio21.ro/Radio21Live.m3u")
        case 3 : MyKodiUri.sendCommand("http://edge.live.mp3.mdn.newmedia.nacamar.net/radioffh/livestream.mp3.m3u")
        case 4 : MyKodiUri.sendCommand("http://stream.hitradio-rtl.de/HRRTL/mp3.m3u")

I don’t know, if MyKodiUri.sendCommand(null) would work as expected, but sure you would want play and stop button for kodi and could use these items to stop the playback anyway.
Please be aware that kodi is playing back the stream, so kodi must be capable to play the stream without openHAB (well, this should be no problem at all…)

i understand that i cant do that in paper ui ? i have to make some conf files right ?

Yes, at least rules and sitemap are conf-file-only.
I’m not sure about unbound items (the Radio_Station item is not bound to any binding, so I call it unbound), the other item could be created via Paper UI, maybe (if simple mode is true… Paper UI-> Configuration-> System-> Item Linking-> Simple Mode) the item is already existing, if kodi and its binding was configured through auto discovery.