mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
module level play_media
This commit is contained in:
parent
1c4ac6017d
commit
faa3e98921
@ -189,6 +189,15 @@ def media_previous_track(hass, entity_id=None):
|
|||||||
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
|
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
|
||||||
hass.services.call(DOMAIN, SERVICE_MEDIA_PREVIOUS_TRACK, data)
|
hass.services.call(DOMAIN, SERVICE_MEDIA_PREVIOUS_TRACK, data)
|
||||||
|
|
||||||
|
def play_media(hass, media_type, media_id, entity_id=None):
|
||||||
|
""" Send the media player the command for playing media. """
|
||||||
|
data = {"media_type": media_type, "media_id": media_id}
|
||||||
|
|
||||||
|
if entity_id:
|
||||||
|
data[ATTR_ENTITY_ID] = entity_id
|
||||||
|
|
||||||
|
hass.services.call(DOMAIN, SERVICE_PLAY_MEDIA, data)
|
||||||
|
|
||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
""" Track states and offer events for media_players. """
|
""" Track states and offer events for media_players. """
|
||||||
|
Loading…
x
Reference in New Issue
Block a user