402
scripts.yaml
402
scripts.yaml
@ -1647,19 +1647,22 @@ tony_morning_meds:
|
|||||||
icon: mdi:medication
|
icon: mdi:medication
|
||||||
mode: restart
|
mode: restart
|
||||||
sequence:
|
sequence:
|
||||||
- parallel:
|
- service: script.text_notify
|
||||||
- if:
|
data:
|
||||||
- condition: numeric_state
|
type: alert
|
||||||
entity_id: counter.tony_morning_meds_reminder_count
|
who: tony
|
||||||
above: 2
|
message: clear_notification
|
||||||
then:
|
tag: tony-morning-meds
|
||||||
- service: script.speech_engine
|
alias: Clear previous morning notification
|
||||||
data:
|
- delay:
|
||||||
who: common_areas
|
hours: 0
|
||||||
type: alert
|
minutes: 0
|
||||||
message: Tony, you need to take your morning meds. This is reminder number
|
seconds: 5
|
||||||
{{ states('counter.tony_morning_meds_reminder_count') }} for today.
|
milliseconds: 0
|
||||||
- service: script.text_notify
|
- alias: Send morning notifications via text, and TTS if needed
|
||||||
|
parallel:
|
||||||
|
- alias: Send text notification
|
||||||
|
service: script.text_notify
|
||||||
data:
|
data:
|
||||||
who: tony
|
who: tony
|
||||||
type: alert
|
type: alert
|
||||||
@ -1671,191 +1674,78 @@ tony_morning_meds:
|
|||||||
title: Taken
|
title: Taken
|
||||||
- action: TONY_MORNING_MEDS_SKIPPED
|
- action: TONY_MORNING_MEDS_SKIPPED
|
||||||
title: Skip
|
title: Skip
|
||||||
- action: TONY_MORNING_MEDS_ASK_LATER
|
- alias: Send TTS if reminders > 2
|
||||||
title: Ask Later
|
if:
|
||||||
- wait_for_trigger:
|
- condition: numeric_state
|
||||||
- platform: event
|
entity_id: counter.tony_morning_meds_reminder_count
|
||||||
event_type: ios.notification_action_fired
|
above: 2
|
||||||
event_data:
|
alias: When reminder count > 2
|
||||||
actionName: TONY_MORNING_MEDS_TAKEN
|
then:
|
||||||
id: taken
|
- service: script.speech_engine
|
||||||
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
|
|
||||||
data:
|
data:
|
||||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,30)
|
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.
|
||||||
- conditions:
|
alias: Send TTS notification
|
||||||
- condition: template
|
- service: counter.increment
|
||||||
value_template: '{{ wait.trigger.id == ''left'' }}'
|
metadata: {}
|
||||||
alias: Left
|
data: {}
|
||||||
sequence:
|
target:
|
||||||
- service: script.text_notify
|
entity_id: counter.tony_morning_meds_reminder_count
|
||||||
data:
|
alias: Increment morning reminder counter
|
||||||
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
|
|
||||||
tony_night_meds:
|
tony_night_meds:
|
||||||
alias: Tony Night Meds
|
alias: Tony Night Meds
|
||||||
icon: mdi:medication
|
icon: mdi:medication
|
||||||
mode: restart
|
mode: restart
|
||||||
sequence:
|
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
|
- service: script.text_notify
|
||||||
data:
|
data:
|
||||||
type: alert
|
type: alert
|
||||||
who: tony
|
who: tony
|
||||||
message: clear_notification
|
message: clear_notification
|
||||||
tag: tony-night-meds
|
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:
|
tony_stream_today:
|
||||||
alias: Tony Stream Today
|
alias: Tony Stream Today
|
||||||
sequence:
|
sequence:
|
||||||
@ -2004,20 +1894,25 @@ tony_custom_meds:
|
|||||||
mode: parallel
|
mode: parallel
|
||||||
tony_afternoon_meds:
|
tony_afternoon_meds:
|
||||||
alias: Tony Afternoon Meds
|
alias: Tony Afternoon Meds
|
||||||
|
icon: mdi:medication
|
||||||
|
mode: restart
|
||||||
sequence:
|
sequence:
|
||||||
- parallel:
|
- service: script.text_notify
|
||||||
- if:
|
data:
|
||||||
- condition: numeric_state
|
type: alert
|
||||||
entity_id: counter.tony_afternoon_meds_reminder_count
|
who: tony
|
||||||
above: 2
|
message: clear_notification
|
||||||
then:
|
tag: tony-afternoon-meds
|
||||||
- service: script.speech_engine
|
alias: Clear previous afternoon notification
|
||||||
data:
|
- delay:
|
||||||
who: common_areas
|
hours: 0
|
||||||
type: alert
|
minutes: 0
|
||||||
message: Tony, you need to take your afternoon meds. This is reminder number
|
seconds: 5
|
||||||
{{ states('counter.tony_afternoon_meds_reminder_count') }} for today.
|
milliseconds: 0
|
||||||
- service: script.text_notify
|
- alias: Send afternoon notifications via text, and TTS if needed
|
||||||
|
parallel:
|
||||||
|
- alias: Send text notification
|
||||||
|
service: script.text_notify
|
||||||
data:
|
data:
|
||||||
who: tony
|
who: tony
|
||||||
type: alert
|
type: alert
|
||||||
@ -2029,97 +1924,26 @@ tony_afternoon_meds:
|
|||||||
title: Taken
|
title: Taken
|
||||||
- action: TONY_AFTERNOON_MEDS_SKIPPED
|
- action: TONY_AFTERNOON_MEDS_SKIPPED
|
||||||
title: Skip
|
title: Skip
|
||||||
- action: TONY_AFTERNOON_MEDS_ASK_LATER
|
- alias: Send TTS if reminders > 2
|
||||||
title: Ask Later
|
if:
|
||||||
- wait_for_trigger:
|
- condition: numeric_state
|
||||||
- alias: Taken
|
entity_id: counter.tony_afternoon_meds_reminder_count
|
||||||
platform: event
|
above: 2
|
||||||
event_type: ios.notification_action_fired
|
alias: When reminder count > 2
|
||||||
event_data:
|
then:
|
||||||
actionName: TONY_AFTERNOON_MEDS_TAKEN
|
- service: script.speech_engine
|
||||||
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
|
|
||||||
data:
|
data:
|
||||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,30)
|
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.
|
||||||
- conditions:
|
alias: Send TTS notification
|
||||||
- condition: template
|
- service: counter.increment
|
||||||
value_template: '{{ wait.trigger.id == ''left'' }}'
|
metadata: {}
|
||||||
alias: Left
|
data: {}
|
||||||
sequence:
|
target:
|
||||||
- service: script.text_notify
|
entity_id: counter.tony_afternoon_meds_reminder_count
|
||||||
data:
|
alias: Increment afternoon reminder counter
|
||||||
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
|
|
||||||
tony_ibuprofen:
|
tony_ibuprofen:
|
||||||
alias: Tony Ibuprofen
|
alias: Tony Ibuprofen
|
||||||
sequence:
|
sequence:
|
||||||
|
Reference in New Issue
Block a user