Hello everyone!
I just tried to fix my problem, but i failed. It worked before. I have two scripts - one for selecting radio, second for setting volume level. Codes below.
When I select radio i can see it via process list( ps aux). When i run this commands in terminal it works normally(I hear the sound). I'm not sure its a problem with something ala DISPLAY:0 command, but I don't know. I updated Domoticz but it don't fix the problem. Hope someone know the cause. Thank You!
-- This script play a streaming radio when the device is changed
-- Start files with "mplayer -noconsolecontrols radiostation.mp3 &> /dev/null"
-- Start playlists with "mplayer -noconsolecontrols -playlist radiostation.m3u &> /dev/null"
return {
on = {
devices = {
'Radio'
}
},
execute = function(domoticz, device)
if device.state == 'Off' then
os.execute ("killall mplayer")
end
if device.state ~= 'Off' then
-- domoticz.helpers.btspeaker(domoticz, 'On') -- BTAudio on
if device.state == 'Afera' then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols https://radio.afera.com.pl/afera128.mp3 -volume 70 &> /dev/null")
end
if device.state == 'Kaszebe' then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols https://stream3.nadaje.com:8048/ -volume 70 &> /dev/null")
end
if device.state == 'RMF FM' then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://217.74.72.10:8000/rmf_fm -volume 70 &> /dev/null")
end
if device.state == 'Zet' then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://zt04.cdn.eurozet.pl/zet-old.mp3 -volume 50 &> /dev/null")
end
if device.state == 'Radio 357' then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://stream.open.fm/357 -volume 50 &> /dev/null")
end
if device.state == 'RMF FM Fitness' then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://31.192.216.8/FITNESS -volume 50 &> /dev/null")
end
if device.state == 'link' then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols link -volume 50 &> /dev/null")
end
if device.state == 'Muzyka Filmowa' then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://195.150.20.8:8000/rmf_muzyka_filmowa -volume 50 &> /dev/null")
end
if device.state == 'Zet Hits' then
os.execute ("killall mplayer")
os.execute ("mplayer -noconsolecontrols http://zt.cdn.eurozet.pl/ZETHIT.mp3 -volume 50 &> /dev/null")
end
end
end
}
return {
on = {
devices = {
'Volume'
}
},
execute = function(domoticz, device)
if device.state ~= 'Off' then
-- domoticz.helpers.btspeaker(domoticz, 'On') -- BTAudio on
if device.state == 'Volume +' then
os.execute ("amixer set Master 10%+")
end
if device.state == 'Volume -' then
os.execute ("amixer set Master 10%-")
end
if device.state == 'Mute' then
os.execute ("amixer set Master toggle")
end
end
end
}
Fisk wrote: ↑Sunday 09 May 2021 19:30
just tried to fix my problem, but i failed. It worked before. I have two scripts - one for selecting radio, second for setting volume level. Codes below.
When I select radio i can see it via process list( ps aux). When i run this commands in terminal it works normally(I hear the sound). I'm not sure its a problem with something ala DISPLAY:0 command, but I don't know. I updated Domoticz but it don't fix the problem. Hope someone know the cause.
If you replace the first script with below version it will show more information what happens.