From 5c807c6bd9e6c2a0bce2bd50fd3d0f573d85b8b2 Mon Sep 17 00:00:00 2001 From: Jan Losinski Date: Thu, 1 Dec 2016 21:28:31 +0100 Subject: [PATCH] MPD: Reconnect mpd client afetr OSError (#4651) If the mpd client ran into an socket timeout, the socket will raise an OSError on every further request. This adds OSError to the list of excptions, that causes a client reconnect. This fixes #4650 Signed-off-by: Jan Losinski --- homeassistant/components/media_player/mpd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/media_player/mpd.py b/homeassistant/components/media_player/mpd.py index 083b1108f92..acfd0e9307c 100644 --- a/homeassistant/components/media_player/mpd.py +++ b/homeassistant/components/media_player/mpd.py @@ -100,7 +100,7 @@ class MpdDevice(MediaPlayerDevice): try: self.status = self.client.status() self.currentsong = self.client.currentsong() - except (mpd.ConnectionError, BrokenPipeError, ValueError): + except (mpd.ConnectionError, OSError, BrokenPipeError, ValueError): # Cleanly disconnect in case connection is not in valid state try: self.client.disconnect()