mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Support playing, pausing states for media players when reproducing state
This allows the state helper to call the correct service call for media_players when attempting to resolve state.
This commit is contained in:
parent
62f016e7d2
commit
1674c8309a
@ -9,7 +9,8 @@ import logging
|
||||
from homeassistant.core import State
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.const import (
|
||||
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF, ATTR_ENTITY_ID)
|
||||
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF,
|
||||
STATE_PLAYING, STATE_PAUSED, ATTR_ENTITY_ID)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -55,6 +56,11 @@ def reproduce_state(hass, states, blocking=False):
|
||||
state.entity_id)
|
||||
continue
|
||||
|
||||
if state.domain == 'media_player' and state == STATE_PAUSED:
|
||||
service = 'media_pause'
|
||||
elif state.domain == 'media_player' and state == STATE_PLAYING:
|
||||
service = 'media_play'
|
||||
elif
|
||||
if state.state == STATE_ON:
|
||||
service = SERVICE_TURN_ON
|
||||
elif state.state == STATE_OFF:
|
||||
|
Loading…
x
Reference in New Issue
Block a user