Fix supported features gates in media_player volume up/down services (#23419)
* Correct media player feature gates * Fix failing test * Lint...
This commit is contained in:
1 parent
46c955a501
commit
1ec08ce243
4 files changed
+42
-24
No files matched your search
@@ -29,6 +29,13 @@ class AsyncMediaPlayer(mp.MediaPlayerDevice):
|
||||
"""Volume level of the media player (0..1)."""
|
||||
return self._volume
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Flag media player features that are supported."""
|
||||
return mp.const.SUPPORT_VOLUME_SET | mp.const.SUPPORT_PLAY \
|
||||
| mp.const.SUPPORT_PAUSE | mp.const.SUPPORT_TURN_OFF \
|
||||
| mp.const.SUPPORT_TURN_ON
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_set_volume_level(self, volume):
|
||||
"""Set volume level, range 0..1."""
|
||||
@@ -74,6 +81,13 @@ class SyncMediaPlayer(mp.MediaPlayerDevice):
|
||||
"""Volume level of the media player (0..1)."""
|
||||
return self._volume
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Flag media player features that are supported."""
|
||||
return mp.const.SUPPORT_VOLUME_SET | mp.const.SUPPORT_VOLUME_STEP \
|
||||
| mp.const.SUPPORT_PLAY | mp.const.SUPPORT_PAUSE \
|
||||
| mp.const.SUPPORT_TURN_OFF | mp.const.SUPPORT_TURN_ON
|
||||
|
||||
def set_volume_level(self, volume):
|
||||
"""Set volume level, range 0..1."""
|
||||
self._volume = volume
|
||||
|
||||
Reference in new issue
Block a user