mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Merge pull request #499 from balloob/handle-states-for-media-player
Prioritize play_media over state change
This commit is contained in:
commit
cb2943c247
@ -59,14 +59,14 @@ def reproduce_state(hass, states, blocking=False):
|
|||||||
state.entity_id)
|
state.entity_id)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if state.domain == 'media_player' and state.state == STATE_PAUSED:
|
if state.domain == 'media_player' and state.attributes and \
|
||||||
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 \
|
|
||||||
'media_type' in state.attributes and \
|
'media_type' in state.attributes and \
|
||||||
'media_id' in state.attributes:
|
'media_id' in state.attributes:
|
||||||
service = SERVICE_PLAY_MEDIA
|
service = SERVICE_PLAY_MEDIA
|
||||||
|
elif state.domain == 'media_player' and state.state == STATE_PAUSED:
|
||||||
|
service = SERVICE_MEDIA_PAUSE
|
||||||
|
elif state.domain == 'media_player' and state.state == STATE_PLAYING:
|
||||||
|
service = SERVICE_MEDIA_PLAY
|
||||||
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