Call Google Home's "text to speak" service from a button card

I don’t find any media_player.speak_text service in the dropdown list.

tts.google_say

It says:

Failed to call service tts/google_say. Service not found.

For clarity, I want to use this:

from a separate card, with a hard-coded text.

In configuration.yaml:

tts:
  - platform: google_translate

In automation.yaml

service: tts.google_translate_say
entity_id: media_player.floor
data:
  message: 'May the Force be with you.'
2 Likes

But I don’t want to use Google Translate, I want to use my Google Home’s TTS.

Exactly, in the configuration.yaml enable tts.
And magic will happen :slight_smile:

tts:
  - platform: google_translate_say

Yep
But in mine I have

tts:
  - platform: google_translate
    service_name: google_say

so tts.google_say is a valid service call on my system. :grinning:

tts:
  - platform: google_translate_say

I want to use it in a card, not automation. So I tried adding this but if fails with:

Failed to call service tts/google_translate_say. extra keys not allowed @ data[‘data’]

It can’t find a google_translate_say integration. Should I install it somehow?

I finally achieved it using:

entity: media_player.office_speaker
hold_action:
  action: none
show_icon: true
show_name: true
tap_action:
  action: call-service
  service: tts.google_translate_say
  service_data:
    entity_id: media_player.office_speaker
    message: My message
type: entity-button

Though by pure guess, as no example in that linked page doesn’t contain the data key, so I think that it should be updated.

3 Likes

Thank you so much! I was looking for exactly the same solution. You’ve got me one step further.
Maybe you can help with my next step? I want to build a card where a text line can be typed, and TTS will send it to the speaker upon a press of a button.
I have this in my configuration.yaml;

input_text:
  tts_syntesiser:
    name: TTS2Google

Then I have this card in Lovelace:

type: entities
entities:
  - entity: input_text.tts_syntesiser

In another card (like yours), I want to say the text from the ‘input’:

entity: media_player.living_room_speaker
show_icon: true
show_name: true
tap_action:
  action: call-service
  service: tts.google_say
  service_data:
    entity_id: media_player.living_room_speaker
    message:"{{ states('input_text.tts_syntesiser') }}"
type: entity-button

But of course - all it does is to read out the name of the enitity, and not its value (state).
I have checked the value (state) of this entity in the states tab, and it shows the correct string typed into the text box. So I guess my logic is right, but my syntax is wrong.
Can anyone help?

Remove the ’ ’

Nope - that doesn’t help. I still get this error message:

voluptuous.error. MultipleInvalid: extra keys not allowed @ data['data_template']

seems u using data: instead of message:

Thank you for your suggestion.
I did eventually solve the issue, but I forgot to post the result.So, here it is;

entities:
  - entity: input_text.tts_syntesiser
  - entity: media_player.living_room_speaker
type: entities

The resulting card looks like this:

How did you get it to work?
I’ve a card in lovelace:

type: entities
entities:
  - entity: input_text.tts_syntesiser
  - entity: media_player.googlehome8966

But I can’t fill in anything:
tts

In my configuration.yaml:

input_text:
  tts_syntesiser:
    name: TTS2Google

What I’m missing?
Thanks.

I’m not sure. This is my configuration.yaml

# Text to speech
tts:
  - platform: google_translate
    service_name: google_say

#This is to synthesise TTS for the Google Home Mini
input_text:
  tts_syntesiser:
    name: TTS-til-Google
    

Does this still work in 2021?
I can do TTS in Node red… (Service name default: tts.google_translate_say
But I can NOT get the card working?
Thanks for your help and time much appriciated

Yes, it works just fine. I never made any changes.