Listen to your favourite radios
Posted: Sunday 21 February 2016 15:50
Hi,
I would like to share with the community what I did to listen to my favourite radios via Domoticz...
Today, most radio stations can be "received" from the Internet via a live audio stream.
Here's what I did to receive these streams in my Domoticz ecosystem (Raspberry Pi 2B) :
1. Install MPLAYER : In a console window, enter:
2. Plug amplified speakers in the audio plug of the Raspberry. Connect the power cord to a 433Mhz or Zwave outlet, and create a physical switch in Domoticz to turn the speakers On and Off. It doesn't even need to be visible in the switch panel, but it's up to you.
3. For each radio that you want to listen, create a shell script such as next one, and save it in /home/pi/domoticz/scripts
First line will turn the speakers on (put in the right idx, the one of your speakers).
Second line will stop any running instance of mplayer. This is necessary to zap between stations.
Third line will activate the audio stream. Make sure you don't forget the & to launch the player in background. For each radio, edit the script and put the right URL. (Here's a list of URLs for French radios: https://doc.ubuntu-fr.org/liste_radio_france )
4. Create a script to stop listening:
5. Create a virtual selector switch in Domoticz, and create as many levels as you have radios you want to listen.
Assign the scripts created at step 3 to each level, and the "stop" script (step 4) to the "Off" level
6. Here you go ... Enjoy!
Oliviers
I would like to share with the community what I did to listen to my favourite radios via Domoticz...
Today, most radio stations can be "received" from the Internet via a live audio stream.
Here's what I did to receive these streams in my Domoticz ecosystem (Raspberry Pi 2B) :
1. Install MPLAYER : In a console window, enter:
Code: Select all
sudo apt-get update
sudo apt-get install mplayer
Code: Select all
#!/bin/bash
# echo RTL2
wget "http://127.0.0.1:8080/json.htm?type=command¶m=switchlight&idx=161&switchcmd=On" > /dev/null
sudo killall mplayer
mplayer -noconsolecontrols http://streaming.radio.rtl2.fr:80/rtl2-1-44-96 &
Second line will stop any running instance of mplayer. This is necessary to zap between stations.
Third line will activate the audio stream. Make sure you don't forget the & to launch the player in background. For each radio, edit the script and put the right URL. (Here's a list of URLs for French radios: https://doc.ubuntu-fr.org/liste_radio_france )
4. Create a script to stop listening:
Code: Select all
#!/bin/bash
wget "http://127.0.0.1:8080/json.htm?type=command¶m=switchlight&idx=161&switchcmd=Off" > /dev/null &
sudo killall mplayer > /dev/null &
Assign the scripts created at step 3 to each level, and the "stop" script (step 4) to the "Off" level
6. Here you go ... Enjoy!
Oliviers