From eabe65821190b9ebfc98ae56cc13b33637f517d6 Mon Sep 17 00:00:00 2001 From: Mark Ireland Date: Wed, 19 Jan 2022 21:07:11 +0000 Subject: [PATCH] Add Volumio repeat support (#64132) --- homeassistant/components/volumio/manifest.json | 2 +- .../components/volumio/media_player.py | 18 ++++++++++++++++++ requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/volumio/manifest.json b/homeassistant/components/volumio/manifest.json index 0daffe1cc0a..818df8c83d9 100644 --- a/homeassistant/components/volumio/manifest.json +++ b/homeassistant/components/volumio/manifest.json @@ -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" } diff --git a/homeassistant/components/volumio/media_player.py b/homeassistant/components/volumio/media_player.py index 68ab724595c..75a84b4f94a 100644 --- a/homeassistant/components/volumio/media_player.py +++ b/homeassistant/components/volumio/media_player.py @@ -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) diff --git a/requirements_all.txt b/requirements_all.txt index 307cef888f0..05769a43a59 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index ae8bf2fe7b3..02c3c12bfb4 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -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