Tts.cloud_say and amazon Alexa

hello,
I was wondering if is possible to use tts.cloud_say with Alexa echos as the media player?

ofcourse I have already get the answer, but I was wondering if anyone has find a way to use alexa devices as media players?

2021-02-10 11:52:34 WARNING (MainThread) [custom_components.alexa_media.media_player] Sorry, text to speech can only be called with the notify.alexa_media service. Please see the alexa_media wiki for details.https://github.com/custom-components/alexa_media_player/wiki/Configuration%3A-Notification-Component#use-the-notifyalexa_media-service

This topic is quite old but still valid.

The short answer is YES, you can use Nabu Casa TTS service with your echos.

My idea was to use the tts_get_url REST endpoint to get a direct URL to the generated TTS file and then ask Alexa to play it as an mp3 file.

  1. Get the URL

Request POST /api/tts_get_url

{
    "platform": "cloud",
    "message": "To jest mój test",
    "language": "pl-PL",
    "options": {
        "gender": "female"
    }
}
  1. Play the TTS file as an mp3 on Alexa
service: notify.alexa_media
data:
  message: "<audio src='https://....nabu.casa/api/tts_proxy/..._cloud.mp3'/>"
  target: media_player.<your_echo_name>
  data:
    type: tts

Since mostly I use Node-Red for my automations I have used it for this case as well.

2021-09-07 at 18.08

Import the following nodes and try them on your end:

[{"id":"4d325b8a56405a8c","type":"ha-api","z":"2a0a9d47cb5cc092","name":"Get TTS URL","server":"8147d85a.d4ab48","version":1,"debugenabled":false,"protocol":"http","method":"post","path":"/api/tts_get_url","data":"{\"platform\":\"cloud\",\"message\":\"{{payload}}\",\"language\":\"pl-PL\",\"options\":{\"gender\":\"female\"}}","dataType":"json","responseType":"json","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"}],"x":370,"y":260,"wires":[["e3f537014143b116"]]},{"id":"e3f537014143b116","type":"api-call-service","z":"2a0a9d47cb5cc092","name":"Play TTS","server":"8147d85a.d4ab48","version":3,"debugenabled":false,"service_domain":"notify","service":"alexa_media","entityId":"","data":"{\"target\":[\"media_player.echo_dot\"],\"data\":{\"type\":\"tts\"},\"message\":\"<audio src='{{payload.url}}'/>\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":560,"y":260,"wires":[[]]},{"id":"58a143b6c9ca034d","type":"inject","z":"2a0a9d47cb5cc092","name":"Message","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"To jest mój test","payloadType":"str","x":180,"y":260,"wires":[["4d325b8a56405a8c"]]}]

The above solution works like a charm with my echo dot 4 but it should work with other echos as well.