mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Set source & sound mode at start in media player reproduce state (#70064)
This commit is contained in:
parent
89807f0d2d
commit
1a2a3b5955
@ -83,18 +83,7 @@ async def _async_reproduce_states(
|
|||||||
cur_state = hass.states.get(state.entity_id)
|
cur_state = hass.states.get(state.entity_id)
|
||||||
features = cur_state.attributes[ATTR_SUPPORTED_FEATURES] if cur_state else 0
|
features = cur_state.attributes[ATTR_SUPPORTED_FEATURES] if cur_state else 0
|
||||||
|
|
||||||
if (
|
# First set source & sound mode to match the saved supported features
|
||||||
ATTR_MEDIA_VOLUME_LEVEL in state.attributes
|
|
||||||
and features & MediaPlayerEntityFeature.VOLUME_SET
|
|
||||||
):
|
|
||||||
await call_service(SERVICE_VOLUME_SET, [ATTR_MEDIA_VOLUME_LEVEL])
|
|
||||||
|
|
||||||
if (
|
|
||||||
ATTR_MEDIA_VOLUME_MUTED in state.attributes
|
|
||||||
and features & MediaPlayerEntityFeature.VOLUME_MUTE
|
|
||||||
):
|
|
||||||
await call_service(SERVICE_VOLUME_MUTE, [ATTR_MEDIA_VOLUME_MUTED])
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
ATTR_INPUT_SOURCE in state.attributes
|
ATTR_INPUT_SOURCE in state.attributes
|
||||||
and features & MediaPlayerEntityFeature.SELECT_SOURCE
|
and features & MediaPlayerEntityFeature.SELECT_SOURCE
|
||||||
@ -107,6 +96,18 @@ async def _async_reproduce_states(
|
|||||||
):
|
):
|
||||||
await call_service(SERVICE_SELECT_SOUND_MODE, [ATTR_SOUND_MODE])
|
await call_service(SERVICE_SELECT_SOUND_MODE, [ATTR_SOUND_MODE])
|
||||||
|
|
||||||
|
if (
|
||||||
|
ATTR_MEDIA_VOLUME_LEVEL in state.attributes
|
||||||
|
and features & MediaPlayerEntityFeature.VOLUME_SET
|
||||||
|
):
|
||||||
|
await call_service(SERVICE_VOLUME_SET, [ATTR_MEDIA_VOLUME_LEVEL])
|
||||||
|
|
||||||
|
if (
|
||||||
|
ATTR_MEDIA_VOLUME_MUTED in state.attributes
|
||||||
|
and features & MediaPlayerEntityFeature.VOLUME_MUTE
|
||||||
|
):
|
||||||
|
await call_service(SERVICE_VOLUME_MUTE, [ATTR_MEDIA_VOLUME_MUTED])
|
||||||
|
|
||||||
already_playing = False
|
already_playing = False
|
||||||
|
|
||||||
if (ATTR_MEDIA_CONTENT_TYPE in state.attributes) and (
|
if (ATTR_MEDIA_CONTENT_TYPE in state.attributes) and (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user