Tts.cloud_say

I’m having trouble getting tts.cloud_say to work. My media players are all Sonos units. Play will stop on the Sonos when the tts.cloud_say is executed, but no audio comes out. I tried the examples at https://www.nabucasa.com/config/tts/. I also tried setting up Sonos_Say script:

sonos_say:
  alias: "Sonos TTS script"
  sequence:
    - service: sonos.snapshot
      data:
        entity_id: "{{ sonos_entity }}"
    - service: sonos.unjoin
      data:
        entity_id: "{{ sonos_entity }}"
    - service: media_player.volume_set
      data:
        entity_id: "{{ sonos_entity }}"
        volume_level: "{{ volume }}"
    - service: tts.cloud_say
      data:
        entity_id: "{{ sonos_entity }}"
        message: "{{ message }}"
        language: en-US
        options:
          gender: female
    - delay: "{{ delay }}"
    - service: sonos.restore
      data:
        entity_id: "{{ sonos_entity }}"

In either case, whatever is playing on the Sonos stops, but no TTS is played. If I look at my Sonos player, there is an mp3 there, but I get the attached error if I try and play again. Feels like there is some kind of share I need to setup so the Sonos can access the files. Is there some doc?

Screen Shot 2020-10-27 at 7.49.23 PM

I had a similar problem with the google media players and .lan addresses because they aren’t using my local dns. Sonos probably can’t resolve bonjour addresses, so you’ll need to use your ip in internal_url instead of the .local hostname

According to the Nabu Casa doc, tts.cloud_say is supposed to be automatically configured. I tried adding tts base_url config to be my IP, but it didn’t seem to change the homeassistant.local in the url. I must have done something wrong, or cloud_say is configured elsewhere.

Turns out, it looks like Nabu Casa is using Google. I was using the wrong platform value.

tts: # Text to speech

With this update, everything worked.

1 Like

I am noticing this service is unable to spell correctly the unit_of_measurement option inside an automation… In italian it says only ‘c’ and not anymore ‘celsius’ like the google tts service.
How to fix this?

An update to this issue:

I don’t know if it was getting off the Nabu Casa trial onto the paid plan or if there was an update, but now tts.cloud_say works without any tts config in HA. Judging by the voice, I’m guessing Nabu Casa is using Amazon Polly — nice voices!

Same problem with cloud_say and Sonos speakers (I’m on the paid plan), in spite of the fanfare around 2021.2.0. Your addition to config.yaml fixed it, thanks!

Did you manage to solve it?

You have to put a delay in before your restore.

What is happening is that your restore call is firing before the TTS can process / play.

Yes, I know I’m reviving an old thread.

I was having a similar problem whereby the TTS service was not saying “minus” when temperatures were below zero. Also, if a temperature WAS zero, it would say “none”.

In my automation template I use the following:

{{n.temperature|int(0)|replace('-','minus')}}

You could use similar like

{{n.temperature|int(0)|replace('c','celcius')}}

Hope this helps you.