Echo Devices (Alexa) as Media Player - Testers Needed

This works here - add more echos if you like:

alias: 1_Notification Test Weekly TTS
description: ''
trigger: []
condition: []
action:
  - data:
      volume_level: 0.28
    service: media_player.volume_set
    target:
      entity_id:
        - media_player.echo_office
        - media_player.echo_bath
  - service: notify.alexa_media
    data:
      message: This is a daily announcement
      data:
        type: tts
      target: media_player.echo_office,media_player.echo_bath
mode: single
1 Like

Thank you @Joerg

Is there a way to make notification commands wait until the previous is finished before starting the next?

I’m doing a notify command to play a local audio file followed by a notify command with TTS, but it will randomly choose which command to trigger, or start one briefly and cut it off with the next.

Oddly enough, the “play_media” command, followed by a “notify” works fine, it finishes playing the media then triggers the notification.

Hi all,

I am also having issues with my alexa tts
I installed the Alexa Media Player integration through HACS, I can see all my echo devices under the Devices tab

In my configuration.yml I have tts enabled:

# Text to speech
 tts:
   - platform: google_translate

Here is my Service Call to test tts to my echo dot, when I click on Call Service the button goes green and no error message on the page, but I get no output on the echo device (i have tried the other devices and group) I also don’t see any error messages in the logs:

service: notify.alexa_media
data:
  message: "Hi"
  data:
    type: tts
  target:
    - media_player.niel_s_kitchen_echo_dot

Does anyone have any suggestions for me please?

Home Assistant 2021.10.6
Frontend version: 20211007.1 - latest
HACS: 1.13.2

I can’t seem to get music played over a radio stream to work, maybe i’m misinterpreting things but I thought it was as simple as

service: media_player.play_media
data:
  media_content_id: https://192.168.1.243/radio/8000/radio.mp3
  media_content_type: music
target:
  device_id: 

when I run this alexa tells me this
Sorry, text to speech can only be called with the notify.alexa_media service, i’ve tried it with iheart radio and it works fine.

No, Amazon doesn’t want you to play local files. Play a local mp3 file on Alexa Echo dot - #40 by Goldwing

I’m interested in using alexa media player for a long time now but always held off because of all the reauth issues I saw.

How is it currenty, are frequent reauthentications still needed or will it “just work” for a longer time? I’m not talking about using the built in 2FA App, I would just use the “normal” 2FA connection.

I think this is random and is totally controlled by Amazon.
For example, if I look back over the last 6 months, I had to reauth on 14th April, then 22nd June, then 23rd Sept.
But now for me it is more often, 30th Sept, 14th Oct and the last one yesterday 28th Oct.

Is there a pattern here of every 14 days recently?
Anyone else seeing this?

BTW I use Amazon OTP sms as 2FA for my own reasons which does make a re-auth more challenging !!

No its a massive annoyance for me still and getting it to reauth is also a massive annoyance. I don’t know what it is but every time I see that reauth I know its going to be a pain in the neck. Fill out the boxes and some random error appears.

Question. Does all this go away if you pay nabucasa the subscription?

Mh thats really unfortunate. In theory that integration is super useful but I want my smart home to be hassle-free, not to annoy me with the need of frequent manual fixing.

I am currently paying for the nabu casa subscription and am using alexa via this, but thats not really the same as this integration. You can really easy sync all devices to alexa and control them by voice but the subscription will not allow you to use echo devices as media players. So when I currently want alexa to say something I need to toggle an input boolean and have a alexa routine defined that reacts to that toggle. With the media player I could do everything in HA.

I had a reauthentication request yesterday. First one I’ve seen in many, many months. I use Nabu Casa.

This integration is using an unofficial, undocumented API and every time Amazon so much as sneeze, there’s a chance that it’ll stop working. That being said, it’s been rock-solid for me and forms an essential part of my smart home.

The devs on this integration do an absolutely amazing job.

1 Like

Then you are lucky because all I get is password errors, unknown errors and config flow errors. Authenticating in my case is an absolute nightmare. Just went to do it now, 2FA key in, password error. Re-enter the password, password error.

No one is saying the devs ‘don’t do an absolutely amazing job!’, but the fact is this is far from perfect and even authenticating can be hardwork. If you are going months and months without reauthentication, I’d like to see some broad stats from many users because in my experience that must be pure luck. The guy two posts above authenticated 6 times in 6 months, I’ve had to do it several. I’ve never once gone ‘many, many months’, please let us know what you are doing which is leading to that as I’d appreciate it behaving the same way!

