Can't define MPD as a media player

Tags: #<Tag:0x00007f326cac18e0>

Hi

I just installed Mopidy-MPD on an old RPi which is connected to my LAN. The installation seems to work fine, however, I can’t manage to add the MPD as a media_player.mpd entity to my HA. I added the following to my configuration.yaml:

media_player:
  - platform: mpd
    host: 192.168.0.42
    port: 6600

And in my HA log I get the following errors:

Logger: homeassistant.components.media_player
Source: components/mpd/media_player.py:133
Integration: Media player (documentation, issues)
First occurred: 5:10:44 PM (1 occurrences)
Last logged: 5:10:44 PM

mpd: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mpd/media_player.py", line 167, in async_update
    await self._connect()
  File "/usr/src/homeassistant/homeassistant/components/mpd/media_player.py", line 121, in _connect
    await self._client.connect(self.server, self.port)
  File "/usr/local/lib/python3.8/site-packages/mpd/asyncio.py", line 165, in connect
    r, w = await asyncio.open_unix_connection(host, loop=loop)
  File "/usr/local/lib/python3.8/asyncio/streams.py", line 111, in open_unix_connection
    transport, _ = await loop.create_unix_connection(
  File "/usr/local/lib/python3.8/asyncio/unix_events.py", line 244, in create_unix_connection
    await self.sock_connect(sock, path)
  File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 496, in sock_connect
    return await fut
  File "/usr/local/lib/python3.8/asyncio/selector_events.py", line 501, in _sock_connect
    sock.connect(address)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
    await task
  File "/usr/src/homeassistant/homeassistant/components/mpd/media_player.py", line 174, in async_update
    self._disconnect()
  File "/usr/src/homeassistant/homeassistant/components/mpd/media_player.py", line 133, in _disconnect
    self._client.disconnect()
  File "/usr/local/lib/python3.8/site-packages/mpd/asyncio.py", line 188, in disconnect
    if self.__wfile is not None:
AttributeError: 'MPDClient' object has no attribute '_MPDClient__wfile'

Anyone have ideas?

Thanks

The mpd integration works fine for me with mopidy, but maybe you can try the new custom component specifically targeted at mopidy and not mpd. Works very good over here so far.

1 Like

I have the feeling your mopidy-mpd config doesn’t allow connections from anything bur 127.0.0.1
Change the host setting to 0.0.0.0

And yes, please give my mopidy platform a try :wink:

Thanks man!
I tried this and it works great!!
:grinning:

1 Like