Echo Devices (Alexa) as Media Player - Testers Needed

I always check tab dev-state and copy name.
media_player.alexa is now standby and looks like is ok but I cant control player.

Move the entity_id above the data_template and line it up (spacing with data_template)
change the data_template to just data. You can use data_template if you want to pass it variables from you HA.

just go to the dev page and use the service there. its more easy to test

use this
{“entity_id”: “media_player.alexa”, “message”: “test”}
for your jason

The format I use is just like I suggested and it works fine. That’s why I suggested it.

Does this work? I have prime and not getting anything.

Oops. I didn’t fix the media_player service and forgot the quotes.

Should be:

alexa_play:
  alias: Alexa Play Test
  sequence:
    - service: media_player.play_media
      data:
        entity_id: media_player.your_dot
        media_content_id : "the Ballad of John Henry"
        media_content_type: "AMAZON_MUSIC"

And if you play a silence song then you won’t hear anything (obviously). Try the song above and it should work. I just tested it right now and it’s playing while I’m typing this.

And there is my Problem - I can call for songs but not for playlists
I can already search for songs thanks to rrubin0 - here known as automateit

btw: Thanks man!

When you want to check it out how far i got in 2 minutes changing some entrys
https://hastebin.com/owahocojah.coffeescript

Thats the only information Ive got via :states:

source_list: Local Speaker,TVBluetooth
media_content_type: music
volume_level: 0.6
media_duration: 232
media_title: Instinkt
entity_picture: /api/media_player_proxy/media_player.your_echo_dot?token=550eec[retained]bca59&cache=5d5fa0c54d847e89
media_artist: Prinz Pi
source: Local Speaker
available: true
media_album_name: Donnerwetter!
supported_features: 23357
is_volume_muted: false
friendly_name: Your Echo Dot

Problem resolved. I tried amazon.com, instead amazon.co.uk, and now everything is working :slight_smile:
Thank you !

1

I tried still nothing

I can’t control anything.

volume should work and pause should work, but it can be that radio is preventing that.
i only play from amazon music and that works.

I have same situation, shows details ok but no controls working and TTS does nothing.
Tried Radio and also Amazon music and no luck, I am on amazon.co.uk if that makes any difference?
(config correctly picked up all my amazon devices)

tts also through services not working?

as per @prodarek image i copied that changing my entities to match my own.

{"entity_id": "media_player.living_room", "message": "test"}
{"entity_id": "media_player.bedroom_2", "message": "test"}

Neither worked. Volumes/Pause/Play or onscreen TTS from media controls not working either i see the home assistant box to say service called but nothing happens with the echo.

Yes tts also nothing.

seems to me like an authentication problem.

at least i saw that @prodarek tried .com and .co.uk

there are a few things to realise:

your echo is connected to 1 server from amazon only.
you should have 1 account on only 1 server.
with that account your echo needs to be configurated
on the echo you should not be switched to another account (some people also have an account from their partner)
the password and email should be the same as the account you use to do stuff in the alexa app or on the pc on alexa.amazon.your_server

yes I am happy will be one or other. As others report with set to amazon.com I get “unavailable” when i correctly set to amazon.co.uk I can monitor the players correctly.

in the alexa.py i did find within
def play_music(self, provider_id, search_phrase) and def send_tts(self, message)
That the locale is hardcoded to en-US, I just tried changing this to en-GB in both instances but no change. (after restart)

This was because when I manually did the def get_devices(url, session) from browser i saw the locales for me were set to en-GB within the Headers.

Found a fix for it.
I have set my locales previously mentioned back to en-US and working fine.

Issue appears to be with the cookie, for me i deleted the .alexa_media.pickle file from my HA config. (dot at front makes it hidden on Linux if you cannot see it try ls -la on that directory)

Then rebooted HA and now all working including TTS and play/pause/volumes.

Potentially this cookie needs removing after any change to Domain (url in media player config) for it to take affect?

1 Like

could very wel be.
i think that the component cant notice that people change the url.
so the cookie is noticed and is there, so the authentication is picked up from the cookie.
but off course then the authentication is wrong.

so to avoid that the component needs to save the last used url as wel as the cookie, and if the url is changed the cookie needs to be deleted and new authentication should be started.

the best way to avoid that is to use only 1 alexa server (the one that amazon recomments for that country) and never try another :wink:

1 Like

Booom deleted alexa_media.pickle and works.
Thank you.

My tts is working great and very happy with that, I also want to be able to play a local sound file. (door bell sound in this case). Any ideas what i need to change as when i currently run the below all i get is: (url works fine in browser)

sorry text to speech can only be called with the alexa_tts service

  doorbell:
    alias: Door
    sequence:
      service: media_player.play_media
      data:
        entity_id:
          - media_player.living_room
        media_content_id: https://ADDRESS.duckdns.org/local/sounds/Apartment-ding-dong-sound.mp3
        media_content_type: music