[SOLVED] Yamaha Net Radio Problem

Hi there,

im trying to get Net Radio with one Click working. I have a RX-V775 and get to know that there is no preset saving with Netradio due the Airplay functionality. So im searching for another way. The yamaha Binding has a navigation_channels#navigation_select option but i dont know how to invoke this. If i get this working i could switch to NET Radio input an send the Selection command three times and it will play my first radio station.

Could someone explain how to send the selection command to the receiver?

Thanks!

Hey @Julian0o I am not aware of the net radio and air play issue you refer to.

Maybe you could elaborate on your use case? Do you want to save or just select NET RADIO presets?

I have an AirPlay and NET RADIO enabled receiver (RX-S601D) and I was able to select NET_RADIO presets just fine. You first select the NET RADIO as input channel, then select the desired NET RADIO preset. Here is my setup:

Items:

String		Yamaha_Input		"Input [%s]"				<video>					(Cinema)								{ channel="yamahareceiver:zone:yamaha:Main_Zone:zone_channels#input" }

Number		Yamaha_Preset		"Preset [%d]"				<video>					(Cinema)								{ channel="yamahareceiver:zone:yamaha:Main_Zone:playback_channels#preset"}

Sitemap:

                Selection	item=Yamaha_Input				mappings=[HDMI6="Kodi",HDMI2="PC",AUDIO1="TV",TUNER="Tuner",Spotify="Spotify",Bluetooth="Bluetooth","NET RADIO"="NetRadio",AirPlay="AirPlay"]

            Frame label="Playback" visibility=[Yamaha_Input=="NET RADIO"] {
                Switch		item=Yamaha_Playback 			mappings=["Play"="►", "Stop"="⏹"]
                Selection	item=Yamaha_Preset				mappings=[1="Chilli Zet",2="Polskie Radio 24"]
            }

Please note that for the preset to work, you first have to save your favorite stations on the receiver (outside of openHAB). To have one button click experience, you could create a virtual String item, have a Switch button for it in the UI, whey you press a rule is activated that sets these two channels accordingly…

I remember that on one older model RX-V3900 the presets names that the device requires when sending a command to it are A1, A2 (instead of numbers as shown above) - there is a workaround for this to name the channels 101 (for A1), 202 (for B2) etc. I doubt you running into this. On the channel preset manual are more details for that.

Again, all what I said above was tested and applies to 2.4.0-SNAPSHOT (developer version), so you would have to upgrade. There were some issues with NET RADIO preset in 2.3.0 as I remember.

Hi, thats the Problem. For the RX-V775 you cannot safe a net radio station to a preset by pressing the memory button on the receiver. you have to select the net radio input and the push the OK/Select Button on your remote to play the first radio station. thats very ugly but - in my opinion - the only way to automate this. I will push one button to power on my AVR and play net radio via the Rule engine. And for this i have to know how to invoke the Select Button.

Did you try linking your yamaha with the online account and managing the favorite stations there? This is the starting page:
http://yradio.vtuner.com/setupapp/yamaha/asp/AuthLogin/SignIn.asp?sLogoutType=OUTCOMPLETE&lngy=&sAuthErr=sp1&sAuth=

You sign up using your Yamaha MAC number or serial. Check out your device manual.

Yes i did this. Thats the only way to get the stations in the menu. But its not linked with the preset numbers.

I have an RX-V675 and my conclusion is the same as @Julian0o described.

I read the manual several times, but after selecting the “Net Radio”-source, the only was to get sound out of the speakers, I need to push OK/Enter 3 times (first time for “bookmarks”, second time for “favorites” and third time to select the first radio station).

I really hope for a solution.

Regards Jaco

I have the same issue with my RX-V675. To be able to control internet radio stations from Openhab, I am using a trick: Instead of using the bookmark feature built into the receiver, I instruct the receiver to play a certain stream via DLNA.

