From cd0da4ed0e8b0df7281d4219bdd4febce3562a75 Mon Sep 17 00:00:00 2001 From: apetrycki <34962392+apetrycki@users.noreply.github.com> Date: Thu, 27 Dec 2018 03:04:40 -0500 Subject: [PATCH] Fix mpd shuffle/random status (#19308) * Fix shuffle/random status MPD always shows true for shuffle. For some reason casting the 0 or 1 as a boolean does not work. Now returns 'true' or 'false' based on the value of 'random'. * Update homeassistant/components/media_player/mpd.py Change to correct way of returning shuffle boolean. 'random' needs to be cast as an integer before being cast as a boolean. Co-Authored-By: apetrycki <34962392+apetrycki@users.noreply.github.com> * Remove incorrect string code Original fix method returns a string instead of a boolean. Removed in favor of MartinHjelmare's method. --- 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 b5eecd3d403c..d006b5692f1d 100644 --- a/homeassistant/components/media_player/mpd.py +++ b/homeassistant/components/media_player/mpd.py @@ -319,7 +319,7 @@ class MpdDevice(MediaPlayerDevice): @property def shuffle(self): """Boolean if shuffle is enabled.""" - return bool(self._status['random']) + return bool(int(self._status['random'])) def set_shuffle(self, shuffle): """Enable/disable shuffle mode."""