Cant get Alexa TTS working (Please Help)

Hi

I am quite new to Home Assistant, I am trying my hardest to get Alexa TTS working, Ultimately I want Alexa to speak in certain automations but atm I’m just trying to get it to work at all in testing, I don’t know what I am doing wrong. I have the Alexa media player installed from Hacs, I can do things like enable / disable Alexa guard via HA so the Alexa media player add on seems to be working fine but I just can not get the TTS working at all.

I was following this guide:

I’m just trying to get Alexa to say something testing from the developer Tools services page but I just keep getting errors.

‘Failed to call service notify/alexa_media. expected a dictionary for dictionary value @ data[‘target’]. Got ‘media_player.office’’

I have the code copied from that guide exactly although the service page does look different for me, I’m sorry if its really simple I just cant work out what I’m doing wrong.

I would really really appreciate any help.

Thanks

Rickie

I also had such issues with alexa_media service. Instead of using notify.alexa_media as service, you must be having a service with your device name like notify.alexa_media_<your_device_name>. Please try using that and in that you dont have to mention the target device.

Hi

Thanks for your response, I tried that but I am getting the same thing, I removed the target device and used alexa_media_office but still not having it :frowning:

emphasized text

Try like this.

service: notify.alexa_media_office
data:
  message: Attention. The water pump has been switched on.
  data:
    type: announce
    method: all
21 Likes

Thank you so much, that worked perfectly.

Really appreciate all your help.

Kind regards

Rickie

1 Like

I just sign up here to say: Thanks!
I tried for 4 hours now until i found your post.

Now i try to add these to a automatision if someone pass my motion sensor… no clue what to do.
I am really new to this

2 Likes

Hi there… Always happy to help. Please the automation yaml below. I have explained the yaml below that.

alias: Motion Trigger Voice Notification
description: ''
mode: single
trigger:
  - platform: state
    entity_id: binary_sensor.motion_sensor
    from: 'off'
    to: 'on'
condition: []
action:
  - service: notify.alexa_media_office
    data:
      message: Attention. Motion Triggered.
      data:
        type: announce
        method: all

So with the automation we first have to specify what is the trigger which means in what condition the automation should start. In our case its the motion detected which would be seen as the change of state of the motion sensor entity. Here I have mentioned the motion sensor entity as binary_sensor.motion_sensor but you need to change it to the entity_id of your sensor. So this automation will be triggered when this sensor changes from off to on state.

Next is the action side, where we have just copied the alexa notification from above. Here also you need to change the entity id of the alexa notify service.

There is also a feature of providing a condition in between trigger and action which can check a condition like time or if a switch is on or so before proceeding with the action. It is useful in limiting the working of this automation to specific periods or conditons.

There is also one thing to note. This is just the standard method to do this but this can vary according to the type of sensors you have. In that case we may need to teak somethings in this automation. Please do ask if you need any more help.

If you have trouble copying the yaml. Please see the gif below.

3 Likes

Great! So happy that we have people with your mindset to help others.
yh… english is not my native language as you can see :slight_smile:

Thank you

2 Likes

Spent a few hours trying to get this working with current documentation only to have a hair-pulling match with myself and my inner witts.

Your example fixed my problems and helped my sanity.
Seriously, thank you.

1 Like

And for anyone out there that might benefit from this, this is allowing me to send any message i want via template.

script:
  sendalexa:
    alias: send alert to alexa
    sequence:
    - service: notify.alexa_media_both_speakers
      data:
        target: media_player.both_speakers 
        message: >
                  {{ msg }}
        data:
          type: announce
          method: all   

take note that i have a grouped device in the alexa app that refers to both of my Echo Dots , and they are called ‘both speakers’

in the [ Developer Tools > Services ] page, under the service dropdown menu, only ‘notify.alexa_media_both_speakers’ was in the list, and not ‘media_player.both_speakers’ but at somepoint i found older documentation or reports of people having to add the ‘target:’ line and i checked in [ Developer Tools > States ] and found that i did have a media_player to target, that fit the description of the both speakers. And using that script above, used the
[ Developer Tools > Template ] tab with this:

 service: script.sendalexa
 data: 
   msg: hello! this test worked!

and the same in automations that i wanted to have passed to alexa tts.

hope this helps somebody out there!

2 Likes

Is there some issue with Alexa Media Player and Sonos One?
I am using this script to test the service in the developer tools but I got no error and nothing is played.

service: notify.alexa_media_buro_2
data:
  message: Attention. The water pump has been switched on.
  data:
    type: announce
    method: all

Any ideas what could be the cause? Thanks!

1 Like

I got it working.
My fault was that I had the wrong domain in the Alexa Media Player set up.

2 Likes

Kudos to you mate, you helped me out too.
Same a Pekah, I registered just to tell you.

Keep it up guys,

Kind Regards,

Pete

2 Likes

Thank you so much!

1 Like

Hi there, would you mind elaborating on what you mean by domain? I’m also having trouble pushing any TTS to my new Echo.

The domain is “notify”, similar to light, climate, etc.

You could try in DevTools / Service test section the proposed above solution. It worked for me today after delaying the solution of this problem for some months.

I am adding the relevant screenshots from the call notify service for Alexa TTS in NodeRed (the call service and the json entry - took me a while to figure it out).



2 Likes

i’ll be great full for the correct syntx for playing my own mp3 files on echo
I followed this youtube but without success, I tried all kind of syntx but no music
Thanks

This should do the trick:

The whole video is fantastic, It helped me out a lot.

I cannot bring alexa to speak

i tried several services:

data:
message: Attention. The water pump has been switched on.
data:
type: announce
method: all

data:
message: Attention. The water pump has been switched on.
data:
type: tts

i get this error codes:

[547465211712] Error handling message: Unknown error

20:48:47 – (FEHLER) Home Assistant WebSocket API (benutzerdefinierte Integration)

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: ‘NoneType’ object is not subscriptable

20:48:47 – (FEHLER) Alexa Media Player (benutzerdefinierte Integration)

Hello. For some reason I remember Alexa being able to speak voice notifications without the ding dong noise first. I also remember not having to put “announce.” Did something change or is this possible? I may have been wrong, but, when I was using them as speakers in my alarm system I don’t think they did that.