diff --git a/homeassistant/components/media_player/mpd.py b/homeassistant/components/media_player/mpd.py index 793588a8d9f..55df1e367a4 100644 --- a/homeassistant/components/media_player/mpd.py +++ b/homeassistant/components/media_player/mpd.py @@ -79,14 +79,15 @@ class MpdDevice(MediaPlayerDevice): self._client = mpd.MPDClient() self._client.timeout = 5 self._client.idletimeout = None - if password is not None: - self._client.password(password) def _connect(self): """Connect to MPD.""" import mpd try: self._client.connect(self.server, self.port) + + if self.password is not None: + self._client.password(self.password) except mpd.ConnectionError: return