mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
support play_media for state restoration (for scenes)
This commit is contained in:
parent
9012ba53fd
commit
ad549be353
@ -13,6 +13,8 @@ from homeassistant.const import (
|
|||||||
SERVICE_MEDIA_PLAY, SERVICE_MEDIA_PAUSE,
|
SERVICE_MEDIA_PLAY, SERVICE_MEDIA_PAUSE,
|
||||||
STATE_PLAYING, STATE_PAUSED, ATTR_ENTITY_ID)
|
STATE_PLAYING, STATE_PAUSED, ATTR_ENTITY_ID)
|
||||||
|
|
||||||
|
from homeassistant.components.media_player import (SERVICE_PLAY_MEDIA)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -61,6 +63,8 @@ def reproduce_state(hass, states, blocking=False):
|
|||||||
service = SERVICE_MEDIA_PAUSE
|
service = SERVICE_MEDIA_PAUSE
|
||||||
elif state.domain == 'media_player' and state.state == STATE_PLAYING:
|
elif state.domain == 'media_player' and state.state == STATE_PLAYING:
|
||||||
service = SERVICE_MEDIA_PLAY
|
service = SERVICE_MEDIA_PLAY
|
||||||
|
elif state.domain == 'media_player' and state.attributes and state.attributes['media_type'] and state.attributes['media_id']:
|
||||||
|
service = SERVICE_PLAY_MEDIA
|
||||||
elif state.state == STATE_ON:
|
elif state.state == STATE_ON:
|
||||||
service = SERVICE_TURN_ON
|
service = SERVICE_TURN_ON
|
||||||
elif state.state == STATE_OFF:
|
elif state.state == STATE_OFF:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user