Alexa Media Player Integration

Is anyone familiar with the Alexa Media Player Integration? I am trying to trigger a routine via visual scripting and failing. I’m struggling to see what I’m missing.

Please post your script and explain what is happening.


I have attempted to run a routine from dev tools, but when I hit “call service” I’m getting no reaction and sometimes getting errors (I’ve attempted to run this multiple ways to no avail). It looks to me the same as what’s in the docs, but I barely understand what I’m doing here. I am in need of enlightenment

Below is the service section of a script I use daily.

service: media_player.play_media
data:
  media_content_id: AS turn off A's lamp
  media_content_type: routine
target:
  entity_id: media_player.bedroom_dot

Your example is missing a “target” heading… you can’t use entity_id alone. To test it in the Dev Tools>Service menu you may need to click the “Go To YAML Mode” button in the lower left, and then enter it manually.

The media_content_id must match the name of the routine in the Alexa app exactly. Capitalization, spacing, and punctuation must match.

Does anything jump out as wrong here? My “call service” button is greyed out when I enter this exactly. My routine is just named “test” and I used my device’s entity id in that field. Thanks again for helping, this has been a nightmare for me the last couple days.

You don’t use the hyphen when using the Services tool… “service”, “data”, and “target” should all be as far to the left as possible.

This looks like the way I previously had it, but I get an error when I call the service. I thought it was syntax related

You’ve selected the media_pause service ?

Error Persists

The service should be Media Player: Play media

service: media_player.play_media

Same error ? I’ve just tested and works fine. Do you need the device_id ? Mine works without it

Same thing, if you can help me with this I owe you a cup of coffee. It’s definitely over my head


Progress! No error message, but also nothing happens now

You definitely have a routine in your Alexa app called test ?

The test routine runs manually as well. This is where I get stuck, the media player can control the device sound levels manually, so I would think that means the connection there is fine as well.

Very odd

Can you try without target as in the docs ?

service: media_player.play_media
data:
  entity_id: media_player.aaron_s_echo_dot
  media_content_id: test
  media_content_type: routine

same result, no response. Call service button goes from blue to green but no action on alexa

I’m grasping at straws here… what actions does your test routine do?

it just triggers a “happy birthday” message. I set this up only to test that I can trigger a routine via the media player. I do see some odd things in my log file:

2021-11-03 20:22:24 WARNING (MainThread) [alexapy.alexalogin] No access token found; falling back to credential login instead of oauth.

2021-11-04 08:44:07 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from mobile-166-205-087-010.mycingular.net (*my external ip*). (HomeAssistant/Android 2021.10.0-761)

2021-11-04 10:15:44 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['media_content_id']

2021-11-04 22:40:27 ERROR (MainThread) [custom_components.alexa_media] Unexpected error fetching alexa_media data: argument of type 'NoneType' is not iterable

It looks like alexapy is a dependency for the media player and is having some sort of error, although the app has my creds so idk why this would break things. The last two errors make no sense to me

Can you try to run this script ?:

alias: Alexa speak
sequence:
  - service: notify.alexa_media
    data:
      message: happy birthday
      data:
        type: tts
      target: media_player.yourdevice
mode: single
icon: mdi:clipboard-text-play-outline

or try also this service call:

service: notify.alexa_media
data:
  data:
    type: tts
  message: Hello
  target: media_player.yourdevice