There was a time when I too was having to reauthenticate regularly. In fact I had to change my Amazon password several times as it kept getting locked out. Also, where I had to reauthenticate this week, I too received a password error whilst using the Android companion app - using a browser (for some reason) worked OK.

I don’t think I’m doing anything special. I’m an Amazon UK user with nine echo devices and a Nabu Casa subscription. I’m using HAOS on an ESXi VM on an 8th Gen Intel NUC. Perhaps it is luck.

If you read my post correctly you will see, Yes I had to reauth 6 times in 6 months BUT I went from 2 months to 3 months before reauth and now it is every 2 weeks. So I went for “many many months” without a reauth to every 2 weeks. As I said I think this is Amazon.

Do you read the html files in the HA config dir that are created when a reauth fails? They tell you why it has failed. Unfortunately the AMP reauth interface doesn’t correctly interpret this which is understandable as its a screen scrape! So, for example, you get a wrong password issue when it isn’t.

Unfortunately, in my experience, the reauth is triggered at some time early morning so I have zero chance of entering the 2FA correctly.
If reauth fails which usually does, the only way I can reauth is to restart HA. That forces Amazon to generate another 2FA ( in my case an OTP sms)

There is currently an issue where Amazon will incorrectly reject auth attempts with an incorrect password response. One you’re in the state sometimes a resubmission will work and sometimes you have to remove and readd the integration to start a new session. Given this and the number of complaints, the reauth is broken enough that I’ll probably just rip it all out and make everyone remove and readd (which is my recommended workaround).

If you don’t want to worry about reauths, then I suggest you don’t install the integration. I’m not saying this to be mean, but I can’t guarantee you’ll avoid reauths since we’re hacking Amazon’s API and pretending to be their official app.

One thing that should reduce reauth is using the oauth token login method because the tokens are longer lived. It’s the default setting when you remove and readd, but if someone hasn’t done a remove and readd and is on an old configuration, it would not be enabled as the reauth path doesn’t change any settings. If you’re in this state, the logs should have a warning like “not using oauth tokens, using fallback method.” 2 week reauths are quite common with this fallback method and was a major issue driving the swap to oauth tokens.

For me, I go months without reauth but I’m based in the US so maybe there’s less breakage since Amazon is US based. Unfortunately, hunting down reauth issues for people outside the US is difficult
and it may be tied to the fact Amazon doesn’t want third-party apps accessing the API. While Amazon hasn’t explicitly killed us yet, that’s always a risk.

No. Nabucasa isn’t related to the issues with the custom component.

Don’t get me wrong. I love the integration. I was merely answering the question posed by itDevelops, with my experience.

I was not complaining as I have a working method to reauth.

So your workaround is to delete the integration from Config - Integrations and then add it back in?
According to the wiki this doesn’t mean the entities change and the automations and scripts still work. This is Great.
You also mention the “oauth token login method” as being the the recommended way to login.

I think the wiki is confusing here
" 1. As of 3.5.0, you can also use the non oauth-token login method by disabling the option. This is the default method from 3.4.1 and below which imitated the webapp but also reported reauth problems. Oauth token is how the mobile apps login and in theory will not have that problem."

So, since I haven’t deleted the integration and re-added it since i first installed it many moons ago, I don’t know what that means. It would be nice if the wiki had a succinct recommended way to authorise.

finity suggested the same here

You also mention the logs but when I look I don’t see anything in the HA logs referring to “not using oauth tokens”. So again I’m confused.

I’m in the UK but as I mentioned in my earlier post I went 3 months without a reauth so maybe the oauth token login is the answer, But how do you do that? Any screenshots would be welcome.

Thanks

I reinstalled as suggested, was able to reauth without issue and no config flow / password errors. Thanks. Perhaps I had not looked hard enough but that piece of advice was alluding me and now I’m back up and running. Thanks. EDIT: I also used the built in 2FA this time (was previously using my authenticator app as thats what I was already using for Amazon prior to installing the integration).

For what it is worth, it is not the reauth that bothers me, its how when you try to do it you can get met with these errors and stuck in a never ending loop with no clue what to do. But now I know to reinstall.

One other thing that would be useful certainly for myself is setup a push notification when authentication is required rather than wondering why my automations are no longer running and finding it asking for authentication. Is there some sensor or method for catching the transition from authenticated to not authenticated so I could setup some push notification to myself to fix it?

Thanks.

1 Like

You’ve thought of everything :slight_smile:

He really has, and has spent countless hours of his own time keeping this going… and never leaves us hanging when an issue pops up.

2 Likes