Re: Listen to your favourite radios V2
Posted: Thursday 20 September 2018 15:24
Seems that your Pi cannot find a bluetooth device... Can you check lspci and lsusb.
Open source Home Automation System
https://forum.domoticz.com/
Code: Select all
gianni@xxxxxxx:~ $ systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset
Active: active (running) since Fri 2018-09-21 09:39:36 CEST; 1h 2min ago
Docs: man:bluetoothd(8)
Main PID: 449 (bluetoothd)
Status: "Running"
CGroup: /system.slice/bluetooth.service
└─449 /usr/lib/bluetooth/bluetoothd
sep 21 09:39:36 domotic systemd[1]: Starting Bluetooth service...
sep 21 09:39:36 domotic bluetoothd[449]: Bluetooth daemon 5.43
sep 21 09:39:36 domotic systemd[1]: Started Bluetooth service.
sep 21 09:39:36 domotic bluetoothd[449]: Starting SDP server
sep 21 09:39:36 domotic bluetoothd[449]: Bluetooth management interface 1.14 ini
[color=#FF0000]sep 21 09:39:36 domotic bluetoothd[449]: Failed to obtain handles for "Service C
sep 21 09:39:36 domotic bluetoothd[449]: Sap driver initialization failed.
sep 21 09:39:36 domotic bluetoothd[449]: sap-server: Operation not permitted (1)
sep 21 09:39:37 domotic bluetoothd[449]: Failed to set privacy: Rejected (0x0b)[/color]
lines 1-18/18 (END)
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-09-21 09:39:36 CEST; 1h 2min ago
Docs: man:bluetoothd(8)
Main PID: 449 (bluetoothd)
Status: "Running"
CGroup: /system.slice/bluetooth.service
└─449 /usr/lib/bluetooth/bluetoothd
sep 21 09:39:36 domotic systemd[1]: Starting Bluetooth service...
sep 21 09:39:36 domotic bluetoothd[449]: Bluetooth daemon 5.43
sep 21 09:39:36 domotic systemd[1]: Started Bluetooth service.
sep 21 09:39:36 domotic bluetoothd[449]: Starting SDP server
sep 21 09:39:36 domotic bluetoothd[449]: Bluetooth management interface 1.14 initialized
[color=#FF0000]sep 21 09:39:36 domotic bluetoothd[449]: Failed to obtain handles for "Service Changed" characteristic
sep 21 09:39:36 domotic bluetoothd[449]: Sap driver initialization failed.
sep 21 09:39:36 domotic bluetoothd[449]: sap-server: Operation not permitted (1)
sep 21 09:39:37 domotic bluetoothd[449]: Failed to set privacy: Rejected (0x0b)[/color]
Code: Select all
gianni@xxxxxxxx~ $ lsusb
Bus 001 Device 004: ID 0658:0200 Sigma Designs, Inc.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
gianni@xxxxxxx:~ $ lspci
-bash: lspci: opdracht niet gevonden
gianni@xxxxxx:~ $
Code: Select all
gianni@xxxxxx:~ $ rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
Code: Select all
Sap driver initialization failed.
Code: Select all
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=BE
Code: Select all
mplayer -noconsolecontrols http://uk2.internet-radio.com:8358/ &> /dev/null
Code: Select all
if device.state == 'Off' then
os.execute ("killall mplayer")
end
Code: Select all
if device.state == 'MNM' then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://uk2.internet-radio.com:8358/ &> /dev/null")
end
Code: Select all
mplayer -noconsolecontrols http://uk2.internet-radio.com:8358/
Code: Select all
Audio only file format detected.
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 44100 Hz, 2 ch, s16le, 160.0 kbit/11.34% (ratio: 20000->176400)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
Code: Select all
Audio only file format detected.
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 44100 Hz, 2 ch, s16le, 160.0 kbit/11.34% (ratio: 20000->176400)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Code: Select all
sudo adduser <username> audio
Code: Select all
io.popen
Code: Select all
runuser -l pi -c
Code: Select all
if domoticz.devices('WebRadio').state == 'Subasio' then
--domoticz.notify('WebRadio','Radio Subasio on air...', domoticz.PRIORITY_NORMAL)
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols http://onair18.xdevel.com:8152 -volume 100 &> /dev/null'")
domoticz.notify('WebRadio','Radio Subasio on air...', domoticz.PRIORITY_NORMAL)
--os.execute ("runuser -l pi -c \'mplayer -noconsolecontrols http://onair18.xdevel.com:8152 -volume 100 &> /dev/null'")
end
Code: Select all
"NBY5540 - A2DP"
Code: Select all
amixer
Code: Select all
return {
data = {
switchwebradio = { initial = "Off" }
},
on = {
devices = {
'WebRadio',
'Volume'
}
},
execute = function(domoticz, triggeredItem, info)
local volume = domoticz.devices('Volume').level
if (domoticz.devices('Volume').state == "Off") then
volume = 0
end
cmd = 'amixer set "NBY5540 - A2DP" ' ..volume.. '% &> /dev/null'
os.execute ("runuser -l pi -c \'" ..cmd.. "'")
if (domoticz.devices('WebRadio').state ~= domoticz.data.switchwebradio) then
if (domoticz.devices('WebRadio').state == 'Off') then
os.execute ("killall mplayer")
domoticz.notify('WebRadio','WebRadio spenta', domoticz.PRIORITY_NORMAL)
end
if domoticz.devices('WebRadio').state == 'Subasio' then
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols http://onaxr18.xxxxxxxxxxxxxx.com:8152 &> /dev/null'")
domoticz.notify('WebRadio','Radio Subasio on air...', domoticz.PRIORITY_NORMAL)
end
if domoticz.devices('WebRadio').state == 'RTL' then
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols https://strex2.xxxxxxxxxx.com/rtl-1025 &> /dev/null'")
domoticz.notify('WebRadio','RTL 102.5 on air...', domoticz.PRIORITY_NORMAL)
end
if domoticz.devices('WebRadio').state == '105' then
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols http://icecast.xxxxxxxxxxo.it/Radio105.mp3 &> /dev/null'")
domoticz.notify('WebRadio','Radio 105 on air...', domoticz.PRIORITY_NORMAL)
end
if domoticz.devices('WebRadio').state == 'RDS' then
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols http://icstream.rxxxxxxxxxs.radio/rdsmp3 &> /dev/null'")
domoticz.notify('WebRadio','RDS on air...', domoticz.PRIORITY_NORMAL)
end
if domoticz.devices('WebRadio').state == 'Deejay' then
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols http://raxxxxxxxxxy-lh.akamaihd.net/i/RadioDeejay_Live_1@189857/master.m3u8 &> /dev/null'")
domoticz.notify('WebRadio','Radio Deejay on air...', domoticz.PRIORITY_NORMAL)
end
if domoticz.devices('WebRadio').state == 'RadioItalia' then
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols https://radixxxxxxxxxxxxxi-lh.akamaihxxxxxxnet/i/radioitaliasmi_1@329643/master.m3u8 &> /dev/null'")
domoticz.notify('WebRadio','Radio Italia on air...', domoticz.PRIORITY_NORMAL)
end
if domoticz.devices('WebRadio').state == 'RadioUno' then
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols http://icestreamxxxxxxxxx.it/1.mp3 &> /dev/null'")
domoticz.notify('WebRadio','Rai Radio 1 on air...', domoticz.PRIORITY_NORMAL)
end
if domoticz.devices('WebRadio').state == 'RadioDue' then
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols http://icestreaxxxxxxxxxx.it/2.mp3 &> /dev/null'")
domoticz.notify('WebRadio','Rai Radio 2 on air...', domoticz.PRIORITY_NORMAL)
end
if domoticz.devices('WebRadio').state == 'IsoRadio' then
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols http://icestrexxxxxxxxi.it/6.mp3 &> /dev/null'")
domoticz.notify('WebRadio','IsoRadio on air...', domoticz.PRIORITY_NORMAL)
end
if domoticz.devices('WebRadio').state == 'UAO_Kids' then
os.execute ("killall mplayer")
io.popen ("runuser -l pi -c \'mplayer -noconsolecontrols http://nr11.newrxxxxxxxxxxxxxt:9023/stream?1587028574736 &> /dev/null'")
domoticz.notify('WebRadio','UAO Kids radio on air...', domoticz.PRIORITY_NORMAL)
end
end
domoticz.data.switchwebradio = domoticz.devices('WebRadio').state
end
}