Google Home TTS Automation

I’m trying to do a basic TTS automation for my google home. Basically, when the clock turns to a certain time I want the google home to say something to me. Can’t figure out what’s wrong, I’m really new at this so any help would be greatly appreciated. Here’s my code.

    automation:
      trigger:
        platform: time
        at: '18:00'
      action:
        service: tts.google_say
        entity_id: media_player.kitchen_speaker
        data:
          message: 'Hello Good Morning'

Have you tried manually sending a tts to that media player from the card in the UI?

I think the time has to be ‘18:00:00’.

Thanks for the response. I’ve tried manually sending a tts and it works fine. I’ve also tried the 18:00:00 format as well. Still nothing.

Any errors in the log?

Try Changing data to data_template.

    - service: tts.google_say
      entity_id: media_player.kitchen_speaker
      data_template:
         message: "Hello Good Morning"

Ok I got it working. Thanks for all your help. It was a rookie mistake, I put it in the configuration file but also had the text automation: !include automations.yaml in there as well. You guys are awesome!

This data_template is not working in google tts service. Can someone help?

{
“data_template”: {
“message”: “Garage Door is {{states(‘cover.garage’)}}”
},
“entity_id”: “media_player.living_room_speaker”
}

{
“entity_id”: “media_player.living_room_speaker”,
“message”: “Garage Door is {{states(‘cover.garage’)}}”
}

try this

Also, if you put {{states(‘cover.garage’)}} in the script editor, does it put out the correct state?

Hi Try this.

- service: tts.google_say
  entity_id: media_player.living_room_speaker
  data_template:
     message: "Garage Door is {{ states('cover.garage') }}"
     cache: false
1 Like

That worked. Thanks.

anybody know what could be wrong with this?

- id: family_greeting
  alias: Family Greeting
  trigger:
    platform: state
    entity_id:
      - binary_sensor.cameron_home
      - binary_sensor.corey_home
      - binary_sensor.courtney_home
      - binary_sensor.mom_home
      - binary_sensor.morgan_home
      - binary_sensor.wendy_home
    from: 'off'
    to: 'on'
    for: '00:00:05'
  action:

  - service: tts.google_say
    entity_id: media_player.fire_speaker
    data_template:
      person: >
        {{ trigger.to_state.name }}
          {%- for s in states.binary_sensor
                |rejectattr('entity_id','eq',trigger.entity_id)
                |selectattr('state','eq','on')
                if '_home' in s.entity_id and
                   (now() - s.last_changed).total_seconds() < 60 -%}
            {{ (' and ' if loop.last else ', ') ~ s.name }}
          {%- endfor %}
        speech_message: >
          {{ ["Welcome back home PERSON",
              "Guess who is home. PERSON is!",
              "PERSON is now in the house.",
              "Welcome Home PERSON.  We have missed you. Or at least I did.",
              "Our home is now complete, Rest your head and relax your feet, Welcome Back PERSON",
              "Life is like a song, you’re back where you belong, Welcome home PERSON",
              "Hey there PERSON Welcome Home!",
              "Knock Knock. Who is There? PERSON is!",
              "PERSON, you are home!",
              "I know a secret. PERSON is home!"
             ] | random }}

018-07-28 20:38:25 ERROR (MainThread) [homeassistant.core] Invalid service data for tts.google_say: extra keys not allowed @ data[‘person’]. Got ‘Wendy Home, Corey Home and Courtney Home\nspeech_message: >\n Welcome back home PERSON’
required key not provided @ data[‘message’]. Got None

Hi!
I am trying to setup an automation with the following functionality:

  • triggered by a webhook
    ? Can I pass a the text to tts inside the webhook?
    ? Can I pass the names of google homes to cast to inside the webhook?

  • action - cast TTS to multiple google homes
    ? should I use ‘Call service’? which service?
    ? How to pass the parameters from the trigger to the service?

Sorry for this complete newby questions, but I really need help here…
Ros

Corey, did you ever perfect this?