The only problem is that Openhab can not control DLNA devices diretly, instead I’m using a script called dlanp (see https://github.com/cherezov/dlnap). To play a stream on your receiver, simply run ./dlnap.py --ip <receiver_ip> --play <stream_url>. I’m assuming you are on a Linux box. Playback only works if a stream ends in “.mp3”, more on this later. If playback does not start with your stream, make sure that the receiver input source is set to “SERVER” (press “NET” on remote control multiple times until the display shows “SERVER”) and try disabling the firewall on your computer (iptables blocks the necessary ports by default).

After you verified that you can instruct your receiver to play a stream, create a mapping file in (e.g. tuner.map) in conf/transform. Example from my setup:

Radio\ Bob!=http://streams.radiobob.de/bob-shlive/mp3-192/vtuner.mp3
R.SH=http://streams.rsh.de/rsh-live/mp3-192/vtuner.mp3
Delta\ Radio=http://streams.deltaradio.de/delta-live/mp3-128/vtuner.mp3
N-JOY=http://ndr-njoy-live.cast.addradio.de/ndr/njoy/live/mp3/128/stream.mp3
NDR\ Blue=http://ndr-ndrblue-live.cast.addradio.de/ndr/ndrblue/live/mp3/128/stream.mp3
Kiel.FM=http://radio.oksh.de:8000/kielfm.mp3
Radio\ Bob!\ 90er\ Rock=http://streams.radiobob.de/bob-90srock/mp3-192/vtuner.mp3

As mentioned before, the streams have to end in “.mp3”. To get valid streams, go to the vTuner website, log in with your tuner’s MAC address and navigate to the stream you would like to add. Click the play button and choose to save the “.m3u” file. Open the file. If it contains something like http://streams.<abcd>/<efgh>-live/mp3-192/vtuner/, you are lucky. Simply remove the last forward slash and replace it by “.mp3”. If you don’t see that format, you have to find a valid stream by other means (e.g. the station’s homepage).

After you assembled the list of stations, create string item that holds the current station:

String VirtualRadio_Station "Radio Station"

The create a rule to change the station:

rule VirtualRadioChangeStation
when
    Item VirtualRadio_Station received update
then
    var stream = transform("MAP", "tuner.map", VirtualRadio_Station.state.toString())
    executeCommandLine("/usr/bin/python /path/to/dlnap.py --ip <receiver_ip> --play " + stream)
end

Make sure to replace “/path/to/dlnap.py” and “<receiver_ip>” by the values suitable for your setup.

I control the radio station from Habpanel via “selection” widget, where I list the names of radio stations from tuner.map.

This is basically it. I hope it helps somebody.

PS: My setup is slightly more complicated. For example, I added a switch item that indicates that the “virtual radio” is on/off. Sending “ON” to that item also starts playing the stream which was last set. If you are interested, I can post my full setup.

2 Likes

Nice! That sounds like a very good solution for our Problem. I’d like to have your full setup!

Gladly. I assume you have the Yamaha binding configured and the main zone is working. I use an update interval of 1 second. For the “virtual radio tuner”, I use three channels of the Yamaha thing:

// These items are connected to channels of the Yamaha main zone thing.
// They are not actually defined in the config files, but via PaperUI.
Switch WohnzimmerYamahaReceiver // connected to "Power"
String WohnzimmerYamahaReceiver_Input // connected to "Input source"
Dimmer WohnzimmerYamahaReceiver_Volume // connected to "Volume"

Additionally, I defined two more items in my items config files (you can ignore the groups):

// These two items are defined in the items file and are belong
// to the "virtual radio":
// The first is a "power switch" for the virtual radio:
Switch WohnzimmerVirtuellesRadio "Radio" (gZ_Wohnzimmer, gF_Multimedia)
// The second is a string that stores the current station:
String WohnzimmerVirtuellesRadio_Station "Radiosender" (gZ_Wohnzimmer, gF_Multimedia)

I use a file called “vtuner.map” in conf/transform to map station names to stream URLs:

Radio\ Bob!=http://streams.radiobob.de/bob-shlive/mp3-192/vtuner.mp3
R.SH=http://streams.rsh.de/rsh-live/mp3-192/vtuner.mp3
Delta\ Radio=http://streams.deltaradio.de/delta-live/mp3-128/vtuner.mp3
N-JOY=http://ndr-njoy-live.cast.addradio.de/ndr/njoy/live/mp3/128/stream.mp3
NDR\ Blue=http://ndr-ndrblue-live.cast.addradio.de/ndr/ndrblue/live/mp3/128/stream.mp3
Kiel.FM=http://radio.oksh.de:8000/kielfm.mp3
Radio\ Bob!\ 90er\ Rock=http://streams.radiobob.de/bob-90srock/mp3-192/vtuner.mp3

Now, most of the magic happens in the rules of course:

// This rule turns on the receiver, sets the input to "SERVER" and sets
// an appropriate volume if the virtual radio power switch
// (item WohnzimmerVirtuellesRadio) is turned on. It then plays the stream
// according to the station name in item WohnzimmerVirtuellesRadio_Station.
rule WohnzimmerVirtuellesRadioAn
when
    Item WohnzimmerVirtuellesRadio changed from OFF to ON
then
    if (WohnzimmerYamahaReceiver.state == OFF){
        WohnzimmerYamahaReceiver.sendCommand(ON)
    }
    WohnzimmerYamahaReceiver_Input.sendCommand("SERVER")
    WohnzimmerYamahaReceiver_Volume.sendCommand(20)
    var stream = transform("MAP", "vtuner.map", WohnzimmerVirtuellesRadio_Station.state.toString())
    executeCommandLine("/usr/bin/python /usr/bin/dlnap.py --ip 192.168.178.12 --play " + stream)
end

// This rule turns the receive off if the virtual radio is turned off.
rule WohnzimmerVirtuellesRadioAus
when
    Item WohnzimmerVirtuellesRadio received command OFF
then
    WohnzimmerYamahaReceiver.sendCommand(OFF)
end

// If the receiver is turned off (by remote, other rules...), set the virtual
// radio power to off.
rule WohnzimmerVirtuellesRadioYamahaAus
when
    Item WohnzimmerYamahaReceiver changed from ON to OFF
then
    WohnzimmerVirtuellesRadio.postUpdate(OFF)
end

// This is the most essential rule. It is triggered when the station is
// changed and starts playing the station's stream. It will trigger the
// rule WohnzimmerVirtuellesRadioAn (the first one) if the virtual
// radio was previously off.
rule WohnzimmerVirtuellesRadioAndererSender
when
    Item WohnzimmerVirtuellesRadio_Station received update
then
    if (WohnzimmerVirtuellesRadio.state == OFF){
        WohnzimmerVirtuellesRadio.sendCommand(ON)
    }
    var stream = transform("MAP", "vtuner.map", WohnzimmerVirtuellesRadio_Station.state.toString())
    executeCommandLine("/usr/bin/python /usr/bin/dlnap.py --ip 192.168.178.12 --play " + stream)
end

// If the receiver input is set to an input other than "SERVER", set the
// virtual radio power to off.
rule WohnzimmerVirtuellesRadioAndererEingang
when
    Item WohnzimmerYamahaReceiver_Input changed
then
    if (WohnzimmerYamahaReceiver_Input.state.toString() != "SERVER"){
        WohnzimmerVirtuellesRadio.postUpdate(OFF)
    }
    else {
        WohnzimmerVirtuellesRadio.postUpdate(ON)
    }
end

// This is a convenience rule. We have really bad FM reception at our place,
// so whenever the receiver's tuner is selected, (e.g. by remote), the rule
// will immediately switch to one of the streams.
rule WohnzimmerVirtuellesRadioTunerAn
when
    Item WohnzimmerYamahaReceiver_Input changed
then
    if (WohnzimmerYamahaReceiver_Input.state == "TUNER") {
        WohnzimmerVirtuellesRadio_Station.sendCommand("Radio Bob!")
    }
end

The station can be changed via Habpanel and a slection in a sitemap, that is defined like this:

Selection item=WohnzimmerVirtuellesRadio_Station label="Radiosender" mappings=["Radio Bob!"="Radio Bob!", "Delta Radio"="Delta Radio", "N-JOY"="N-JOY", "NDR Blue"="NDR Blue", "R.SH"="R.SH", "Kiel.FM"="Kiel.FM"]

That’s all! If you have questions or comments, feel free to ask!

2 Likes

Thank you! I will try this but looks promising!

One Question. Does openhabian play the stream every time? I see no stopping of the stream in your rules. This would couse a 24/7 playback of the stream.

EDIT: I think you should put this comand in your OFF Rules

    executeCommandLine("/usr/bin/python /usr/bin/dlnap.py --ip xxx.xxx.xxx.xxx --stop")

I don’t think that is necessary. The openhab machine is not playing anything. The command

dlnap.py --ip <receiver_ip> --play <stream_url>

instructs the receiver to access that URL and play the stream. You could even turn off your machine that runs openhab, the receiver will keep playing. When you turn the receiver off, it just stops playing and drops the connection to the stream server. The same happens when you switch to another input. There is one issue when switching back to the “SERVER” input though: the receiver does not seem to clear its buffer when it drops the connection. So on switching back to “SERVER”, the playback will continue where it stopped, play until the buffer is empty, pause a second and then play the live stream. At least that is what I experience.

EDIT: In DLNA terms, Openhab/dlnap.py is called a “controller” (DMC), while the receiver is a “renderer” (DMR). See https://en.wikipedia.org/wiki/Digital_Living_Network_Alliance#Home_Network_Devices for details.

I love you Sven! :-* Thank you so much. This works like a charm and is a better solution than with the presets. It’s very fast.

Greetings!

Glad I could help!

Great solution @Sven_Festersen - thanks!

As an off topic, I wonder about the navigation channels of the yamaha addon - if anyone is using it nowadays?
I don’t know of any good example how to put it to work and I don’t use it myself. At some point I tired to get it configured, but I felt it wasn’t working for my model. If you have a working example of navigation @Julian0o and @Jaco feel free to share it. Maybe we could add it as an example to the addon documentation…

@zarusz I have no working solution for that. i only could do this with my logitech harmony hub over the harmony binding but no idea how to get that working with the yamaha binding.

I just modified the Radio ON Rule

rule VirtuellesRadioAn
when
    Item VirtuellesRadio changed from OFF to ON
then
    if (Yamaha_Power.state == OFF){
        Yamaha_Power.sendCommand(ON)
    }
    Yamaha_Input.sendCommand("SERVER")
    Yamaha_Volume.sendCommand(30)
    if (VirtuellesRadio_Station.state == NULL){
        VirtuellesRadio_Station.sendCommand("1Live")
    }
    var stream = transform("MAP", "radio.map", VirtuellesRadio_Station.state.toString())
    executeCommandLine("/usr/bin/python /usr/bin/dlnap.py --ip 192.168.15.26 --play " + stream)
end

I added the if Block because when openhab restarted the item VirtuellesRadio_Station is NULL and no stream is playing. You Could also do it over the map
NULL=“http://…”

Good idea, but won’t this trigger the “WohnzimmerVirtuellesRadioAndererSender” and turn on the receiver?

BTW: I don’t use this approach in in my setup because I am using mapdb persistence to restore item values on startup.

1 Like

I just tried to to play a stream on my RX-V675, and guess what… it was functining the first time.

Thanks for the help!

Now i switched to the Yamaha RX-V485 and didn get it working with the dlna.py. The Receiver is switching to the SERVER input, but no audio is coming out of my loudspeakers… Or is there any other solution with the newer RX-Vx85 Models?

Okay, i can set the MusicCast Presets via http

http://192.168.15.20/YamahaExtendedControl/v1/netusb/recallPreset?zone=main&amp;num=1

Where the 1 at the end is for the first Favorites Slot. Now i have to get a good solution for Switching the stations.

1 Like