Hi all. I’m trying to create a single automation that will send TTS messages to my living room Google Home based on multiple time triggers. I’d like to have HA fire TTS messages to my Google Home speaker based on 6 times Mon-Fri. I have the “service: tts.google_say” messages for each timeslot, I just don’t know how to set it up so they send based on the time sensor. I assume this would be a nested IFTTT, but I’m unsure of the proper formatting.
Time trigger:
https://www.home-assistant.io/docs/automation/trigger/#time-trigger
Give your time triggers ids. e.g.
automation:
- trigger:
- platform: time
at: "15:00:00"
id: "3pm"
Then use the choose action to determine which action to perform:
https://www.home-assistant.io/docs/scripts#choose-a-group-of-actions
Use the following condition to determine which choice:
https://www.home-assistant.io/docs/scripts/conditions/#trigger-condition
e.g.
condition:
condition: trigger
id: "3pm"
Thanks, @tom_l. I read through the documentation for each link, and I understand the flow; I’m just sort of lost on the formatting and where to place the service:, data:, and message: code. Apologies, I’m an engineer by trade and mindset, and not a developer. lol.
Here is what I have so far. Does this look correct?
automation:
trigger:
- platform: time
at: "19:15:00"
id: "7:15pm"
entity_id:
- media_player.living_room_speaker
- media_player.girls_room_speaker
- media_player.bedroom_display
- platform: time
at: "19:20:00"
id: "7:20pm"
entity_id:
- media_player.living_room_speaker
- media_player.girls_room_speaker
- media_player.bedroom_display
- platform: time
at: "19:40:00"
id: "7:40pm"
entity_id:
- media_player.living_room_speaker
- media_player.girls_room_speaker
- media_player.bedroom_display
- platform: time
at: "20:00:00"
id: "8:00pm"
entity_id:
- media_player.living_room_speaker
- media_player.girls_room_speaker
- media_player.bedroom_display
- platform: time
at: "20:30:00"
id: "8:30pm"
entity_id:
- media_player.living_room_speaker
- media_player.girls_room_speaker
- media_player.bedroom_display
- platform: time
at: "20:45:00"
id: "8:45pm"
entity_id:
- media_player.living_room_speaker
- media_player.girls_room_speaker
- media_player.bedroom_display
No, the time trigger does not have an entity_id option. Only at:
and id:
options. Specifying your media players will be done in the choose actions.
automation:
trigger:
- platform: time
at: "19:15:00"
id: "7:15pm"
- platform: time
at: "19:20:00"
id: "7:20pm"
- platform: time
at: "19:40:00"
id: "7:40pm"
- platform: time
at: "20:00:00"
id: "8:00pm"
- platform: time
at: "20:30:00"
id: "8:30pm"
- platform: time
at: "20:45:00"
id: "8:45pm"
So how would you use the choose action in this circumstance?
action:
- choose:
- conditions:
- condition: trigger
id: "7:15pm"
sequence:
- service: <what you want to do at 7:15 here>
- conditions:
- condition: trigger
id: "7:20pm"
sequence:
- service: <what you want to do at 7:20 here>
- conditions:
- condition: trigger
id: "7:40pm"
sequence:
- service: <what you want to do at 7:40 here>
...etc
Ok, now this makes sense to me. Thank you!
Let me config and test, and see what happens.
After fixing all the tab indentations on all the lines, all the code is registering ok with the exception of one line.
for -id, I get “property automation is not allowed”
Delete the line that says automation:
Where is this?
In your automation.yaml file?
This is in my automation.yaml file, yes.
Then delete that line.