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:
Andrew Sayre authored and Paulus Schoutsen committed 2019-04-25 21:42:39 -07:00
1 parent eefb9406c2
commit b5725f8f19
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