mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Add volumio shuffle support (#25871)
* Add volumio shuffle support * Black reformat * Update homeassistant/components/volumio/media_player.py Co-Authored-By: Martin Hjelmare <marhje52@kth.se>
This commit is contained in:
parent
944ac4f3c2
commit
53ad33e84a
@ -29,6 +29,7 @@ from homeassistant.components.media_player.const import (
|
||||
SUPPORT_VOLUME_MUTE,
|
||||
SUPPORT_VOLUME_SET,
|
||||
SUPPORT_VOLUME_STEP,
|
||||
SUPPORT_SHUFFLE_SET,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
@ -65,6 +66,7 @@ SUPPORT_VOLUMIO = (
|
||||
| SUPPORT_PLAY
|
||||
| SUPPORT_VOLUME_STEP
|
||||
| SUPPORT_SELECT_SOURCE
|
||||
| SUPPORT_SHUFFLE_SET
|
||||
| SUPPORT_CLEAR_PLAYLIST
|
||||
)
|
||||
|
||||
@ -231,6 +233,11 @@ class Volumio(MediaPlayerDevice):
|
||||
"""Return the name of the device."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def shuffle(self):
|
||||
"""Boolean if shuffle is enabled."""
|
||||
return self._state.get("random", False)
|
||||
|
||||
@property
|
||||
def source_list(self):
|
||||
"""Return the list of available input sources."""
|
||||
@ -296,6 +303,12 @@ class Volumio(MediaPlayerDevice):
|
||||
"commands", params={"cmd": "volume", "volume": self._lastvol}
|
||||
)
|
||||
|
||||
def async_set_shuffle(self, shuffle):
|
||||
"""Enable/disable shuffle mode."""
|
||||
return self.send_volumio_msg(
|
||||
"commands", params={"cmd": "random", "value": str(shuffle)}
|
||||
)
|
||||
|
||||
def async_select_source(self, source):
|
||||
"""Choose a different available playlist and play it."""
|
||||
self._currentplaylist = source
|
||||
|
Loading…
x
Reference in New Issue
Block a user