core: Mpd errors on startup when device is offline/no cover art is displayed

The problem

After updating to 2021.1, MPD errors on startup, when device is offline. more importantly, when the device is online, it wont show up as media_player in HA.

Added to that, no coverart is displayed at all, which would be the new feature of this release

Environment

  • Home Assistant Core release with the issue: 2021.1
  • Last working Home Assistant Core release (if known):
  • Operating environment (OS/Container/Supervised/Core): OS
  • Integration causing this issue: MPD
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/mpd/

Problem-relevant configuration.yaml

media_player:

  platform: mpd
  host: 192.168.1.177
  name: Bryston Bdp-1

Traceback/Error logs

2021-01-07 10:38:08 ERROR (MainThread) [homeassistant.components.media_player] 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 167, in connect
    r, w = await asyncio.open_connection(host, port, loop=loop)
  File "/usr/local/lib/python3.8/asyncio/streams.py", line 52, in open_connection
    transport, _ = await loop.create_connection(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
    await self.sock_connect(sock, address)
  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 528, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.1.177', 6600)

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'

Additional information

please see community post: https://community.home-assistant.io/t/how-to-get-the-new-m-usic-p-layer-d-aemon-image-to-appear/265301

I did try to enter a password (my devices system allows system settings only after entering login/pw) but that errored stating ‘wrong password’ Since I can not enter a login name in the config, I take it is useless to try to add a password, so I took it out again.

Media player is setup correctly when device is on on HA startup, albeit without coverart.

This is hardly a desired situation, since most of the time the MPD device will be off, and HA should be able to handle that gracefully, and, check for the device to become online.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 25 (19 by maintainers)

Commits related to this issue

Most upvoted comments

A fix has been merged upstream, and now I’m waiting for a new release. No further testing is required AFAICT.

Yes.