Newbie struggling with making alexa speak

I have been searching and searching for answers to this but I cant seem to find one.
I tested it in the developers service section and it worked

service: notify.alexa_media_dining_room_echo
data:
  message: this is a test
  data:
    type: tts

When i try and use in node red it just give me errors like “Call-service API error. Error Message: expected dict for dictionary value @ data[‘data’]”
Ive tried finding answers but honestly my head hurts now

[[{"id":"e7adaaf4.d085a8","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"e57a84fd.8cd8f8","type":"inject","z":"e7adaaf4.d085a8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":740,"y":180,"wires":[["3e9298d4.d5458","20a51f8c.d0d98"]]},{"id":"20a51f8c.d0d98","type":"debug","z":"e7adaaf4.d085a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":970,"y":140,"wires":[]},{"id":"3e9298d4.d5458","type":"api-call-service","z":"e7adaaf4.d085a8","name":"Alexa Speaks","server":"ff18536e.15029","version":1,"debugenabled":true,"service_domain":"notify","service":"alexa_media_dining_room_echo","entityId":"","data":"{\"message\":\"The garage door has been open for 10 minutes.\",\"data\":\"type: tts\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":990,"y":200,"wires":[[]]},{"id":"ff18536e.15029","type":"server","name":"Home Assistant","addon":true}]]

Ok so I finally figured it out after posting this lol

@ShavedApe The following flow will allow you to set the ‘volume’, ‘message’ and ‘target’ Alexa device you wish to deploy your user defined message to.

To do this, modify your message in the Announcement node and set the volume and target device (or group target devices) you wish to send the message to.

[{"id":"50f21a29.723524","type":"api-call-service","z":"25063fae.4f85f","name":"Alexa - Notification","server":"8a3231e1.3f0e1","version":1,"service_domain":"notify","service":"alexa_media","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":true,"x":1315.0000686645508,"y":3238.7500619888306,"wires":[[]]},{"id":"7c798c0e.ebce64","type":"function","z":"25063fae.4f85f","name":"Create Alexa Alert","func":"\nvar target = global.get('target')\nvar message = msg.payload \n\nvar payload = \n{\n \"data\":\n    {\n    \"target\": `${target}`,\n    \"message\": `${message}`\n    }\n}\nmsg.payload = payload\nmsg.topic = `${target}`\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":803.7500076293945,"y":3241.250047683716,"wires":[["71375ebc.08862"]]},{"id":"71375ebc.08862","type":"template","z":"25063fae.4f85f","name":"Alexa device - Template","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n\"data\": \n    {\n    \"message\": \"{{ payload.data.message}}\",\n    \"target\": \"{{ payload.data.target }}\",\n    \"data\": {\n        \"type\": \"announce\"\n            }\n    }\n}    ","output":"json","x":1052.5000610351562,"y":3240.0000619888306,"wires":[["50f21a29.723524"]]},{"id":"74595830.99f708","type":"api-render-template","z":"25063fae.4f85f","name":"Anouncement","server":"8a3231e1.3f0e1","template":"\n\"This is a test\"\n","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":357.50000762939453,"y":3246.250047683716,"wires":[["ed3fdca3.680f8"]]},{"id":"ed3fdca3.680f8","type":"change","z":"25063fae.4f85f","name":"Set Alexa Attributes","rules":[{"t":"set","p":"volume","pt":"flow","to":"0.4","tot":"str"},{"t":"set","p":"target","pt":"global","to":"media_player.office_echo_dot","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":576.6071929931641,"y":3245.0000982284546,"wires":[["9df98b7c.1dacf8","7c798c0e.ebce64"]]},{"id":"a708dc5a.7afbb","type":"inject","z":"25063fae.4f85f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":172.5,"y":3246.250047683716,"wires":[["74595830.99f708"]]},{"id":"9df98b7c.1dacf8","type":"debug","z":"25063fae.4f85f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":800,"y":3316.25,"wires":[]},{"id":"8a3231e1.3f0e1","type":"server","name":"Hassio","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true}]

4 Likes

Thank you

I am currently trying to figure out how to get it to work on more than one so this will definitely help thank you

I got it to work on multiple devices thank you so much for pointing me in the right direction

1 Like

How did you fix it? I am plagued by this issue and can’t seem to get Alexa to speak. If I use the GUI and type something in I get Alexa to respond “I am sorry but text to speech requires using the notify app…” so Alexa is connected. However, every time I try to test using a service it gives me that dict error or another error about extra keys. I can’t seem to figure this out.

I’ve tried different levels of formatting but any ideas what I am doing wrong?

service: notify.alexa_media_eric_s_2nd_echo_dot
data:
  message: The garage door has been open for 10 minutes.
  title: Your Garage Door Friend
  data: tts

This is what I see in my logs

2021-05-09 17:11:22 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Invalid data for call_service at pos 1: expected dict for dictionary value @ data['data']
2021-05-09 17:11:22 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140519712419648] Error handling message: expected dict for dictionary value @ data['data']. Got None

I tried different container images but am at a loss as to what I am doing wrong.

Mine worked fine when testing as a service it was getting to work with node red I struggled with.
In your example you have it as data: tts
but it should be
data:
type: tts
for example

service: notify.alexa_media_eric_s_2nd_echo_dot
data:
  message: The garage door has been open for 10 minutes.
  data:
    type: tts

Im a complete noob at this stuff though so someone else may have better answers. As I say I though my issue was node red I never even tried in the gui automations.

1 Like

Cheers I’m going to use that as well :blush:
Do any of you guys know if it’s possible that when I ask for a broadcast on Google Home it can be read out on a Alexa device ?

The flow bastero posted works great for announcements and tts you just have to change the word “announcement” to “tts” and voila you have your echos talking. I dont remember exactly which node you change it in but pretty sure its only in there once.

Google is slightly different and someone correct me if Im wrong but I believe its broken atm too

1 Like

Holy smokes that worked. I swear though I used that exact same format multiple times, but kept getting that dict error. I did have some weirdness trying to test this out. If I copy/paste your entry into my service call it refused to work. It is as if I couldn’t press the button. Other services worked. I restarted Home-Assistant and same problem persisted. I finally typed it by hand into there and it worked. That is very weird.

1 Like