I use a motion sensor on my security system to trigger so that I know someone’s there to hear it. I set a boolean at times throughout the day to say “hey - there’s a message waiting”.
My code for valuing the “trash today/trash tomorrow” type bools is above.
I have the “message waiting” automation fire off several scripts. Each of the scripts has a condition to exit if it doesn’t apply. Then it turns off the “message waiting” bool.
I use a script to handle speech so that I can easily change TTS. I also include some booleans to make sure my wife and I are awake before speaking. I describe that in this thread:
automations:
- alias: Enable Trash Message Indicator
trigger:
- platform: time
at: '6:20'
- platform: time
at: '14:30'
- platform: time
at: '18:00'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.trash_message_waiting
- alias: Announce Trash on Motion if Message Indicator
trigger:
- platform: state
entity_id: binary_sensor.livingroom_motion
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.trash_message_waiting
state: 'on'
- condition: state
entity_id: sensor.everyone_awake
state: 'on'
action:
- service: script.announcetrashtoday
- service: script.announcetrashrecyclingtoday
- service: script.announcetrashtomorrow
- service: script.announcetrashrecyclingtomorrow
- service: homeassistant.turn_off
entity_id:
- input_boolean.trash_message_waiting
scripts:
announcetrashtoday:
alias: Announce if trash today
sequence:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.trash_day
state: 'on'
- condition: state
entity_id: input_boolean.recycle_day
state: 'off'
- service: script.speak
data_template:
message: "Today is trash day."
announcetrashtomorrow:
alias: Announce if trash tomorrow
sequence:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.trash_tomorrow
state: 'on'
- condition: state
entity_id: input_boolean.recycle_tomorrow
state: 'off'
- service: script.speak
data_template:
message: "Tomorrow is trash day."
announcetrashrecyclingtoday:
alias: Announce if trash and recycling today
sequence:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.trash_day
state: 'on'
- condition: state
entity_id: input_boolean.recycle_day
state: 'on'
- service: script.speak
data_template:
message: "Today is trash and recycling day."
announcetrashrecyclingtomorrow:
alias: Announce if trash and recycling tomorrow
sequence:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.trash_tomorrow
state: 'on'
- condition: state
entity_id: input_boolean.recycle_tomorrow
state: 'on'
- service: script.speak
data_template:
message: "Tomorrow is trash and recycling day."
speak:
alias: TTS Handler
sequence:
- condition: or
conditions:
- condition: template
value_template: "{{ unmute == 'true' }}"
- condition: and
conditions:
- condition: state
entity_id: input_boolean.me_awake
state: 'on'
- condition: state
entity_id: input_boolean.wife_awake
state: 'on'
- service: tts.google_say
entity_id: media_player.squeezelite
data_template:
message: "{{ message }}"