mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Allow 'turning on' cast groups (#70642)
* Allow 'turning on' cast groups * Adjust test
This commit is contained in:
parent
c467f318ed
commit
23d9e135bc
@ -794,16 +794,12 @@ class CastMediaPlayerEntity(CastDevice, MediaPlayerEntity):
|
|||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Flag media player features that are supported."""
|
"""Flag media player features that are supported."""
|
||||||
support = (
|
support = (
|
||||||
MediaPlayerEntityFeature.PLAY_MEDIA | MediaPlayerEntityFeature.TURN_OFF
|
MediaPlayerEntityFeature.PLAY_MEDIA
|
||||||
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
|
| MediaPlayerEntityFeature.TURN_ON
|
||||||
)
|
)
|
||||||
media_status = self._media_status()[0]
|
media_status = self._media_status()[0]
|
||||||
|
|
||||||
if self._chromecast and self._chromecast.cast_type in (
|
|
||||||
pychromecast.const.CAST_TYPE_CHROMECAST,
|
|
||||||
pychromecast.const.CAST_TYPE_AUDIO,
|
|
||||||
):
|
|
||||||
support |= MediaPlayerEntityFeature.TURN_ON
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self.cast_status
|
self.cast_status
|
||||||
and self.cast_status.volume_control_type != VOLUME_CONTROL_TYPE_FIXED
|
and self.cast_status.volume_control_type != VOLUME_CONTROL_TYPE_FIXED
|
||||||
|
@ -800,10 +800,12 @@ async def test_entity_cast_status(hass: HomeAssistant):
|
|||||||
| SUPPORT_PLAY_MEDIA
|
| SUPPORT_PLAY_MEDIA
|
||||||
| SUPPORT_STOP
|
| SUPPORT_STOP
|
||||||
| SUPPORT_TURN_OFF
|
| SUPPORT_TURN_OFF
|
||||||
|
| SUPPORT_TURN_ON
|
||||||
| SUPPORT_VOLUME_MUTE
|
| SUPPORT_VOLUME_MUTE
|
||||||
| SUPPORT_VOLUME_SET,
|
| SUPPORT_VOLUME_SET,
|
||||||
SUPPORT_PLAY_MEDIA
|
SUPPORT_PLAY_MEDIA
|
||||||
| SUPPORT_TURN_OFF
|
| SUPPORT_TURN_OFF
|
||||||
|
| SUPPORT_TURN_ON
|
||||||
| SUPPORT_VOLUME_MUTE
|
| SUPPORT_VOLUME_MUTE
|
||||||
| SUPPORT_VOLUME_SET,
|
| SUPPORT_VOLUME_SET,
|
||||||
),
|
),
|
||||||
@ -1386,7 +1388,11 @@ async def test_entity_media_states_lovelace_app(hass: HomeAssistant):
|
|||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state.state == "playing"
|
assert state.state == "playing"
|
||||||
assert state.attributes.get("supported_features") == (
|
assert state.attributes.get("supported_features") == (
|
||||||
SUPPORT_PLAY_MEDIA | SUPPORT_TURN_OFF | SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_SET
|
SUPPORT_PLAY_MEDIA
|
||||||
|
| SUPPORT_TURN_OFF
|
||||||
|
| SUPPORT_TURN_ON
|
||||||
|
| SUPPORT_VOLUME_MUTE
|
||||||
|
| SUPPORT_VOLUME_SET
|
||||||
)
|
)
|
||||||
|
|
||||||
media_status = MagicMock(images=None)
|
media_status = MagicMock(images=None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user