TTS broken in 0.117.4?

Is someone else experiencing random failure of TTS service?

I have this automation:

- alias: Notifica Temperatura Esterna
  trigger:
    platform: time
    at:
    - '09:45:00'
    - '12:45:00'
    - '15:45:00'
    - '18:45:00'
    - '21:45:00'
    - '23:45:00'
  condition:
  - condition: template
    value_template: "{% if is_state('media_player.home', 'playing') %} {% elif is_state('media_player.google_home',\
      \ 'playing') %} {% elif is_state('media_player.google_home_mini', 'playing')\
      \ %}\n  false\n{% else %}\n  true\n{% endif %}\n"
  action:
  - service: tts.google_translate_say
    entity_id: media_player.home
    data_template:
      message: Temperatura Esterna {{ states('sensor.temperature_158d0001b95f60')
        }} {{ state_attr('sensor.temperature_158d0001b95f60','unit_of_measurement')
        }}
  id: c6512c0f07be40f38651f38995759881

It was working perfectly before upgrading to 0.117.4.
Actually sometimes it fails and i don’t have the TTS notification on my media_player.home device.

Yes. Mine has been intermittent since yesterday. Getting these error msgs:

WARNING (MainThread) [homeassistant.components.google_translate.tts] Unable to find token seed! Did https://translate.google.com change?
ERROR (MainThread) [homeassistant.components.tts] Error on init TTS: No TTS from google_translate for 'Test message'

I am not having those errors, maybe because of my log level… can you tell me your log configuration?

A subset:

logger:
  default: warn
  logs:
    homeassistant.components.media_player: error

Others have posted issues too… HA 117: Unable to find token seed! Did https://translate.google.com change?

Perhaps unrelated to the Google TTS problem but your automation’s Template Condition is odd.

This is a formatted version of the condition:

{% if is_state('media_player.home', 'playing') %}
{% elif is_state('media_player.google_home', 'playing') %}
{% elif is_state('media_player.google_home_mini', 'playing') %}
  false
{% else %}
  true
{% endif %}

What do you want this Template Condition to do? Because here’s what I believe it does:

  • If either of the first two media players is playing, the template returns nothing.
  • Only if the first two media players are not playing, does the template check the third player and returns either false or true.

A Template Condition should always evaluate to either true or false and not nothing.

So the question remains, what do you want this Template Condition to do?


EDIT

You can experiment with the template’s behavior by pasting this into the Template Editor:

{% set a = 'playing' %}
{% set b = 'paused' %}
{% set c = 'playing' %}

{% if a == 'playing' %}
{% elif b == 'playing' %}
{% elif c == 'playing' %}
  false
{% else %}
  true
{% endif %}

As you can see, there’s no result if the either of the first two variables are ‘playing’.
Screenshot from 2020-11-06 13-52-14

Only when the first two are not ‘playing’ does the template reach the third test and produce a value of false.
Screenshot from 2020-11-06 13-52-38

Hmmm… i have this automation since the beginnings of my experience with HA and never had problems with it till my upgrade to the latest HA release.

I want the automation runs only if all media_players listed in the template are not already playing something.

And this is what i get when i try the template in the template editor:

Is it correct or not?
EDIT: I understand now what you mean, so how to have that template doing what i am trying to have?

See also this issue

1 Like

Like this:

  condition:
  - condition: template
    value_template: >
      {{ [ states.media_player.home,
           states.media_player.google_home,
           states.media_player.google_home_mini ]
         | selectattr('state', 'eq', 'playing')
         | list | count == 0 }}

It selects and counts how many media_players are playing and compares it to 0. If none are playing, the template evaluates to true, otherwise it reports false.

1 Like

Thanks, I’ll never finish to learn about templates…

FWIW, I moved on to google_cloud tts and couldn’t be happier.

Isn’t that a paid service?

The basic voice is free with a limit of 4 million characters per month. The WaveNet version is free with a limit of 1 million per month. After that it’s €/$4 (basic) and $/€16 per month per million characters (WaveNet).

I might try this. I have no idea how many characters I would use but I’d imagine you can keep track. This is what counts as a charachter according yo Google:

The number of characters will be equal to or less than the number of bytes represented by the text. This includes alphanumeric characters, punctuation, and white spaces. Some character sets use more than one byte for a character. For example, Japanese (ja-JP) characters in UTF-8 typically require more than one byte each. In this case, you are only charged for one character, not multiple bytes.

The WaveNet version (which I would choose) gives 33.000 characters each day on average. This following sentence contains 80 characters:

Good morning, it is time to wake up. Currently it’s 17 degrees and it’s raining.

I think for a regular household when using a few automations each day with Google Cloud TTS you won’t reach the monthly limit.

Please correct me if I’m wrong @D34DC3N73R :slight_smile:

I have this problem too after upgrade to 0.117.3

[homeassistant.components.google_translate.tts] Unable to find token seed! Did https://translate.google.com change?

Same problem here!

Does this service get called each time TTS is triggered/called or is the speech cached (into a mp3 or something) like the google_translate TTS?

I also have this problem, sometimes the TTS works fine and sometimes it doesn’t. Haven’t changed anything other than upgrading HA. Has worked perfectly since I set it up 6 months ago.

No idea, I’m interested in Cloud TTS, not using it myself.

Edit: I don’t think it supports it. The page does not list the cache option, while the regular TTS does.

1 Like

Yes, that’s correct afaik. I’m using the 0-4 million standard voice, and I’ve never been charged. When I check quotas for the project it just states “No data is available for the selected time frame.” so I’m not exactly sure how many characters I’m using but I would guess I’m way under the limit. I have the following tts automations: front doorbell motion on 3 google home devices (we get multiple packages daily), random greetings for each person upon returning home, and I script I call to yell at my cat when it’s on the kitchen counter.

1 Like