Speech Parser script to extract entity Id information into readable form for Alexa or Google Assistant TTS

So, how does this work? As I said, I have only found Alexa Home which is simply returns on, off, or bri. I would love to be able to script Alexa to respond to other commands. Like, “Alexa what is the basement temperature?”, or could it even let me ask “Alexa, where is kim?” and determine it she is at work or driving using Life 360?

the alexa app on android or iphone supports alexa routines

read the title :slight_smile:

So, you aren’t going to tell me?
How do you get an Alexa routine into Home Assistant?

how about reading the first post from this topic?

edit: but nowadays you can also implement the alexa mediaplayer component.

Nowhere did the prior posts mention an Alexa Mediaplayer Component. (I did not realize that there is an Alexa component). We’re obviously talking about two completely different methods of getting an Alexa interface to Home Assistant.

thats right. but at the time this topic was started there was only 1 option.
and just a simple search on the forum brings a lot. (try alexa and you finde the mediaplayer component)

so the answer to your question how to use alexa routines in HA still stands.

  1. read the first post and use that option
  2. find the custom component alexa mediaplayer on the forum and use that option.

@lonebaggie I used your virtual_light template in my configuration.yaml flike so:

  - platform: template
        friendly_name: "Alexa Dummy Light"

It shows up in my entities and has a state of ‘off’. When I ask alexa to discover devices, it doesn’t find it. Am I supposed to expose it in some other way? I’ve exposed emulated hue lights as scripts and the scripts are discovered fine. I’m using the alexa/media_player v0.10.2.


See the following

Any issues I will answer on that thread . Keep the help easy to find

I have updated the program with a global search and replace to amend the final parse. This can be used to translate the language of any of the sensors , or simply to refine the final output

Updated with the notify option in the current version of alexa media player

1 Like

Hi thanks for the really useful app.
I am at a mm from having it working

I see in debug that everything is correctly parsed but at the end the speech is sent to a destionation “none”

I also see in the code your comment that the TTS voice is set as

    self.call_service("alexa_media/update_last_called")                    #
    TTS_voice = self.get_state("sensor.last_alexa")      

2019-05-26 01:31:51.371825 INFO SpeechParser: extended parse= La Contatto Porta Taverna e’ aperta{$01=state|off| e’ chiusa}
2019-05-26 01:31:51.372192 INFO SpeechParser: scmd = [(‘$’, ‘01’, ‘=’, ‘state’, ‘off’, " e’ chiusa")]
2019-05-26 01:31:51.372552 INFO SpeechParser: ind 1 state state
2019-05-26 01:31:51.372949 INFO SpeechParser: ext output parse= e’ chiusa
2019-05-26 01:31:51.373308 INFO SpeechParser: input value = off replace Value = e’ chiusa
2019-05-26 01:31:51.373659 INFO SpeechParser: operator is =
2019-05-26 01:31:51.374018 INFO SpeechParser: extended parse= La Contatto Porta Taverna e’ aperta
2019-05-26 01:31:51.374373 INFO SpeechParser: translate morning|morgan
2019-05-26 01:31:51.374837 INFO SpeechParser: translate source morning replace with morgan
2019-05-26 01:31:51.375205 INFO SpeechParser: Message 1 for None is La Contatto Porta Taverna e’ aperta

Clearly last alexa for me is set to “none” and not the last invoked alexa (I am trying right now with alexa mobile app )
what could be wrong?


Ensure you have a working TTS with Echo Devices (Alexa) as Media Player - Testers Needed

Then simply replace TTS_voice = self.get_state(“sensor.last_alexa”) with

TTS_voice = “the actual name of the device”

There have been a number of improvements in Echo Devices (Alexa) as Media Player - Testers Needed since I wrote this.

check this for last sensor https://github.com/keatontaylor/alexa_media_player/wiki

If you only have 1 alexa then the above is not required just code the name

Hi thanks for the Quick reply.
I have the Alexa component installed .
I have more two Alexa at home .
Shall i choose One?
Or perhaps duplicate the call to all.

Last night while testing i was doing It from my mobile using the Alexa app: Is the feedback to app instead of device not supported ?

TX again

Ensuure the Alexa component is working . My App is simply a parse to generate text to for the alexa App to speak

The debug looks fine just needs the the Alexa name

I use the last alexa sensor to ensure the correct alexa responds to the trigger. You can hard code the alexa name to test , then work on the last alexa sensor

Yes. That Is my Plan :slight_smile:
Just the last step seems not working (last Alexa search)

Success! Now to understand why last Alexa Is not picked up

I can’t understand how to use it.
I create a dumb bulb, but where I must insert the script “SpeechParser”?

This is quite an old script . If your not using Appdaemon try this .

Good, I will check it.
Thank you.