TTS not working any more

I have a Google Nest Audio speaker that I used to be able to send text messages to and they used to be spoken out loud. This no longer works.
If I try it as a script. I get the error message:

Failed to call service script/test_tts.connection lost

Here is the script:

alias: Test TTS
sequence:
  - service: tts.speak
    data:
      cache: true
      media_player_entity_id: media_player.lounge_room_speaker
      message: May the force be with you
mode: single

From the log file:

Test TTS: Error executing script. Invalid data for call_service at pos 1: must contain at least one of entity_id, device_id, area_id.

Does anyone have any good ideas why this could be? What am I doing wrong?

PS. I am a noob.

I think you need a target like:


service: tts.speak
target: tts.example
data:
  media_player_entity_id: media_player.kitchen
  message: "May the force be with you."

And you may also need to remove base_url option for the tts config in configuration.yaml.

Thanks. I will try that and report back.
Much appreciated.

No go. Here is my script:

service: tts.speak
target: tts.example
media_player_entity_id: lounge_room_speaker
data:
  message: "may the force be with you"

The pop-up error message:

Failed to call service tts.speak. expected a dictionary for disctionary value @data[‘sequence’][0][‘target’]. Got ‘tts.example’ extra keys not allowed @ data[‘sequence’][0][‘media_player_entity_id’]. Got lounge_room_speaker’

From the log file:

[547616368976] Error handling message: must contain at least one of entity_id, device_id, area_id.. Got {'type': 'execute_script', 'sequence': [{'service': 'tts.speak', 'data': {'media_player_entity_id': 'media_player.lounge_room_speaker', 'message': 'May the force be with you'}}], 'id': 148} (invalid_format) Leif from 192.168.1.131 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67)

And also from the log file (I am not certain this is related):

websocket_api script: Error executing script. Invalid data for call_service at pos 1: must contain at least one of entity_id, device_id, area_id.
websocket_api script: Error executing script. Invalid data for call_service at pos 1: not a valid value for dictionary value @ data['media_player_entity_id']

Please help, I am stuck and have nowhere else to turn.

target: tts.example is just an example, it’s not real.
I have no idea where to get the target tts, it’s not very clear in the docs.
What tts, NabuCasa (tts.cloud_say), Google (tts.google_translate_say) services are available to you?
An example could be used:

service: tts.cloud_say
data:
  entity_id: media_player.lounge_room_speaker
  message: may the force be with you

In developer tools this works.

service: tts.google_say
data:
  cache: false
  entity_id: media_player.m5stack_atom_echo_80bcd0
  message: May the force be with you

I had same problem.

I installed tts in/from Ui at devices.

In config yaml deleted TTS settings.

In automation use tts.speak now.

I tried this in developer:

service: tts.google_say
data:
  cache: false
  entity_id: media_player.living_room_speaker
  message: may the force be with you

No go. No error message and nothing showing log file.

Thanks

I tried this too:

service: tts.cloud.say
data:
  entity_id: media_player.living_room_speaker
  message: may the force be with you

No go. No error message and nothing in log file.
When you say ‘what TTS services are available?’ - how do find out what is available?

Update: as it turn out, I do appear to have tts.cloud. But I cannot make it play on any of my speakers. When I try and play by clicking Call Service, sometimes I hear a chime but nothing else.
Note sure where to look fo where the disconnect is.

Thanks

When you say ‘I installed tts in/from Ui at devices’, could you elaborate a little?

Thanks

In the developer tools, open the services and look for the ones available to you.
Since I have the NabuCasa tts service, I tried sending a message to different players (GoogleHome, squeezelite-esp32, squeezelite(LMS server) and everything works without a problem.
Here is an example where I played a message on GoogleHome

service: tts.cloud_say
data:
  entity_id: media_player.living_room_display
  message: xxxxxxxxx

Update home assistant to latest version. 2023.7.1

Than go to settings-devices-and hit + button-search for Google tts-install this.

Now go to your config.yaml and delete your TTS config in here.

Because you gonna use the new (ui devices tts) you just installed)
Your automation is changed. So now it uses: call services - tts.speak. (Select you media.player) type the tekst you wanna hear.

And it works for me now. My old setting also did not work after home assistant update to 2023.7

1 Like

Ok, but how do I use tts speak and tts cloud NabuCasa?

@pepe59 as @realm said,

After this you should be able to use the Google tts service.
The tts cloud service is provided by nabu casa. If you don’t have that service then start with Google.

I just tried exactly that:

service: tts.cloud_say
data:
  entity_id: media_player.lounge_room_speaker
  message: May the force be with you

I hear a chime through the speaker but nothing else.

1 Like

I just tried that. I was already on 2023.7.1. I installed Google Translate text-to-speech. Blanked out this in config.yaml:

#  tts:
#    - platform: google_translate
#      cache: true
#      cache_dir: /tmp/tts
#      time_memory: 300
#      base_url: http://192.168.1.130:8123
#      service_name: google_say

Restarted Home Assistant.
The services available now are:
Text-to-speech (TTS): Clear TTS cache
Text-to-speech (TTS): Say a message with cloud
Text-to-speech (TTS): speak

Still no go for me.

I found this in the log file, not sure if it is relevant?

Logger: homeassistant.components.cast.media_player
Failed to cast media http://homeassistant.local:8123/api/tts_proxy/e46c151a848637835da24765e5e6c8a2881c9f37_en-au_e09b5a0968_cloud.audiooutput.mp3 from internal_url (http://homeassistant.local:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
  
Logger: homeassistant.helpers.service
Unable to find referenced entities media_player.living_room_speaker or it is/they are currently not available

I cannot for the life of me understand how I can make this work.
I would so grateful for any help.
Thanks in advance.

Same problem for me…
No “target” available

Yes! I get that too, no target available.
In a way, I am somewhat glad it is not just me that have the problem. More users with the same problem = more users likely to find a solution.

tts.speak:

Modern platforms will create entities under the tts domain, where each entity represents one text-to-speech service provider. These entities may be used as targets for the tts.speak service.

I am assuming that this tts.speak is a new addition as I have used TTS for a long time and never noticed this service before, but from the above documentation I also assume that moving forward any platform / integration is able to utilise this service and will as such create tts.entity’s that can then be selected as the target.

Therefore not having any target to select, simply means you don’t have any platforms that have created such entities as yet.

All original setup TTS’s should still function normally under their own service call for example “tts.cloud_say”

At least that is my understanding and have no idea if any current platforms are using this new tts.speak function as yet.

I installed the integration.
google tts
commented out in configuration.yaml

#tts:
#  - platform: google_translate

restarted HA.
a new entity has been created that can be selected as a target in the tts.speak service.
i sent the text to the player and it works