Echo Devices (Alexa) as Media Player - Testers Needed

Pull the debug logs for the prior command that failed and then compare the json output. You can then see what changed between the two attempts.

Strange last couple of times iv had to re authentication it’s made me change my password fully. Using Amazon.co.uk. iv not tried the cookies.txt yet so may try that .
Anyone els having to totally change password to get it working again??
Thanks
Osborne82

Yep. See my posts a few above.

when checking configuration I get this error

Platform error media_player.alexa - No module named ‘homeassistant.components.alexa.media_player’

You need to use the latest instructions and not the ones from 2018.

Hello guys.

Some days ago I received a notification from HA for a re-authentication. That wasn’t the fist time, but this time it blocked my Amazon account.

No problem, I changed my password, deleted the integration and installed it again.

Now, i logged in with my new password, and the process went well but I have a big problem: all of my entities are unavailable.

What can I do?
Thanks!

I had this same issue and had to remove the integration completely and then re-add it, once I authenticated correctly all the devices were detected and active.

1 Like

This Alexa integration works for me to run routines and issue text-to-speech announcements, but I can’t get it to play music or sounds. The media_player.play_media service appears to run, and there are no error messages, but nothing happens. I’ve tried the listed examples in the wiki, but they don’t work, for example:

{
  "entity_id": "media_player.echo_one",
  "media_content_id": "amzn_sfx_doorbell_chime_01",
  "media_content_type": "sound"
}

or

{
  "entity_id": "media_player.echo_two",
  "media_content_id": "e._s._p._n. radio",
  "media_content_type": "TUNEIN"
}

don’t work, but this does:

{
    "entity_id": "media_player.echo_two",
    "media_content_id": "Bar switch",
    "media_content_type": "routine"
}

Any suggestions for tests I could try to diagnose this?

Did you enter the right domain?

Does the play music or sound work in your Alexa app? Play_media uses the same API call for the items you listed so the fact routines work is odd. You can try turning on debug logs for Alexapy and it’ll show the exact API call and HTTP response.

I’m using domain “media_player”, same as for the routines, which I assume is correct from all the examples I’ve seen.

Since installing this, I’ve been forced to change my Amazon password numerous times. I’m still to work out how to use alexa with HA, even after signing up for the free month of nabu casa

Yes, today i did it again and it finally worked fine! Thanks!

Since I can’t do analytics directly, here’s a google form where you can let me know about your reauth experiences. I’d also appreciate people with good experiences to chime in so we can figure out if it’s a setting that’s causing people problems.

Hi alantse, I answered the questionaire twice. In my first one, I estimated the reauth frequency with 10 days. Rechecking my SMS shows, that I have to reauth exactly every 14 days. So if possible, ignore or delete my first record. (DE, every 10 days, 25 api calls)

Trying to get a different Echo, using ‘sensor.last_alexa’, to announce the value of ‘sensor.kitchen_echo_next_timer’ as it is shown in the front-end card, ie ‘in six minutes’ rather than using the actual sensor value, ie ‘2020-11-23T09:41:38+00:00’ which I currently use to produce ‘The kitchen timer will go off at nine forty one’ like this…

The kitchen timer will go off at {{ as_timestamp(strptime(states(‘sensor.kitchen_next_timer’), ‘%Y-%m-%d %H:%M:%S’)) | timestamp_custom(‘%-I:%M’) }}

Hoping to end up with something relatively simple like …

The kitchen timer will go off {{ state_attr(‘sensor.echo_next_timer’, ‘message’) }}

…as the sensor card has already done the hard work and that format is what I ideally need to fit in with the way I have Alexa call announcements from HA using @lonebaggie’s genius dummy light technique. Adding other sensors to call on to make it a simple message is obviously fine.

Have adapted this…

…to create a script I can expose to Alexa and although it works I’d like to get something into the format described above if possible…

kitchen_timer:
  sequence:
  - service_template: '{% set name = states(''sensor.last_alexa'').split(''.'') %}
      notify.alexa_media_{{name[-1]}}

      '
    data_template:
      message: >-
        {%- if states.sensor.kitchen_next_timer.state != "unavailable" -%}
        {%- set sorted_active = states.sensor.kitchen_next_timer.attributes.sorted_active | from_json -%}
        {%- set duration = (sorted_active[0][1].remainingTime / 60000) | round(0) -%}
        {%- set remaining = (((as_timestamp(states.sensor.kitchen_next_timer.state) - as_timestamp(now())) / 60) | int) -%}
        You have {{ remaining }} {{ "minutes" if duration > 1 else "minute" }} left on your kitchen timer.
        {%- endif -%}
      data:
        type: tts
        method: all

Any suggestions gratefully received.

Thanks for the mention :slight_smile:

If your sill using my Speech engine

You can extract time and date info

2 Likes

You’re more than welcome :+1:

I did actually use that code, great find, and it works a treat but went back to basics for this post so as not confuse/put off people who aren’t familiar with it from helping out if they can and also to show that I have tried and got stuck rather than just expect someone else to do it for me :grin:

Just here to chime in a bit late, but still. Thank you for all of your hard work on this project. The re-authentication is no problem for me. It really is a tiny price to pay for such an amazing integration.

Also wanted to add that I solved the “Detected a Password Reset” prompt by simply changing my Amazon password to be something under 14 characters and it re-authenticated instantly while also putting my 2FA code in.

2 Likes

@PlayedIn How did you get Multiroom Music (speaker groups) to work? When I call the service for an Alexa speaker group, I get no response at all or errors in the log.

Wiki.