Start audio on remote computer

Hello, im new to openhab and looking for a good solution to start and stop musicplayback on a remote computer.
The remote computer is running ubuntu and currently i am using an exec binding in my items file.

[quote]
Switch Radio_Chill “Chillout” (GF_kitchen, GF_Musikk, gFF) {exec=“ON:ssh user@192.168.0.105 mpg123 -@ http://somafm.com/startstream=groovesalad.pls”}[/quote]

With this i can start a radiostream with no problem, but i cant exit the stream so if i have several of those bindings tied to different radiostreams they will run ontop of eachother.

I have tried to add “OFF:ssh user@192.168.0.105 killall mpg123” but i does not stop the stream.

How do i solve this the best way? Could it be solved with using the “screen” command in linux so that each exec command goes to the same session? Maybe run a script that always sends a kill command just in case something is already playing on the computer?

You should definitly look into MPD (Music Player Daemon). A binding for it is available.
Greetings.

Thank you for fast reply! I did try to install and get mpd up and running a few days ago but encountered so many problems (a quick google search tells me that im not the only one). I will give it another go and see if i can get it started, I had a look at the bindings in openhab and its exactly what i am looking for.

Thanks.

So i tried to set it up agin (mpd).

I have added the binding addon and made an item but i cannot get music playing.

[quote]
Switch Mpd_Kjokken “Start/Stop” (GF_Living) { mpd=“ON:kjokken:play, OFF:kjokken:stop” }
Switch Mpd_Kjokken1 “Track control” (GF_Living) { mpd=“ON:kjokken:playsong=yve.mp3, OFF:kjokken:prev” } [/quote]

My openhab log says to both of my items:

Does mpd itself work? You can test it by installing the command line client mpc on the remote machine and use it to control mpd for testing.

Another possibilty would be to install Kodi (the binding for it is called XBMC), but just for listening to music I’d prefer MPD, as it is much smaller in terms of memory and CPU usage.

I have mpc installed, when i try to play a song located in the directory i specified in mpd.conf i get an error:

When i start mpd it all seems fine

BUT, when running the “mpc play yve.mp3” i can see that mpc is starting the mpd as root so i get two instances of mpd running (one under my user and one under root)
I can also see log entries from mpc in the “root mpd logfile”.

How can i make mpc to not use the root account to connect to mpd?

To play a song, it must be part of the mpd database. It can be created by issuing “mpc update” on command line. mpd will then search for new songs in the directory specified in mpd.conf.

After creating the database you probably should use a browser based mpd client to do further testing, as it will be easier to navigate the database. If you have another ubuntu machine I can also recommend Ario as a graphical client. It will also allow testing of radio streams.

Thank you for your answers. I have now managed to controll the remote machine with mpc localy on the machine (through ssh) and i can also controll it with mpd client on my phone. But not with openhab.

I have added mpd : ALL in hosts.allow
Netstat shows “192.168.0.105:6600 : LISTEN” so that looks correct.
I cant see any errors in the openhab logfile only this: