Listen to your favourite radios V2

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.
tukestolo
Posts: 12
Joined: Wednesday 28 February 2018 1:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Listen to your favourite radios V2

Post by tukestolo » Monday 05 March 2018 18:14

0n370uch wrote:
Monday 05 March 2018 14:00
Hi, sounds like a Domoticz global problem. Now I am at the end with my knowledge ...sry. Just one idea, check this:
https://www.domoticz.com/wiki/Linux
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.

0n370uch
Posts: 43
Joined: Monday 08 January 2018 3:30
Target OS: Raspberry Pi
Domoticz version: Latest
Contact:

Re: Listen to your favourite radios V2

Post by 0n370uch » Monday 05 March 2018 19:01

Ok. Good luck with your research...

odelay
Posts: 9
Joined: Monday 08 December 2014 18:52
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Listen to your favourite radios V2

Post by odelay » Saturday 31 March 2018 15:43

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!

0n370uch
Posts: 43
Joined: Monday 08 January 2018 3:30
Target OS: Raspberry Pi
Domoticz version: Latest
Contact:

Re: Listen to your favourite radios V2

Post by 0n370uch » Saturday 31 March 2018 18:18

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

RaymondR
Posts: 3
Joined: Monday 12 December 2016 22:02
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: The Netherlands
Contact:

Re: Listen to your favourite radios V2

Post by RaymondR » Saturday 19 May 2018 22:11

Hello,

I ave made the selector switch and the off button works.
Only de radio buttons don't.
When I start via de command line, the radio starts.
What am I doing wrong?

RaymondR
Posts: 3
Joined: Monday 12 December 2016 22:02
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: The Netherlands
Contact:

Re: Listen to your favourite radios V2

Post by RaymondR » Saturday 19 May 2018 23:24

Hello Tukestolo,

Did you find a solution for the problem in domoticz with the radio?
I have the same problem.

0n370uch
Posts: 43
Joined: Monday 08 January 2018 3:30
Target OS: Raspberry Pi
Domoticz version: Latest
Contact:

Re: Listen to your favourite radios V2

Post by 0n370uch » Sunday 20 May 2018 10:13

Hi, interesting... You have the same problem. For me everything is running fine... Mysterious.

tukestolo
Posts: 12
Joined: Wednesday 28 February 2018 1:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Listen to your favourite radios V2

Post by tukestolo » Sunday 20 May 2018 11:05

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

User avatar
amplituda
Posts: 11
Joined: Thursday 23 August 2018 14:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Listen to your favourite radios V2

Post by amplituda » Thursday 13 September 2018 14:50

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!)

0n370uch
Posts: 43
Joined: Monday 08 January 2018 3:30
Target OS: Raspberry Pi
Domoticz version: Latest
Contact:

Re: Listen to your favourite radios V2

Post by 0n370uch » Thursday 13 September 2018 15:00

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
Attachments
Bildschirmfoto von 2018-09-13 14-56-44.png
Bildschirmfoto von 2018-09-13 14-56-44.png (233.82 KiB) Viewed 417 times
Bildschirmfoto von 2018-09-13 14-56-34.png
Bildschirmfoto von 2018-09-13 14-56-34.png (325.37 KiB) Viewed 417 times

User avatar
amplituda
Posts: 11
Joined: Thursday 23 August 2018 14:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Listen to your favourite radios V2

Post by amplituda » Thursday 13 September 2018 15:12

Hi Fabi)
Thanks for the quick response)
please tell me how to connect my bluetooth column with raspberry 3?

0n370uch
Posts: 43
Joined: Monday 08 January 2018 3:30
Target OS: Raspberry Pi
Domoticz version: Latest
Contact:

Re: Listen to your favourite radios V2

Post by 0n370uch » Thursday 13 September 2018 15:25

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:password@127.0.0.1:443/json.htm?type=command&param=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:password@127.0.0.1:443/json.htm?type=command&param=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

User avatar
amplituda
Posts: 11
Joined: Thursday 23 August 2018 14:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Listen to your favourite radios V2

Post by amplituda » Thursday 13 September 2018 15:45

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"

0n370uch
Posts: 43
Joined: Monday 08 January 2018 3:30
Target OS: Raspberry Pi
Domoticz version: Latest
Contact:

Re: Listen to your favourite radios V2

Post by 0n370uch » Thursday 13 September 2018 16:14

Type: cd /etc
Or: cd /
And than: ls

You are here (home dir): cd ~

User avatar
amplituda
Posts: 11
Joined: Thursday 23 August 2018 14:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Listen to your favourite radios V2

Post by amplituda » Thursday 13 September 2018 16:26

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 .....

0n370uch
Posts: 43
Joined: Monday 08 January 2018 3:30
Target OS: Raspberry Pi
Domoticz version: Latest
Contact:

Re: Listen to your favourite radios V2

Post by 0n370uch » Thursday 13 September 2018 16:38

Ok, just type:

Code: Select all

sudo nano /etc/asound.conf
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 :-).

User avatar
amplituda
Posts: 11
Joined: Thursday 23 August 2018 14:30
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Listen to your favourite radios V2

Post by amplituda » Friday 14 September 2018 8:51

0n370uch wrote:
Thursday 13 September 2018 16:38
Ok, just type:

Code: Select all

sudo nano /etc/asound.conf
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)

0n370uch
Posts: 43
Joined: Monday 08 January 2018 3:30
Target OS: Raspberry Pi
Domoticz version: Latest
Contact:

Re: Listen to your favourite radios V2

Post by 0n370uch » Friday 14 September 2018 10:13

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.

Gianni
Posts: 70
Joined: Saturday 21 July 2018 19:03
Target OS: Raspberry Pi
Domoticz version:
Location: Home@Belgium
Contact:

Re: Listen to your favourite radios V2

Post by Gianni » Monday 17 September 2018 21:22

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)

0n370uch
Posts: 43
Joined: Monday 08 January 2018 3:30
Target OS: Raspberry Pi
Domoticz version: Latest
Contact:

Re: Listen to your favourite radios V2

Post by 0n370uch » Monday 17 September 2018 22:45

Hello, you need to add a playlist or a file like ".m3u" or ".mp3".

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest