Skip to content

MPD Binding ​

Music Player Daemon (MPD) is a flexible, powerful, server-side application for playing music. Through plugins and libraries it can play a variety of sound files while being controlled by its network protocol.

With the openHAB MPD binding you can control Music Player Daemons.

Supported Things ​

This binding supports one Thing type: mpd

Discovery ​

If zeroconf is enabled in the Music Player Daemon, it is discovered. Each Music Player daemon requires a unique zeroconf_name for correct discovery.

Thing Configuration ​

The Thing type mpd requires the following configuration parameters:

Parameter LabelParameter IDDescriptionRequired
Network AddressipAddressHost name or IP address of the Music Player Daemonyes
PortportPort number on which the Music Player Daemon is listening. Default: 6600yes
PasswordpasswordPassword to access the Music Player Daemonno

Channels ​

The following channels are currently available:

Channel Type IDItem TypeDescription
controlPlayerPlay/Pause/Next/Previous
volumeDimmerVolume in percent
stopSwitchStop playback
currentalbumStringCurrent album
currentartistStringCurrent artist
currentnameStringCurrent name
currentsongNumberCurrent song
currentsongidNumberCurrent song ID
currenttitleStringCurrent title
currenttrackNumberCurrent track

Full Example ​

Thing ​

java
mpd:mpd:music  [ ipAddress="192.168.1.2", port=6600 ]

Items ​

dsl
Switch morning_music "Morning music"

Player mpd_music_player "Player" { channel = "mpd:mpd:music:control" }
Dimmer mpd_music_volume "Volume [%d %%]" { channel = "mpd:mpd:music:volume" }
Switch mpd_music_stop "Stop" { channel = "mpd:mpd:music:stop" }
String mpd_music_album "Album [%s]" { channel = "mpd:mpd:music:currentalbum" }
String mpd_music_artist "Artist [%s]" { channel = "mpd:mpd:music:currentartist" }
String mpd_music_name "Name [%s]" { channel = "mpd:mpd:music:currentname" }
Number mpd_music_song "Song [%d]" { channel = "mpd:mpd:music:currentsong" }
Number mpd_music_song_id "Song ID [%d]" { channel = "mpd:mpd:music:currentsongid" }
String mpd_music_title "Title [%s]" { channel = "mpd:mpd:music:currenttitle" }
Number mpd_music_track "Track [%d]" { channel = "mpd:mpd:music:currenttrack" }

Sitemap ​

dsl
Frame label="Music" {
    Default item=mpd_music_player
    Slider item=mpd_music_volume
    Switch item=mpd_music_stop
    Text item=mpd_music_album
    Text item=mpd_music_artist
    Text item=mpd_music_name
    Text item=mpd_music_song
    Text item=mpd_music_song_id
    Text item=mpd_music_title
    Text item=mpd_music_track
}

Rule ​

rules
rule "turn on morning music"
when
        Item morning_music changed to ON
then
        val actions = getActions("mpd","mpd:mpd:music")
        if(actions === null) {
                logWarn("myLog", "actions is null")
                return
        }

        actions.sendCommand("clear")
        actions.sendCommand("load", "MorningMusic");
        actions.sendCommand("shuffle");
        actions.sendCommand("play");
end