mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Media Player - MPD: handle more exceptions (#2045)
This commit is contained in:
parent
f9d97c4356
commit
c341ae0a39
@ -89,7 +89,13 @@ class MpdDevice(MediaPlayerDevice):
|
||||
try:
|
||||
self.status = self.client.status()
|
||||
self.currentsong = self.client.currentsong()
|
||||
except (mpd.ConnectionError, BrokenPipeError, ValueError):
|
||||
# Cleanly disconnect in case connection is not in valid state
|
||||
try:
|
||||
self.client.disconnect()
|
||||
except mpd.ConnectionError:
|
||||
pass
|
||||
|
||||
self.client.connect(self.server, self.port)
|
||||
|
||||
if self.password is not None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user