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

Probably a dumb question but can you make a notifier this is -last alexa

Like this

notify:
  - platform: command_line
    name: 'last alexa'
    command: "/home/homeassistant/.homeassistant/alexa_wrapper.sh -lastalexa"

I have a several notifiactions that go to specific or all echos, such as water leak, etc. But other ones I want to speak from the one that I just spoke to.

I’m pretty sure this would work, but just checking. then something like so in an automation

  action:
  - service: notify.last_alexa
    data:
      message: "blah blah blah"

all of those are scanned by the mediaplayer component every second.
when TTS is all you want from that you got 60 or more scans a minute more then you need :wink:
even if you dont notice it now, there will come a time in home automating that those are exactly the things you want to avoid.

both hack the alexa app, by sending json to the alexa servers pretending to be the app. they use a different way to send it but the result is the same.

the difference in the way they send doesnt make a difference in how the amazon server recieves it, so i dont think that breaking changes on the amazon site would make a difference.

i guess in your case quite a lot.
i did get a warning that the component did take over 10 secs all the time in my logs. maybe because of other stuff i have going on.
like i said above, if you dont need the mediaplayers then you get send a reqeust form HA to the amazon server at least 1 time every second.
thats a high price for avoiding to create your own service.

i dont know if you use HAdashboard or appdaemon, but with a simple app you can send tts to all devices just as well, without all that scanning.

no you cant that way.
the command
/home/homeassistant/.homeassistant/alexa_wrapper.sh -lastalexa
asks what the last alexa is
so you cant send commands to that.

you would need to use the speak command (and if possible with a template part in it that puts in last alexa sensor) to send the notify

I tried this,but no luck, I’ll get it in a bit

  • service: notify.{{ states(‘sensor.last_used_echo’) }}

The sensor.last_used_echo is a sensor I built a while go, it works, but, probably not like this.

it should be something like:

command: “/home/homeassistant/.homeassistant/alexa_wrapper.sh -d {{state(sensor.last_alexa}} -e speak:’{{message}}’”

but i am no hero in templating.
i dont even know if that command accepts templating

thats why i dont use it.
but you could create a topic to ask for help with templating in notify.

1 Like

Got it, was actually pretty straight forward

Used this in my automation

  - service_template: "notify.{{ states('sensor.last_used_echo') }}"

and here is the sensor I’ve been using

  - platform: command_line
    name: Last Used Echo
    command: "/home/homeassistant/.homeassistant/alexa_remote_control.sh -lastalexa"
    entity_id: switch.last_echo_used

And I call this as well

  - service: homeassistant.update_entity
    data:
      entity_id: sensor.last_used_echo

edit: I also found this

Which allowed me to create groups of echos. I’m glad I kept following this thread, i think this will be nice.

Also, not sure if this is bad or not, but I moved my cookie file to my home directory and then edited the .sh

like so

COOKIE="/home/homeassistant/.homeassistant/.alexa.cookie"
DEVLIST="/home/homeassistant/.homeassistant/.alexa.devicelist.json"

Figure I wont have to deal with it being deleted if I reboot

Oooo nice! I’ll have to try that out. I can deal with the cookie dying every so often but hate living in fear of a reboot killing the cookie.

What I really wish is that we could figure out how to get the cookie issue resolved/easier to get.

1 Like

Can anyone give an example of how to play a prime station?

Is it as simple as

/home/homeassistant/.homeassistant/alexa_remote_control.sh -u "classic rock"

Classic Rock is the name of the station. Or is it the stationID, like I went to Share and got a code like this
A2XEBUI9EJ55OK from the URL.

I guess I need to specify which echo to send to as well. ha

right so it would be
/home/homeassistant/.homeassistant/alexa_remote_control.sh -d “my echo” -u “classic rock”

Do I have to have amazon music subscription for the music to work

When I enter
alexa_remote_control.sh -d "office” -t “classic rock”
is says
“playing PRIME playlist Classic Rock hits”
but no sound.

I’ve tried playlists and stations. I did a query and got a huge list of playlists and or stations, but no sound.

no you dont have to have anything more then prime, for prime music.
and its strange that she confirms to play but then doesnt play.
can you see that she starts playing in the app?

(please remember you are faking the app, so always look at the at the app for results)

The same happens to me… every command sent to my alexa devices to play a sound (track, album, playlist) i get always NO sound.

Here it is an example:

sudo /home/homeassistant/.homeassistant/./alexa_remote_control.sh -s "Stink-Foot"

setting default device to:

Echo Spot

playing library track:Stink-Foot on dev:Echo Spot type:A10A33FOX2NUBK serial:G070RR1383640BSD mediaownerid:A2NMKPQPAXWH3A

{"message":null

Or:

alexa_remote_control.sh -u "classic rock"

setting default device to:

Echo Spot

playing PRIME station classic rock

{}

When i look in history it shows nothing for music. For TTS it does.

you wont find it in histoty, because its no command that alexa can interpret as spoken, but as activated from the app.
in the home page from the app you can find cards for what has been activated last.

@maurizio53 does she aso say she will play it? if not then you got a different problem.

@ReneTode No, it says nothing and the history of activity is empty regarding this. Which kind of problem you think i have?
@ptdalen same here…

i dont know, but i have seen so much remarks from you with reactions to that with possible solutions that its hard to tell anything.
my suggestion for you is to start reading this topic at post 1, and look for all possible options that are there when its not working and try out why its not working for you. it could very well be your cookie, but can be anything else.

1 Like

Only thing i can see is that every other command send an output like Alexa.Traffic.Play (when i ask -e traffic), or Alexa.Speak while every command regarding music (and i have Prime Music) i get {“message”:null} as answer…

I have not tried that yet. But I noticed that if you create an Alexa routine that you can include music sources and playlists. Was thinking about creating an Alexa routine with a Spotify playlist. Then starting that routine using scripts

should be possible

I tried, but always with no success… i created a routine which include an Amazon Prime playlist that works good if i call it with voice, but if i call it with a script like this:

sudo ./alexa_remote_control.sh -e automation:"Alexa, sono a casa" -d 'Echo Spot'

I get this:

`ERROR: no such utterance ‘Alexa, sono a casa’ in Alexa routines.

EDIT: Solved, i must call the routine without Alexa at the beginning… using only “sono a casa” it works…

Now it only remains to understand why calling music from the script directly doesn’t work…