402
scripts.yaml
402
scripts.yaml
@ -1647,19 +1647,22 @@ tony_morning_meds:
|
||||
icon: mdi:medication
|
||||
mode: restart
|
||||
sequence:
|
||||
- parallel:
|
||||
- if:
|
||||
- condition: numeric_state
|
||||
entity_id: counter.tony_morning_meds_reminder_count
|
||||
above: 2
|
||||
then:
|
||||
- service: script.speech_engine
|
||||
data:
|
||||
who: common_areas
|
||||
type: alert
|
||||
message: Tony, you need to take your morning meds. This is reminder number
|
||||
{{ states('counter.tony_morning_meds_reminder_count') }} for today.
|
||||
- service: script.text_notify
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: tony
|
||||
message: clear_notification
|
||||
tag: tony-morning-meds
|
||||
alias: Clear previous morning notification
|
||||
- delay:
|
||||
hours: 0
|
||||
minutes: 0
|
||||
seconds: 5
|
||||
milliseconds: 0
|
||||
- alias: Send morning notifications via text, and TTS if needed
|
||||
parallel:
|
||||
- alias: Send text notification
|
||||
service: script.text_notify
|
||||
data:
|
||||
who: tony
|
||||
type: alert
|
||||
@ -1671,191 +1674,78 @@ tony_morning_meds:
|
||||
title: Taken
|
||||
- action: TONY_MORNING_MEDS_SKIPPED
|
||||
title: Skip
|
||||
- action: TONY_MORNING_MEDS_ASK_LATER
|
||||
title: Ask Later
|
||||
- wait_for_trigger:
|
||||
- platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TONY_MORNING_MEDS_TAKEN
|
||||
id: taken
|
||||
alias: Taken
|
||||
- platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TONY_MORNING_MEDS_SKIPPED
|
||||
id: skipped
|
||||
alias: Skipped
|
||||
- platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TONY_MORNING_MEDS_ASK_LATER
|
||||
id: ask-later
|
||||
alias: Ask Later
|
||||
- platform: state
|
||||
entity_id: person.tony_stork
|
||||
from: home
|
||||
id: left
|
||||
alias: Left
|
||||
- platform: state
|
||||
entity_id: input_boolean.tony_morning_meds_taken
|
||||
to: 'on'
|
||||
id: manual
|
||||
alias: Manual
|
||||
timeout: 00:30:00
|
||||
continue_on_timeout: true
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger.id in [''taken'',''manual''] }}'
|
||||
alias: Taken, Manual
|
||||
sequence:
|
||||
- service: input_boolean.turn_on
|
||||
target:
|
||||
entity_id: input_boolean.tony_morning_meds_taken
|
||||
data: {}
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger.id == ''ask-later'' }}'
|
||||
alias: Ask Later
|
||||
sequence:
|
||||
- service: input_datetime.set_datetime
|
||||
target:
|
||||
entity_id: input_datetime.tony_morning_meds_notify
|
||||
- alias: Send TTS if reminders > 2
|
||||
if:
|
||||
- condition: numeric_state
|
||||
entity_id: counter.tony_morning_meds_reminder_count
|
||||
above: 2
|
||||
alias: When reminder count > 2
|
||||
then:
|
||||
- service: script.speech_engine
|
||||
data:
|
||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,30)
|
||||
}}
|
||||
|
||||
'
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger.id == ''left'' }}'
|
||||
alias: Left
|
||||
sequence:
|
||||
- service: script.text_notify
|
||||
data:
|
||||
who: tony
|
||||
type: critical
|
||||
title: HEY DUMBASS
|
||||
message: YOU FORGOT TO TAKE YOUR MORNING MEDS!!!!!
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger == ''none'' or wait.trigger.idx is undefined
|
||||
}}'
|
||||
alias: None or undefined
|
||||
sequence:
|
||||
- service: input_datetime.set_datetime
|
||||
target:
|
||||
entity_id: input_datetime.tony_morning_meds_notify
|
||||
data:
|
||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1)
|
||||
}}
|
||||
|
||||
'
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: tony
|
||||
message: clear_notification
|
||||
tag: tony-morning-meds
|
||||
who: common_areas
|
||||
type: alert
|
||||
message: Tony, you need to take your morning meds. This is reminder number
|
||||
{{ states('counter.tony_morning_meds_reminder_count') }} for today.
|
||||
alias: Send TTS notification
|
||||
- service: counter.increment
|
||||
metadata: {}
|
||||
data: {}
|
||||
target:
|
||||
entity_id: counter.tony_morning_meds_reminder_count
|
||||
alias: Increment morning reminder counter
|
||||
tony_night_meds:
|
||||
alias: Tony Night Meds
|
||||
icon: mdi:medication
|
||||
mode: restart
|
||||
sequence:
|
||||
- service: script.text_notify
|
||||
data:
|
||||
who: tony
|
||||
type: alert
|
||||
title: Night Meds
|
||||
message: You need to take your night meds
|
||||
tag: tony-night-meds
|
||||
actions:
|
||||
- action: TONY_NIGHT_MEDS_TAKEN
|
||||
title: Taken
|
||||
- action: TONY_NIGHT_MEDS_SKIPPED
|
||||
title: Skip
|
||||
- action: TONY_NIGHT_MEDS_ASK_LATER
|
||||
title: Ask Later
|
||||
- wait_for_trigger:
|
||||
- platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TONY_NIGHT_MEDS_TAKEN
|
||||
id: taken
|
||||
alias: Taken
|
||||
- platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TONY_NIGHT_MEDS_SKIPPED
|
||||
id: skipped
|
||||
alias: Skipped
|
||||
- platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TONY_NIGHT_MEDS_ASK_LATER
|
||||
id: ask-later
|
||||
alias: Ask Later
|
||||
- platform: state
|
||||
entity_id: input_boolean.tony_night_meds_taken
|
||||
to: 'on'
|
||||
id: manual
|
||||
alias: Manual
|
||||
timeout: 00:30:00
|
||||
continue_on_timeout: true
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger.id in [''taken'',''manual''] }}'
|
||||
alias: Taken, Manual
|
||||
sequence:
|
||||
- service: input_boolean.turn_on
|
||||
target:
|
||||
entity_id: input_boolean.tony_night_meds_taken
|
||||
data: {}
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger.id == ''ask-later'' }}'
|
||||
alias: Ask Later
|
||||
sequence:
|
||||
- service: input_datetime.set_datetime
|
||||
target:
|
||||
entity_id: input_datetime.tony_night_meds_notify
|
||||
data:
|
||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,30)
|
||||
}}
|
||||
|
||||
'
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger == ''none'' or wait.trigger.idx is undefined
|
||||
}}'
|
||||
alias: None or undefined
|
||||
sequence:
|
||||
- if:
|
||||
- condition: and
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: person.tony_stork
|
||||
state: home
|
||||
- condition: state
|
||||
entity_id: binary_sensor.morning
|
||||
state: 'off'
|
||||
then:
|
||||
- service: input_datetime.set_datetime
|
||||
target:
|
||||
entity_id: input_datetime.tony_night_meds_notify
|
||||
data:
|
||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1)
|
||||
}}
|
||||
|
||||
'
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: tony
|
||||
message: clear_notification
|
||||
tag: tony-night-meds
|
||||
alias: Clear previous night notification
|
||||
- delay:
|
||||
hours: 0
|
||||
minutes: 0
|
||||
seconds: 5
|
||||
milliseconds: 0
|
||||
- alias: Send night notifications via text, and TTS if needed
|
||||
parallel:
|
||||
- alias: Send text notification
|
||||
service: script.text_notify
|
||||
data:
|
||||
who: tony
|
||||
type: alert
|
||||
title: Night Meds
|
||||
message: You need to take your night meds
|
||||
tag: tony-night-meds
|
||||
actions:
|
||||
- action: TONY_NIGHT_MEDS_TAKEN
|
||||
title: Taken
|
||||
- action: TONY_NIGHT_MEDS_SKIPPED
|
||||
title: Skip
|
||||
- alias: Send TTS if reminders > 2
|
||||
if:
|
||||
- condition: numeric_state
|
||||
entity_id: counter.tony_night_meds_reminder_count
|
||||
above: 2
|
||||
alias: When reminder count > 2
|
||||
then:
|
||||
- service: script.speech_engine
|
||||
data:
|
||||
who: common_areas
|
||||
type: alert
|
||||
message: Tony, you need to take your night meds. This is reminder number
|
||||
{{ states('counter.tony_night_meds_reminder_count') }} for today.
|
||||
alias: Send TTS notification
|
||||
- service: counter.increment
|
||||
metadata: {}
|
||||
data: {}
|
||||
target:
|
||||
entity_id: counter.tony_night_meds_reminder_count
|
||||
alias: Increment night reminder counter
|
||||
tony_stream_today:
|
||||
alias: Tony Stream Today
|
||||
sequence:
|
||||
@ -2004,20 +1894,25 @@ tony_custom_meds:
|
||||
mode: parallel
|
||||
tony_afternoon_meds:
|
||||
alias: Tony Afternoon Meds
|
||||
icon: mdi:medication
|
||||
mode: restart
|
||||
sequence:
|
||||
- parallel:
|
||||
- if:
|
||||
- condition: numeric_state
|
||||
entity_id: counter.tony_afternoon_meds_reminder_count
|
||||
above: 2
|
||||
then:
|
||||
- service: script.speech_engine
|
||||
data:
|
||||
who: common_areas
|
||||
type: alert
|
||||
message: Tony, you need to take your afternoon meds. This is reminder number
|
||||
{{ states('counter.tony_afternoon_meds_reminder_count') }} for today.
|
||||
- service: script.text_notify
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: tony
|
||||
message: clear_notification
|
||||
tag: tony-afternoon-meds
|
||||
alias: Clear previous afternoon notification
|
||||
- delay:
|
||||
hours: 0
|
||||
minutes: 0
|
||||
seconds: 5
|
||||
milliseconds: 0
|
||||
- alias: Send afternoon notifications via text, and TTS if needed
|
||||
parallel:
|
||||
- alias: Send text notification
|
||||
service: script.text_notify
|
||||
data:
|
||||
who: tony
|
||||
type: alert
|
||||
@ -2029,97 +1924,26 @@ tony_afternoon_meds:
|
||||
title: Taken
|
||||
- action: TONY_AFTERNOON_MEDS_SKIPPED
|
||||
title: Skip
|
||||
- action: TONY_AFTERNOON_MEDS_ASK_LATER
|
||||
title: Ask Later
|
||||
- wait_for_trigger:
|
||||
- alias: Taken
|
||||
platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TONY_AFTERNOON_MEDS_TAKEN
|
||||
id: taken
|
||||
- alias: Skipped
|
||||
platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TONY_AFTERNOON_MEDS_SKIPPED
|
||||
id: skipped
|
||||
- alias: Ask Later
|
||||
platform: event
|
||||
event_type: ios.notification_action_fired
|
||||
event_data:
|
||||
actionName: TONY_AFTERNOON_MEDS_ASK_LATER
|
||||
id: ask-later
|
||||
- platform: state
|
||||
entity_id: person.tony_stork
|
||||
from: home
|
||||
id: left
|
||||
alias: Left
|
||||
- alias: Manual
|
||||
platform: state
|
||||
entity_id:
|
||||
- input_boolean.tony_afternoon_meds_taken
|
||||
to: 'on'
|
||||
id: manual
|
||||
from: 'off'
|
||||
timeout: 00:30:00
|
||||
continue_on_timeout: true
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger.id in [''taken'',''manual''] }}'
|
||||
alias: Taken, Manual
|
||||
sequence:
|
||||
- service: input_boolean.turn_on
|
||||
data: {}
|
||||
target:
|
||||
entity_id: input_boolean.tony_afternoon_meds_taken
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger.id == ''ask-later'' }}'
|
||||
alias: Ask Later
|
||||
sequence:
|
||||
- service: input_datetime.set_datetime
|
||||
target:
|
||||
entity_id: input_datetime.tony_afternoon_meds_notify
|
||||
- alias: Send TTS if reminders > 2
|
||||
if:
|
||||
- condition: numeric_state
|
||||
entity_id: counter.tony_afternoon_meds_reminder_count
|
||||
above: 2
|
||||
alias: When reminder count > 2
|
||||
then:
|
||||
- service: script.speech_engine
|
||||
data:
|
||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,30)
|
||||
}}
|
||||
|
||||
'
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger.id == ''left'' }}'
|
||||
alias: Left
|
||||
sequence:
|
||||
- service: script.text_notify
|
||||
data:
|
||||
who: tony
|
||||
type: critical
|
||||
title: HEY DUMBASS
|
||||
message: YOU FORGOT TO TAKE YOUR AFTERNOON MEDS!!!!!
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: '{{ wait.trigger == ''none'' or wait.trigger.idx is undefined
|
||||
}}'
|
||||
alias: None or undefined
|
||||
sequence:
|
||||
- service: input_datetime.set_datetime
|
||||
target:
|
||||
entity_id: input_datetime.tony_afternoon_meds_notify
|
||||
data:
|
||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1)
|
||||
}}
|
||||
|
||||
'
|
||||
- service: script.text_notify
|
||||
data:
|
||||
type: alert
|
||||
who: tony
|
||||
message: clear_notification
|
||||
tag: tony-afternoon-meds
|
||||
icon: mdi:medication
|
||||
mode: restart
|
||||
who: common_areas
|
||||
type: alert
|
||||
message: Tony, you need to take your afternoon meds. This is reminder number
|
||||
{{ states('counter.tony_afternoon_meds_reminder_count') }} for today.
|
||||
alias: Send TTS notification
|
||||
- service: counter.increment
|
||||
metadata: {}
|
||||
data: {}
|
||||
target:
|
||||
entity_id: counter.tony_afternoon_meds_reminder_count
|
||||
alias: Increment afternoon reminder counter
|
||||
tony_ibuprofen:
|
||||
alias: Tony Ibuprofen
|
||||
sequence:
|
||||
|
Reference in New Issue
Block a user