From ad549be353f43809a2d01be7eff69c1ba9c9c8f0 Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Wed, 7 Oct 2015 00:39:38 -0400 Subject: [PATCH] support play_media for state restoration (for scenes) --- homeassistant/helpers/state.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/helpers/state.py b/homeassistant/helpers/state.py index 909b86a67ed..db33eda960d 100644 --- a/homeassistant/helpers/state.py +++ b/homeassistant/helpers/state.py @@ -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: