Page 2 of 5
Re: Listen to your favourite radios V2
Posted: Monday 05 March 2018 17:14
by tukestolo
Thanks I will search a little more to see if I can find something.
For now to work with it, a start Domoticz with screen command.
Re: Listen to your favourite radios V2
Posted: Monday 05 March 2018 18:01
by 0n370uch
Ok. Good luck with your research...
Re: Listen to your favourite radios V2
Posted: Saturday 31 March 2018 15:43
by odelay
Hi 0n370uch, thanks for your great script!
I have added it to my Domoticz using de build in bluetooth of my RPI 3B and it is working great, there is only one thing I can't figure out.
You have a cronjob to activate the connection but I'm using my soundbar which is also connected to my TV and other stuff.
So I only want a connection when I press a radion button.
Is there a way to implement "/bin/echo -e 'connect 00:11:22:33:44:55 \n' | bluetoothctl &> /dev/null" into the script?
thanks!
Re: Listen to your favourite radios V2
Posted: Saturday 31 March 2018 18:18
by 0n370uch
odelay wrote: ↑Saturday 31 March 2018 15:43
Is there a way to implement
"/bin/echo -e 'connect 00:11:22:33:44:55 \n' | bluetoothctl &> /dev/null" into the script?
thanks!
Hi, you can add a normal button in Domoticz and link a bash script. Add your own bluetooth connect code into this bash script.
Greetings
Fabi
Re: Listen to your favourite radios V2
Posted: Sunday 20 May 2018 10:13
by 0n370uch
Hi, interesting... You have the same problem. For me everything is running fine... Mysterious.
Re: Listen to your favourite radios V2
Posted: Sunday 20 May 2018 11:05
by tukestolo
For me the problem was that if Domoticz start by ir self on startup or by user root it don’t work, but if I start it from folder manual it work :/
I don’t figure why
Re: Listen to your favourite radios V2
Posted: Thursday 13 September 2018 14:50
by amplituda
Hello everybody!)
I tuned the radio - it works very well - thank you!
but I do not understand how to set up wireless connection on bluetooth
please give detailed instructions
Thanks!)
Re: Listen to your favourite radios V2
Posted: Thursday 13 September 2018 15:00
by 0n370uch
Hi, you need to pair your bluetooth device with the domoticz hardware (in my case the Raspberry Pi). After this step you can add a cronjob to autoconnect the bluetooth device. Look here:
viewtopic.php?f=38&t=21419#p166533
I attached two picture. This screenshots show you the blocky element to safe the last used radio station.
Greetings
Fabi
Re: Listen to your favourite radios V2
Posted: Thursday 13 September 2018 15:12
by amplituda
Hi Fabi)
Thanks for the quick response)
please tell me how to connect my bluetooth column with raspberry 3?
Re: Listen to your favourite radios V2
Posted: Thursday 13 September 2018 15:25
by 0n370uch
Hi, add a new file /etc/asound.conf with this text inside (replace the mac address "00:11:22:33:44:55" with the mac address from your bluetooth device):
Code: Select all
pcm.!default {
type plug
slave.pcm {
type bluealsa
device "00:11:22:33:44:55"
profile "a2dp"
}
}
ctl.!default {
type bluealsa
}
EXTRA: You can add the file /lib/udev/rules.d/10-bluetooth-autoplay.rules (change the mac) for autoplay function:
Code: Select all
#Start radio with Domoticz (Start Radiosender > Level 10%) after connect to Panasonic bluetooth
SUBSYSTEM=="input", ACTION=="add", ATTRS{name}=="00:11:22:33:44:55", RUN+="/usr/bin/curl --insecure 'https://username:[email protected]:443/json.htm?type=command¶m=updateuservariable&vname=Wohnzimmer%20>%20Radio%20StartStop&vtype=0&vvalue=1' &> /dev/null"
#Stop radio with Domoticz after disconnect from Panasonic bluetooth
SUBSYSTEM=="input", ACTION=="remove", ATTRS{name}=="00:11:22:33:44:55", RUN+="/usr/bin/curl --insecure 'https://username:[email protected]:443/json.htm?type=command¶m=updateuservariable&vname=Wohnzimmer%20>%20Radio%20StartStop&vtype=0&vvalue=2' &> /dev/null"
After this you can pair your device (replace mac again):
Code: Select all
sudo bluetoothctl
power on
agent on
scan on
connect 00:11:22:33:44:55
trust 00:11:22:33:44:55
scan off
exit
EXTRA: And optional the cronjob (change the mac address one last time):
Code: Select all
sudo crontab -e
*/1 * * * * /bin/echo -e 'connect 00:11:22:33:44:55 \n' | bluetoothctl &> /dev/null
Re: Listen to your favourite radios V2
Posted: Thursday 13 September 2018 15:45
by amplituda
Code: Select all
pi@raspberrypi:~ $ dir
dev-domoticz nodejs_4.4.2_armhf.deb python_games Изображения Шаблоны
domoticz npm_2.14.7_armhf.deb Видео Музыка
MagPi oldconffiles Документы Общедоступные
miflora open-zwave-read-only Загрузки Рабочий\ стол
pi@raspberrypi:~ $
sorry, I do not know where the directory "etc"
Re: Listen to your favourite radios V2
Posted: Thursday 13 September 2018 16:14
by 0n370uch
Type: cd /etc
Or: cd /
And than: ls
You are here (home dir): cd ~
Re: Listen to your favourite radios V2
Posted: Thursday 13 September 2018 16:26
by amplituda
Thanks a lot to Fabi for your diligence, but your instructions for advanced users ...
they do not understand me, unfortunately ...
my home directory
pi @ raspberrypi: ~ $
it would be very good if you would show how to add auto-connect bluetooth devices from this directory .....
Re: Listen to your favourite radios V2
Posted: Thursday 13 September 2018 16:38
by 0n370uch
Ok, just type:
And than copy the code:
Code: Select all
pcm.!default {
type plug
slave.pcm {
type bluealsa
device "00:11:22:33:44:55"
profile "a2dp"
}
}
ctl.!default {
type bluealsa
}
Sry but "cd" / "ls" / "nano" / "vim" and so on, are linux basics

.
Re: Listen to your favourite radios V2
Posted: Friday 14 September 2018 8:51
by amplituda
0n370uch wrote: ↑Thursday 13 September 2018 16:38
Ok, just type:
And than copy the code:
Code: Select all
pcm.!default {
type plug
slave.pcm {
type bluealsa
device "00:11:22:33:44:55"
profile "a2dp"
}
}
ctl.!default {
type bluealsa
}
Sry but "cd" / "ls" / "nano" / "vim" and so on, are linux basics

.
Thank you very much for your patience Fabi! Now I have a column connected to the bluetooth in my house - I'm happy)
Re: Listen to your favourite radios V2
Posted: Friday 14 September 2018 10:13
by 0n370uch
amplituda wrote: ↑Friday 14 September 2018 8:51
Thank you very much for your patience Fabi! Now I have a column connected to the bluetooth in my house - I'm happy)
Hey, great

. I'm happy too. Have a nice weekend.
Re: Listen to your favourite radios V2
Posted: Monday 17 September 2018 21:22
by Gianni
i don't know what i'm doing wrong but this will not work for me
I followed your guide but when i switch to a channel nothing happens.
When i put this command in my terminal i get NO sound on my BT speakers.
mplayer -noconsolecontrols
http://uk2.internet-radio.com:8358/ &> /dev/null
but when i put this code in my terminal i get the radio stream from my BT speakers
mplayer
http://uk2.internet-radio.com:8358
BUT then again when i switch to OFF in domoticz then te player quit.
all i see in my domticz log is
2018-09-17 21:17:46.281 (Radio) Light/Switch (Radio)
2018-09-17 21:17:46.273 Status: User: Admin initiated a switch command (60/Radio/Set Level)
2018-09-17 21:17:57.014 (Radio) Light/Switch (Radio)
2018-09-17 21:17:57.001 Status: User: Admin initiated a switch command (60/Radio/Set Level)
2018-09-17 21:18:06.486 (Radio) Light/Switch (Radio)
Re: Listen to your favourite radios V2
Posted: Monday 17 September 2018 22:45
by 0n370uch
Hello, you need to add a playlist or a file like ".m3u" or ".mp3".
Re: Listen to your favourite radios V2
Posted: Tuesday 18 September 2018 12:18
by Gianni
Ok i will try that tonight when i'm home from work.
I just took the first url from your script to test
if (devicechanged['Wohnzimmer > Radio'] == '1FM') then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols
http://uk2.internet-radio.com:8358/ &> /dev/null")
end
Re: Listen to your favourite radios V2
Posted: Tuesday 18 September 2018 12:21
by 0n370uch
Ah yeah sry. This isn't working anymore.