def media_play(hass, entity_id=None):
    data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
    hass.services.call(DOMAIN, SERVICE_MEDIA_PLAY, data)
Send the media player the command for play/pause.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/media_player/__init__.py/media_play