Alexa tts service

whats the way to use tts service in amazon echo?
if there is away


the search button at the top right is your friend:

1 Like

You’ll need to download the custom component from the link in the previous post. Once you have done this, I would test it by putting the following in your scripts yaml file, and launching manually in your services applet. If things work well, you can include it in your automations.

  alias: testing my TTS with Alexa
  - service: media_player.alexa_tts
    entity_id: media_player.<name of your alexa here>
      message: <your message here>

I’m trying to get alexa to say the temperature. I go to services to test out my approach and I type in:

>     > Service
>     > media_player.alexa_tts
>     >  
>     > Service Data (JSON, optional)
>     > 
>     > {"entity_id":"media_player.bob_s_dot", "message" :" The temp is {{states('sensor.house_temp')}}"
>     > }

Alexa will say exactly what’s in the quotes and not substitute the actual temperature from the sensor. Has anyone done this using If so, how?


i dont think it can be done from the services screen.

in your automations you need to replace data for data_template

Thanks Rene but I have that in my automation.yaml now. As a test, I added:
- id: ‘1551213718931’
alias: New Automation

  • entity_id: switch.bobs_door_2
    from: ‘off’
    platform: state
    to: ‘on’
    condition: []
  • data_template:
    entity_id: media_player.bob_s_dot
    message: temperature is {{states (‘sensor.house_temp’)}}
    service: media_player.alexa_tts

Then I manually trigger the automation and Alexa says exactly what is in the message (she doesn’t say 'curly-bracex or paren…)
It’s driving me nuts. It doesn’t work with tts.google_say either. Any clues would be appreciated.


has probably to do with quotes.
im not the best one to debug automations, because i dont use them, but i know there are examples in this topic

and on the wiki they got.

the best thing is to read that (extreme long) topic from the back untill you find the link to the wiki and then look up the examples there.

That was pretty quick Rene - thank you. I’ll check it out (again looking more carefully…)

15 minutes, hmm i have been faster :wink:

message info needs to be in quotes when it has a single line template

message: "temperature is {{ states('sensor.house_temp') }}"
1 Like

Rene, Petro - thanks.
I’m making headway after reading the thread and a secondary thread, the syntax was different: This:
message: ->‘The outside temperature is {{states (“sensor.house_temp”) }} degrees.’

Now Alexa says 'the outside temperature is unknown degrees

message: “temperature is {{ states(‘sensor.house_temp’) }}”

does the same thing 'unknown".
But I must be close because during the last boot, those sensors came up as ‘unknown’. I don’t know what the ‘->’ symbol does in the first example because they both seem to work the same.

I’m rebooting as I type this hoping to get the sensors back but it takes a good 5 minutes with my pi 3B+. I wish there was an easier way to discover devices than rebooting.

But after the boot: IT WORKS!! Both with the ‘->’ pointer and without.

Thanks to both of you.

1 Like

The pointer does nothing. Not sure where you got that from. Just remove it.

depending on the type of devices there is another way, but you need to be able to program in python (then appdaemon is an option) or the devices that provide the entities need to be able to use MQTT.

You probably shouldn’t need to reboot the pi to get stuff working again. Just restart the HA server from the configuration page.

Right Petro. I’ve seen it in several examples so it’s not clear when it is needed or what it does. It seems to work with or without so out it goes. Tx

a -> isn’t correct in any template. an >- can be correct.

A single arrow with the template on the following line means “Multi-line template”. Essentially tells the yaml that the template isn’t going to be just on the message line.

 message: >
   {{ states('light.living_room') }}

A single arrow follwed by a minus means a “Multi-line template, but remove extra leading white space”. White space is spaces, tabs, carriage returns.

 message: >-
   {{ states('light.living_room') }}

All other combinations of the arrows are wrong.

If you don’t have a template that is multi-line, the proper way to write it is in quotes.

 message: "{{ states('light.living_room') }}"

Thanks Rene. I was running appdaemon to get the HADashboard running but after trying home panel, it seems easier to get running. I don’t have any mqtt devices yet, but a couple of wemo fauxmo esp8266 that are being cranky since 0.88.1.

Ah, my bad. I misread and retyped the wrong order of characters. My forst thought was that it was multi-line but wasn’t paying close enough attention while trying to get mine to work.

Many thanks for the excellent clarification and I won’t make that mistake again!


what was difficult for you gettin dashboard running?

Probably all the things that everyone else went through Rene. That post was an excellent resource but I was flailing away for a while and finally got a dashboard or two running. Then I saw Home Panel and tried it and it seemed to be more intuitive (though most of it is hidden somewhere on my pi filesystem.) I use putty to log in and can’t find a single js file used by the html panel.
I’m sure it’s me being thick.
Didn’t mean to hijack this Alexa_tts thread though.