Only send TTS notifications for my meds if I'm actually home

This commit is contained in:
2024-09-20 20:11:25 -04:00
parent 35e5891f5e
commit ed71c557df

View File

@ -1647,19 +1647,19 @@ tony_morning_meds:
icon: mdi:medication icon: mdi:medication
mode: restart mode: restart
sequence: sequence:
- service: counter.increment - metadata: {}
metadata: {}
data: {} data: {}
target: target:
entity_id: counter.tony_morning_meds_reminder_count entity_id: counter.tony_morning_meds_reminder_count
alias: Increment morning reminder counter alias: Increment morning reminder counter
- service: script.text_notify action: counter.increment
data: - data:
type: alert type: alert
who: tony who: tony
message: clear_notification message: clear_notification
tag: tony-morning-meds tag: tony-morning-meds
alias: Clear previous morning notification alias: Clear previous morning notification
action: script.text_notify
- delay: - delay:
hours: 0 hours: 0
minutes: 0 minutes: 0
@ -1668,7 +1668,6 @@ tony_morning_meds:
- alias: Send morning notifications via text, and TTS if needed - alias: Send morning notifications via text, and TTS if needed
parallel: parallel:
- alias: Send text notification - alias: Send text notification
service: script.text_notify
data: data:
who: tony who: tony
type: alert type: alert
@ -1680,20 +1679,28 @@ tony_morning_meds:
title: Taken title: Taken
- action: TONY_MORNING_MEDS_SKIPPED - action: TONY_MORNING_MEDS_SKIPPED
title: Skip title: Skip
- alias: Send TTS if reminders > 2 action: script.text_notify
- alias: Send TTS if reminders > 2 and Tony is home
if: if:
- alias: If reminders > 2 and Tony is home
condition: and
conditions:
- condition: numeric_state - condition: numeric_state
entity_id: counter.tony_morning_meds_reminder_count entity_id: counter.tony_morning_meds_reminder_count
above: 2 above: 2
alias: When reminder count > 2 alias: When reminder count > 2
- condition: state
entity_id: person.tony_stork
state: home
alias: If Tony is home
then: then:
- service: script.speech_engine - data:
data:
who: common_areas who: common_areas
type: alert type: alert
message: Tony, you need to take your morning meds. This is reminder number message: Tony, you need to take your morning meds. This is reminder number
{{ states('counter.tony_morning_meds_reminder_count') }} for today. {{ states('counter.tony_morning_meds_reminder_count') }} for today.
alias: Send TTS notification alias: Send TTS notification
action: script.speech_engine
tony_night_meds: tony_night_meds:
alias: Tony Night Meds alias: Tony Night Meds
icon: mdi:medication icon: mdi:medication
@ -1881,19 +1888,19 @@ tony_afternoon_meds:
icon: mdi:medication icon: mdi:medication
mode: restart mode: restart
sequence: sequence:
- service: counter.increment - metadata: {}
metadata: {}
data: {} data: {}
target: target:
entity_id: counter.tony_afternoon_meds_reminder_count entity_id: counter.tony_afternoon_meds_reminder_count
alias: Increment afternoon reminder counter alias: Increment afternoon reminder counter
- service: script.text_notify action: counter.increment
data: - data:
type: alert type: alert
who: tony who: tony
message: clear_notification message: clear_notification
tag: tony-afternoon-meds tag: tony-afternoon-meds
alias: Clear previous afternoon notification alias: Clear previous afternoon notification
action: script.text_notify
- delay: - delay:
hours: 0 hours: 0
minutes: 0 minutes: 0
@ -1902,7 +1909,6 @@ tony_afternoon_meds:
- alias: Send afternoon notifications via text, and TTS if needed - alias: Send afternoon notifications via text, and TTS if needed
parallel: parallel:
- alias: Send text notification - alias: Send text notification
service: script.text_notify
data: data:
who: tony who: tony
type: alert type: alert
@ -1914,20 +1920,28 @@ tony_afternoon_meds:
title: Taken title: Taken
- action: TONY_AFTERNOON_MEDS_SKIPPED - action: TONY_AFTERNOON_MEDS_SKIPPED
title: Skip title: Skip
- alias: Send TTS if reminders > 2 action: script.text_notify
- alias: Send TTS if reminders > 2 and Tony is home
if: if:
- alias: When reminders > 2 and Tony is home
condition: and
conditions:
- condition: numeric_state - condition: numeric_state
entity_id: counter.tony_afternoon_meds_reminder_count entity_id: counter.tony_afternoon_meds_reminder_count
above: 2 above: 2
alias: When reminder count > 2 alias: When reminder count > 2
- condition: state
entity_id: person.tony_stork
state: home
alias: If Tony is home
then: then:
- service: script.speech_engine - data:
data:
who: common_areas who: common_areas
type: alert type: alert
message: Tony, you need to take your afternoon meds. This is reminder number message: Tony, you need to take your afternoon meds. This is reminder number
{{ states('counter.tony_afternoon_meds_reminder_count') }} for today. {{ states('counter.tony_afternoon_meds_reminder_count') }} for today.
alias: Send TTS notification alias: Send TTS notification
action: script.speech_engine
tony_ibuprofen: tony_ibuprofen:
alias: Tony Ibuprofen alias: Tony Ibuprofen
sequence: sequence:
@ -2700,15 +2714,14 @@ rabbit_hutch_cleaning:
entity_id: counter.rabbit_hutch_cleaning_reminder_count entity_id: counter.rabbit_hutch_cleaning_reminder_count
above: 2 above: 2
then: then:
- service: script.speech_engine - data:
data: who: living_room
who: common_areas
type: normal type: normal
message: The rabbit hutch is in need of cleaning. This is reminder number message: The rabbit hutch is in need of cleaning. This is reminder number
{{ states('counter.rabbit_hutch_cleaning_reminder_count') }} for today. {{ states('counter.rabbit_hutch_cleaning_reminder_count') }} for today.
alias: Play TTS announcement alias: Play TTS announcement
action: script.speech_engine
- alias: Send phone notifications - alias: Send phone notifications
service: script.text_notify
metadata: {} metadata: {}
data: data:
type: alert type: alert
@ -2724,6 +2737,7 @@ rabbit_hutch_cleaning:
title: Skip title: Skip
- action: RABBIT_HUTCH_CLEANING_ASK_LATER - action: RABBIT_HUTCH_CLEANING_ASK_LATER
title: Ask Later title: Ask Later
action: script.text_notify
- alias: Triggers - alias: Triggers
wait_for_trigger: wait_for_trigger:
- alias: Done - alias: Done
@ -2764,18 +2778,17 @@ rabbit_hutch_cleaning:
alias: Cleaning done alias: Cleaning done
sequence: sequence:
- alias: Turn on input boolean - alias: Turn on input boolean
service: input_boolean.turn_on
metadata: {} metadata: {}
data: {} data: {}
target: target:
entity_id: input_boolean.rabbit_hutch_cleaned entity_id: input_boolean.rabbit_hutch_cleaned
action: input_boolean.turn_on
- conditions: - conditions:
- condition: template - condition: template
value_template: '{{ wait.trigger.id == ''ask-later'' }}' value_template: '{{ wait.trigger.id == ''ask-later'' }}'
alias: Ask later alias: Ask later
sequence: sequence:
- service: input_datetime.set_datetime - data:
data:
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(1) datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(1)
}} }}
@ -2783,14 +2796,14 @@ rabbit_hutch_cleaning:
target: target:
entity_id: input_datetime.rabbit_hutch_cleaning_notify entity_id: input_datetime.rabbit_hutch_cleaning_notify
alias: Bump cleaning notification by an hour alias: Bump cleaning notification by an hour
action: input_datetime.set_datetime
- conditions: - conditions:
- condition: template - condition: template
value_template: '{{ wait.trigger == ''none'' or wait.trigger.idx is undefined value_template: '{{ wait.trigger == ''none'' or wait.trigger.idx is undefined
}}' }}'
alias: None or undefined alias: None or undefined
sequence: sequence:
- service: input_datetime.set_datetime - target:
target:
entity_id: input_datetime.rabbit_hutch_cleaning_notify entity_id: input_datetime.rabbit_hutch_cleaning_notify
data: data:
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1) datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1)
@ -2798,14 +2811,15 @@ rabbit_hutch_cleaning:
' '
alias: Notify again alias: Notify again
action: input_datetime.set_datetime
- alias: Clear notification - alias: Clear notification
service: script.text_notify
metadata: {} metadata: {}
data: data:
type: alert type: alert
who: parents who: parents
message: clear_notification message: clear_notification
tag: rabbit-hutch-cleaning tag: rabbit-hutch-cleaning
action: script.text_notify
mode: restart mode: restart
icon: mdi:rabbit icon: mdi:rabbit
emma_sleep: emma_sleep: