1
mirror of https://github.com/home-assistant/core synced 2024-08-31 05:57:13 +02:00

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.
This commit is contained in:
apetrycki 2018-12-27 03:04:40 -05:00 committed by Martin Hjelmare
parent 22acc03fb8
commit cd0da4ed0e

View File

@ -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."""