support play_media for state restoration (for scenes)

This commit is contained in:
Jon Maddox 2015-10-07 00:39:38 -04:00
parent 9012ba53fd
commit ad549be353

View File

@ -13,6 +13,8 @@ from homeassistant.const import (
SERVICE_MEDIA_PLAY, SERVICE_MEDIA_PAUSE,
STATE_PLAYING, STATE_PAUSED, ATTR_ENTITY_ID)
from homeassistant.components.media_player import (SERVICE_PLAY_MEDIA)
_LOGGER = logging.getLogger(__name__)
@ -61,6 +63,8 @@ def reproduce_state(hass, states, blocking=False):
service = SERVICE_MEDIA_PAUSE
elif state.domain == 'media_player' and state.state == STATE_PLAYING:
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:
service = SERVICE_TURN_ON
elif state.state == STATE_OFF: