1
mirror of https://github.com/home-assistant/core synced 2024-09-15 17:29:45 +02:00

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 <losinski@wh2.tu-dresden.de>
This commit is contained in:
Jan Losinski 2016-12-01 21:28:31 +01:00 committed by Paulus Schoutsen
parent dd84b4e237
commit 5c807c6bd9

View File

@ -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()