Add Volumio repeat support (#64132)

This commit is contained in:
Mark Ireland
2022-01-19 21:07:11 +00:00
committed by GitHub
parent 17d6d76fb8
commit eabe658211
4 changed files with 21 additions and 3 deletions

View File

@ -5,6 +5,6 @@
"codeowners": ["@OnFreund"],
"config_flow": true,
"zeroconf": ["_Volumio._tcp.local."],
"requirements": ["pyvolumio==0.1.3"],
"requirements": ["pyvolumio==0.1.5"],
"iot_class": "local_polling"
}

View File

@ -9,6 +9,8 @@ import json
from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.components.media_player.const import (
MEDIA_TYPE_MUSIC,
REPEAT_MODE_ALL,
REPEAT_MODE_OFF,
SUPPORT_BROWSE_MEDIA,
SUPPORT_CLEAR_PLAYLIST,
SUPPORT_NEXT_TRACK,
@ -16,6 +18,7 @@ from homeassistant.components.media_player.const import (
SUPPORT_PLAY,
SUPPORT_PLAY_MEDIA,
SUPPORT_PREVIOUS_TRACK,
SUPPORT_REPEAT_SET,
SUPPORT_SEEK,
SUPPORT_SELECT_SOURCE,
SUPPORT_SHUFFLE_SET,
@ -52,6 +55,7 @@ SUPPORT_VOLUMIO = (
| SUPPORT_PLAY_MEDIA
| SUPPORT_VOLUME_STEP
| SUPPORT_SELECT_SOURCE
| SUPPORT_REPEAT_SET
| SUPPORT_SHUFFLE_SET
| SUPPORT_CLEAR_PLAYLIST
| SUPPORT_BROWSE_MEDIA
@ -182,6 +186,13 @@ class Volumio(MediaPlayerEntity):
"""Boolean if shuffle is enabled."""
return self._state.get("random", False)
@property
def repeat(self):
"""Return current repeat mode."""
if self._state.get("repeat", None):
return REPEAT_MODE_ALL
return REPEAT_MODE_OFF
@property
def source_list(self):
"""Return the list of available input sources."""
@ -243,6 +254,13 @@ class Volumio(MediaPlayerEntity):
"""Enable/disable shuffle mode."""
await self._volumio.set_shuffle(shuffle)
async def async_set_repeat(self, repeat):
"""Set repeat mode."""
if repeat == REPEAT_MODE_OFF:
await self._volumio.repeatAll("false")
else:
await self._volumio.repeatAll("true")
async def async_select_source(self, source):
"""Choose an available playlist and play it."""
await self._volumio.play_playlist(source)

View File

@ -2039,7 +2039,7 @@ pyvizio==0.1.57
pyvlx==0.2.19
# homeassistant.components.volumio
pyvolumio==0.1.3
pyvolumio==0.1.5
# homeassistant.components.html5
pywebpush==1.9.2

View File

@ -1258,7 +1258,7 @@ pyvesync==1.4.2
pyvizio==0.1.57
# homeassistant.components.volumio
pyvolumio==0.1.3
pyvolumio==0.1.5
# homeassistant.components.html5
pywebpush==1.9.2