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'
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!
- 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