Alexa Announce Feature - Text to Speach via Alexa now a possability?

Tags: #<Tag:0x00007f4802dc83a8>


Rene, I have the echo media players set up and they work but when I try tts my alexa tells me “tts can only be called with a text to speach media player” ?

The audio files from my config files have also been saved in my config/tts folder but Alexa won’t say them she just tells me that “tts cannot be called…”

any hints would be much appreciated


i did try it also recently (allthough i had it running this way) and got also such a message.
and only after hearing it for a few times it made sense to me.

using TTS inside the mediaplayer somehow tries to use the google TTS.
i guess they didnt find out how to correct that (can be a homeassistant problem) and they let alexa tell you that you need to use the service.

so go to your HA dev page to services and youll find mediaplayer.alexa_tts there.
you can use that by providing entity_id and message like {“entity_id”: “media_player.your_echo”, “message”: “what should alexa speak”}

im glad that installing it was working :wink:

@Bobby_Nobble i also didnt really needed it. because i can do everything with the script.
but i got 7 alexa devices and its helpfull that i now have entities and services to set volume for all of them without adding that 1 by 1.

it certainly has also some disadvantages and its really not completely right.
but for people struggling with placing files, fileright, or linuxknowledge in general its not a bad option.


I’m in the Dev tools, services section trying to “call service” but I get an “Invalid JSON” message so unable to “call service”.

copied from my screen shot:


Service Data (JSON, optional):

{“entity_id”: “media_player.living_room”, “message”: “speak alexa, speak already”}

there’s something wrong with my service data input…?


hehe! failure certainly is not an option!
Thank you for the tips, it does appear I had inadvertantly already done all the heavy lifting when I installed the media players so I’ll try getting that to tts but again… not soooo simple either it turns out! :rofl:

I got it to work! like you said it’s the little things… turns out I needed " " with entity id’s
only took me all day to figure that out :smiley:


but you learned :wink:
next time quotes are needed you will figure that out way faster :wink:


I’ve been picking away at this on and off for months, and I have TTS working fine from the command line but I can’t get it to work when called from the HA Services page.

This works:

As does this (simulating what is happening in HA):

This is my notify config:

  - name: Alexa Office
    platform: command_line
    command: "/config/ha-alexa-tts/ -d 'Office Echo'"

I’m on

When I call it from the Services panel like this, it doesn’t work:

The little popup appears in the corner that the service has been called, but the Echo doesn’t say anything, and there’s nothing about it in the home-assistant.log file. It’s like it doesn’t happen.

My file permissions are fully executable:

And the Alexa cookie in /tmp is 777 (the only way I got this to work).

What am I missing? Why can’t I use this through HA?


your files are owned by root and you probably dont start HA as root.


OK I’ll try changing it tonight. Does that really matter since they’re executable by all? I SSH in as user “hassio” now, and that user can run the scripts from the console and it works. I’m pretty sure that’s the user HA uses.

Echo Devices (Alexa) as Media Player - Testers Needed

i have no idea because its hassio.
i find it strange that user hassio has root privileges
and i have no clue if that user also starts HA.
but the command_line stuff from HA is probably using the python sub_process lib, and that gets in trouble when a file is root and you dont use sudo in the command.


I really like this solution, but my issue has been cookies. I have 2FA and the only way I can get this to work is to download the .cookie file via Firefox and put that in the tmp directory. That lasts maybeeee a week or 2 and then without notice it’ll fail. Anybody have a solution/know if one is being worked on?


i really had no trouble untill now.
but for TTS i recently added the alexa mediaplayer component.
that works like i want to, and still does.

now i wanted to use the script again to create a sensor last_alexa.
but i can login anymore with the script.
i know amazon added captcha but how do i get my cookie now?

i already logged in to alexa with firefox on the device where the script is, but that doesnt help.

and i have no clue how to get the alexa.cookie where people are speaking about.


I’ve read through here and like many others am having trouble figuring out the cookie part. My situation
Running HA in a python venv.
I do not have a browser loaded on my ubuntu machine.
I’ve tried using chrome and firefox extensions, pulled the cookie as a text file, then put in in /tmp as txt and renamed to .alexa.cookie. I get the following error

[email protected]:/home/homeassistant/.homeassistant$ ./ -a
cookie expired, logging in again ...
rm: cannot remove '/tmp/.alexa.cookie': Operation not permitted
ERROR: Amazon Login was unsuccessful. Possibly you get a captcha login screen.
 Try logging in to with your browser. In your browser
 make sure to have all Amazon related cookies deleted and Javascript disabled!

I am using 2FA, does I could not find any refrence about that in this thread. Any help is appreciated

I was able to get the - rm: cannot remove ‘/tmp/.alexa.cookie’: Operation not permitted
error solved by using sudo with my command, but of course that just deleted the cookie, and it still fails to logon.


After @ ReneTode explained the script can trigger routines within Alexa I have re-established the script within my Hassio

I too switched over to the media_player as it was simpler and has been very reliable. I am currently, running both the script and media player concurrently without issue.

As you can get the script to work without issue in Hassio, try the following in HA, this works for me without a problem.

  alexa_talk: '/config/ -d "{{ device }}" -e speak:"{{ talk }}" '

Make sure the ’ and " are correct, type don’t cut and past, I wasted hours with yaml errors with corrupted text

To test go to the Developer tools, Services

Service: shell_command.alexa_talk
Service data: {“device”:“name of alexa device”,“talk”:“testing testing 1 2 3”}

replace “name of alexa device” with the correct name :wink:

Hope this works. If so you can chop up the script to do most things

alexa_vol: '/config/ -d "{{ device }}" -e vol:{{ volume }} '
alexa_routine: '/config/ -d "{{ device }}" -e automation:"{{ routine }}" '


How did you manage to get a cookies working for any amount of time with 2FA. I’m stuck


Are you saying you dont need the cookie in your configuration?


no i am saying that i dont know how to get the cookies.txt file.

in the meantime i found an addon for firefox to export the cookie to a json file, but now i still get only cookie expired :frowning:


how did you get the login to work?


Aww that makes sense. Sorry I misunderstood, I thought you had this running for a while, and when you say you dont know about getting the cookies, I thought maybe you had a trick. :slight_smile:

in firefox I get a json, in chrome I get a txt. Neither works for me


yeah i was one of the first to get it running.
back then it just triggered a browserscreen and i logged in and have been using that ever since.
so i didnt even realise there were cookies involved :wink:

and i never had anything to do with cookies before so i really had no idea how to get them.


Do you have a browser on the same system as your HA install?