Google Cloud Platform SSML support - solved

any change we can get SSML support for Google Cloud Platform Text-to-Speech?


I managed to get it working by downloading google_cloud from git and placed it in custom_components and then changed the following line in

synthesis_input = texttospeech.types.SynthesisInput(text=message)


synthesis_input = texttospeech.types.SynthesisInput(ssml=message)

Now I can use SSML <speak> tags and if you don’t use SSML tags it works as normal.


thank you very much. It worked great. I just don’t understand why it is not officially supported by HA but Amazon polly is?

1 Like

Do you happend to have the link to that?

github main Home assistant rep. in the components folder.

here is the link

1 Like

Okay, this is helpful, but I want to clarify … Do I need to declare it somewhere in the configuration.yaml as a custom component now or does HA automatically know to reference the custom_component version over the built in if it exists?

No need, HA always runs custom_component first.

1 Like

This is great!! And indeed, why isn’t it implemented by default, its a 4 character change… :wink:

I have downloaded the google_cloud into the custom_components folder and made the necessary edits.

Will someone kindly provide an example of how to use it?

Thanks. Will try it out.

For clarification:

  1. Go to > click the green code button > Download Zip
  2. Unzip the file and copy the core/homeassistant/components/google_cloud folder into <ha_config_folder>/custom_components/google_cloud
  3. Open <ha_config_folder>/custom_components/google_cloud/ and replace the line:
    synthesis_input = texttospeech.types.SynthesisInput(text=message)
    synthesis_input = texttospeech.types.SynthesisInput(ssml=message)
  4. Reboot Home-assistant
  5. Test it out in Develper Tools > Services
service: tts.google_cloud_say
  entity_id: media_player.<your media player>
  message: <speak>hello</speak>
1 Like

Seems to be that 115.5 has broken the ssml. I’ve used it without problems till 115.0…