MPC/D alternative

As openhab2 doesn’t have a binding for mpd currently - what is the best alternative to use for online radios?

As a suggestion, try out the OH1 mpd binding if it works under OH2 (see for this)
If it turns out, that the binding works under OH2, too, this binding could be marked as compatible.

If this doesn’t work, and you’re able to setup a server, you could use the squeezebox binding. there is squeezelite as a software player, and the logitechmediaserver to communicate with openhab, deliver netstreams and music (both free to use, both for windows or linux available)

I was able to get this binding working in OH2.

The initial attempt failed with the error below, but I was able to work around it by dropping a 1.9.0 copy of the binding into the addons directory.

With that jar, it appears the start/stop/next/volume commands all work fine…

15:18:50.862 [WARN ] [] - EventAdmin: Exception during event dispatch [org.osgi.service.event.Event [topic=openhab/command/Mpd_Emerald_StartStop] | org.osgi.service.event.EventHandler,}={event.topics=openhab/command/*,,,,, service.bundleid=171, service.scope=bundle} | Bundle(org.openhab.binding.mpd_1.8.3 [171])]
at org.openhab.binding.mpd.internal.MpdBinding.disconnect([171:org.openhab.binding.mpd:1.8.3]

Can you tell me where I can find the jar file of the 1.9.0 MPD Binding?

Thanks a lot!

You can pull it from the cloudbees CI build.

I can’t get the jar file from this place.Could you upload working file, please. I have the same exception as you mentioned above.

Here’s an updated link

Unfortunately, I still have the same exception below.
I added MPD server config in …\services\mpd.cfg

Do I need some other configurations to make it work properly?

06:45:29.940 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘Mpd_StartStop’ received command ON
06:45:29.940 [INFO ] [nhab.binding.mpd.internal.MpdBinding] - Reconnect player 'server’
06:45:29.945 [WARN ] [] - EventAdmin: Exception during event dispatch [org.osgi.service.event.Event [topic=openhab/command/Mpd_StartStop] {bridgemarker=true, item=Mpd_StartStop, command=ON} | {org.osgi.service.event.EventHandler,}={event.topics=openhab/command/*,,,,, service.bundleid=207, service.scope=bundle} | Bundle(org.openhab.binding.mpd_1.10.0.201702040211 [207])]
at org.openhab.binding.mpd.internal.MpdBinding.disconnect([207:org.openhab.binding.mpd:]

What does your item binding look like?

Very simple binding
Switch Mpd_StartStop “Start/Stop” { mpd=“ON:server:play, OFF:server:stop” }

MPD works well. I can control it using mpc from command line.

Very strange. Can you provide a full debug log?

Here is the full log after one action. I have no idea how to debug the problem.

11:05:56.892 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘Mpd_StartStop’ received command ON
11:05:56.893 [INFO ] [nhab.binding.mpd.internal.MpdBinding] - Reconnect player 'server’
11:05:56.915 [WARN ] [] - EventAdmin: Exception during event dispatch [org.osgi.service.evd/Mpd_StartStop] {bridgemarker=true, item=Mpd_StartStop, command=ON} | {org.osgi.service.event.EventHandler, org.osgi.service.s=openhab/command/*,,,,, sepe=bundle} | Bundle(org.openhab.binding.mpd_1.10.0.201702040211 [207])]
at org.openhab.binding.mpd.internal.MpdBinding.disconnect([207:org.openhab.binding.mpd:
at org.openhab.binding.mpd.internal.MpdBinding.reconnect([207:org.openhab.binding.mpd:
at org.openhab.binding.mpd.internal.MpdBinding.executePlayerCommand([207:org.openhab.binding.mpd:1
at org.openhab.binding.mpd.internal.MpdBinding.internalReceiveCommand([207:org.openhab.binding.mpd
at org.openhab.core.binding.AbstractBinding.receiveCommand([182:org.openhab.core.compat1x:2.0.
at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent([6:org.apache.karaf
at java.util.concurrent.Executors$[:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker([:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$[:1.8.0_121]
11:05:56.933 [INFO ] [marthome.event.ItemStateChangedEvent] - Mpd_StartStop changed from OFF to ON

There’s no debug logging in there.

Please take a look here to read up on configuring debug logging, then
upload the full log file.




I’ve tried DEBUG level of logging. I didn’t see new error messages. But I found the error while updating mpd.cfg. That is the main problem, mpd configurations are not read. I’ve tried different combinations - nothing. Can you show me your mpd.cfg ?

16:57:20.282 [ERROR] [org.apache.felix.configadmin ] - [org.osgi.service.event.EventHandler,, id=286, bundle=212/]: Unexpected problem updating configuration org.openhab.mpd
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString([:1.8.0_121]
at java.lang.Integer.parseInt([:1.8.0_121]
at java.lang.Integer.valueOf([:1.8.0_121]
at org.openhab.binding.mpd.internal.MpdBinding.updated([212:org.openhab.binding.mpd:]

@1117 I would try the following:

Make sure that you have installed (via console): feature:install openhab-runtime-compat1x
Drop the latest *.jar in your ..\addons\ folder

change ..\conf\services\mpd.cfg to:

set log level to DEBUG for the MPD Binding: log:set DEBUG org.openhab.binding.mpd

check logs and reply :slight_smile:

Done as you told. Openhab startup log with the problem in bold is listed below. I cheсked mpd.cfg many times.

18:02:39.918 [DEBUG] [org.openhab.binding.mpd ] - BundleEvent STARTING - org.openhab.binding.mpd
18:02:39.924 [DEBUG] [ab.binding.mpd.internal.MpdActivator] - MPD binding has been started.
18:02:40.075 [DEBUG] [nhab.binding.mpd.internal.MpdBinding] - MPD binding connecting to players
18:02:40.085 [DEBUG] [org.openhab.binding.mpd ] - ServiceEvent REGISTERED - {org.osgi.service.event.EventHandler,}={event.topics=openhab/command/*,,,,, service.bundleid=215, service.scope=bundle} - org.openhab.binding.mpd
18:02:40.113 [DEBUG] [org.openhab.binding.mpd ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.mpd.MpdBindingProvider}={,,, service.bundleid=215, service.scope=bundle} - org.openhab.binding.mpd
18:02:40.127 [DEBUG] [org.openhab.binding.mpd ] - BundleEvent STARTED - org.openhab.binding.mpd
18:02:40.128 [ERROR] [org.apache.felix.configadmin ] - [org.osgi.service.event.EventHandler,, id=318, bundle=215/file:/usr/share/openhab2/addons/org.openhab.binding.mpd-1.10.0-SNAPSHOT.jar]: Unexpected problem updating configuration org.openhab.mpd
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString([:1.8.0_121]
at java.lang.Integer.parseInt([:1.8.0_121]
at java.lang.Integer.valueOf([:1.8.0_121]
at org.openhab.binding.mpd.internal.MpdBinding.updated([215:org.openhab.binding.mpd:]

Maybe: delete the mpd.cfg
recreate it without using notepad (use another text editor), Type the text, don’t copy-paste.
There may be some kind of character (or new line feed) that stops the binding from parsing properly the config data.

Nothing. I am using nano editor. It looks like very simple mistake. Ok, thank you. I will try to find.

Finally It works! Openhab was reinstalled from the scratch.
feature:install openhab-runtime-compat1x is very important!

1 Like

I have the almost same problem … now work only volume slider. I receive correct value from volume and i can increase / decrease volume but no working play stop next prev or current info about Title song. I use mpd binding to make am online radio on raspberry pi. I make all possible combination and until now nothing work to play/stop commands. Any idea ???