Tony's med tracking #87
This commit is contained in:
@ -478,6 +478,13 @@ script:
|
|||||||
{% else %}
|
{% else %}
|
||||||
14:30
|
14:30
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
- delay:
|
||||||
|
milliseconds: 500
|
||||||
|
- service: input_datetime.set_datetime
|
||||||
|
target:
|
||||||
|
entity_id: input_datetime.tony_morning_meds_notify
|
||||||
|
data:
|
||||||
|
time: "{{ states('input_datetime.master_bedroom_wakeup') }}"
|
||||||
- service: input_boolean.turn_on
|
- service: input_boolean.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: input_boolean.master_bedroom_scheduling_morning_ran
|
entity_id: input_boolean.master_bedroom_scheduling_morning_ran
|
||||||
|
@ -4,6 +4,12 @@ input_boolean:
|
|||||||
tony_streaming_today:
|
tony_streaming_today:
|
||||||
name: Tony Streaming Today
|
name: Tony Streaming Today
|
||||||
icon: mdi:twitch
|
icon: mdi:twitch
|
||||||
|
tony_morning_meds_taken:
|
||||||
|
name: Tony Morning Meds Taken
|
||||||
|
icon: mdi:medical-bag
|
||||||
|
tony_night_meds_taken:
|
||||||
|
name: Tony Night Meds Taken
|
||||||
|
icon: mdi:medical-bag
|
||||||
|
|
||||||
input_datetime:
|
input_datetime:
|
||||||
tony_streaming_start_time:
|
tony_streaming_start_time:
|
||||||
@ -11,8 +17,66 @@ input_datetime:
|
|||||||
has_date: false
|
has_date: false
|
||||||
has_time: true
|
has_time: true
|
||||||
icon: mdi:twitch
|
icon: mdi:twitch
|
||||||
|
tony_morning_meds_taken:
|
||||||
|
name: Tony Morning Meds Taken
|
||||||
|
has_date: true
|
||||||
|
has_time: true
|
||||||
|
icon: mdi:medical-bag
|
||||||
|
tony_night_meds_taken:
|
||||||
|
name: Tony Night Meds Taken
|
||||||
|
has_date: true
|
||||||
|
has_time: true
|
||||||
|
icon: mdi:medical-bag
|
||||||
|
tony_morning_meds_notify:
|
||||||
|
name: Tony Morning Meds Notify
|
||||||
|
has_date: false
|
||||||
|
has_time: true
|
||||||
|
icon: mdi:medical-bag
|
||||||
|
tony_night_meds_notify:
|
||||||
|
name: Tony Night Meds Notify
|
||||||
|
has_date: false
|
||||||
|
has_time: true
|
||||||
|
icon: mdi:medical-bag
|
||||||
|
|
||||||
automation:
|
automation:
|
||||||
|
- id: c583aebf-4500-412c-9436-e1b534ba1a44
|
||||||
|
alias: Tony Meds Handler
|
||||||
|
description: Make sure Tony has taken his meds in the morning and at night
|
||||||
|
mode: restart
|
||||||
|
trigger:
|
||||||
|
- platform: time
|
||||||
|
at: input_datetime.tony_morning_meds_notify
|
||||||
|
id: wakeup
|
||||||
|
- platform: time
|
||||||
|
at: input_datetime.tony_night_meds_notify
|
||||||
|
id: sleep
|
||||||
|
action:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: and
|
||||||
|
conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id: wakeup
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_boolean.tony_morning_meds_taken
|
||||||
|
state: 'off'
|
||||||
|
sequence:
|
||||||
|
- service: script.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: script.tony_morning_meds
|
||||||
|
- conditions:
|
||||||
|
- condition: and
|
||||||
|
conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id: sleep
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_boolean.tony_night_meds_taken
|
||||||
|
state: 'off'
|
||||||
|
sequence:
|
||||||
|
- service: script.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: script.tony_night_meds
|
||||||
|
|
||||||
- id: 77f33070-4405-41b6-84c4-05b4f3697199
|
- id: 77f33070-4405-41b6-84c4-05b4f3697199
|
||||||
alias: Tony Stream Today
|
alias: Tony Stream Today
|
||||||
initial_state: true
|
initial_state: true
|
||||||
@ -58,6 +122,251 @@ automation:
|
|||||||
- service: script.tony_stream_reset
|
- service: script.tony_stream_reset
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
tony_morning_meds:
|
||||||
|
alias: 'Tony Morning Meds'
|
||||||
|
icon: mdi:medical-bag
|
||||||
|
mode: restart
|
||||||
|
sequence:
|
||||||
|
- service: input_boolean.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.tony_morning_meds_taken
|
||||||
|
- service: script.text_notify
|
||||||
|
data:
|
||||||
|
who: tony
|
||||||
|
type: alert
|
||||||
|
title: Morning Meds
|
||||||
|
message: You need to take your morning meds
|
||||||
|
tag: tony-morning-meds
|
||||||
|
actions:
|
||||||
|
- action: "TONY_MORNING_MEDS_TAKEN"
|
||||||
|
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
|
||||||
|
- platform: event
|
||||||
|
event_type: ios.notification_action_fired
|
||||||
|
event_data:
|
||||||
|
actionName: "TONY_MORNING_MEDS_SKIPPED"
|
||||||
|
id: skipped
|
||||||
|
- platform: event
|
||||||
|
event_type: ios.notification_action_fired
|
||||||
|
event_data:
|
||||||
|
actionName: "TONY_MORNING_MEDS_ASK_LATER"
|
||||||
|
id: ask-later
|
||||||
|
- platform: state
|
||||||
|
entity_id: person.tony_stork
|
||||||
|
from: 'home'
|
||||||
|
id: left
|
||||||
|
- platform: state
|
||||||
|
entity_id: input_boolean.tony_morning_meds_taken
|
||||||
|
to: 'on'
|
||||||
|
id: manual
|
||||||
|
timeout: "00:30:00"
|
||||||
|
continue_on_timeout: true
|
||||||
|
- choose:
|
||||||
|
- conditions: "{{ wait.trigger.id in ['taken','manual'] }}"
|
||||||
|
sequence:
|
||||||
|
- service: input_datetime.set_datetime
|
||||||
|
target:
|
||||||
|
entity_id: input_datetime.tony_morning_meds_taken
|
||||||
|
data:
|
||||||
|
datetime: >
|
||||||
|
{% from 'time.jinja' import set_datetime %}
|
||||||
|
{{ set_datetime (0) }}
|
||||||
|
- service: input_boolean.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.tony_morning_meds_taken
|
||||||
|
- service: logbook.log
|
||||||
|
data:
|
||||||
|
name: Tony Morning Meds
|
||||||
|
message: Taken
|
||||||
|
entity_id: input_boolean.tony_morning_meds_taken
|
||||||
|
domain: input_boolean
|
||||||
|
- conditions: "{{ wait.trigger.id == 'skipped' }}"
|
||||||
|
sequence:
|
||||||
|
- service: logbook.log
|
||||||
|
data:
|
||||||
|
name: Tony Morning Meds
|
||||||
|
message: Skipped
|
||||||
|
entity_id: input_boolean.tony_morning_meds_taken
|
||||||
|
domain: input_boolean
|
||||||
|
- conditions: "{{ wait.trigger.id == 'ask-later' }}"
|
||||||
|
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,30) }}
|
||||||
|
- service: logbook.log
|
||||||
|
data:
|
||||||
|
name: Tony Morning Meds
|
||||||
|
message: Delayed for 30 minutes
|
||||||
|
entity_id: input_boolean.tony_morning_meds_taken
|
||||||
|
domain: input_boolean
|
||||||
|
- conditions: "{{ wait.trigger.id == 'left' }}"
|
||||||
|
sequence:
|
||||||
|
- service: script.text_notify
|
||||||
|
data:
|
||||||
|
who: tony
|
||||||
|
type: critical
|
||||||
|
title: HEY DUMBASS
|
||||||
|
message: YOU FORGOT TO TAKE YOUR MORNING MEDS!!!!!
|
||||||
|
- conditions: "{{ wait.trigger == 'none' }}"
|
||||||
|
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: logbook.log
|
||||||
|
data:
|
||||||
|
name: Tony Morning Meds
|
||||||
|
message: No response, delayed for 1 minute
|
||||||
|
entity_id: input_boolean.tony_morning_meds_taken
|
||||||
|
domain: input_boolean
|
||||||
|
- service: script.text_notify
|
||||||
|
data:
|
||||||
|
type: alert
|
||||||
|
who: tony
|
||||||
|
message: clear_notification
|
||||||
|
tag: tony-morning-meds
|
||||||
|
|
||||||
|
tony_night_meds:
|
||||||
|
alias: 'Tony Night Meds'
|
||||||
|
icon: mdi:medical-bag
|
||||||
|
mode: restart
|
||||||
|
sequence:
|
||||||
|
- service: input_boolean.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.tony_night_meds_taken
|
||||||
|
- 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
|
||||||
|
- platform: event
|
||||||
|
event_type: ios.notification_action_fired
|
||||||
|
event_data:
|
||||||
|
actionName: "TONY_NIGHT_MEDS_SKIPPED"
|
||||||
|
id: skipped
|
||||||
|
- platform: event
|
||||||
|
event_type: ios.notification_action_fired
|
||||||
|
event_data:
|
||||||
|
actionName: "TONY_NIGHT_MEDS_ASK_LATER"
|
||||||
|
id: ask-later
|
||||||
|
- platform: state
|
||||||
|
entity_id: input_boolean.tony_night_meds_taken
|
||||||
|
to: 'on'
|
||||||
|
id: manual
|
||||||
|
timeout: "00:30:00"
|
||||||
|
continue_on_timeout: true
|
||||||
|
- choose:
|
||||||
|
- conditions: "{{ wait.trigger.id in ['taken','manual'] }}"
|
||||||
|
sequence:
|
||||||
|
- service: input_datetime.set_datetime
|
||||||
|
target:
|
||||||
|
entity_id: input_datetime.tony_night_meds_taken
|
||||||
|
data:
|
||||||
|
datetime: >
|
||||||
|
{% from 'time.jinja' import set_datetime %}
|
||||||
|
{{ set_datetime (0) }}
|
||||||
|
- service: input_boolean.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.tony_night_meds_taken
|
||||||
|
- service: logbook.log
|
||||||
|
data:
|
||||||
|
name: Tony Night Meds
|
||||||
|
message: have been taken
|
||||||
|
entity_id: input_boolean.tony_night_meds_taken
|
||||||
|
domain: input_boolean
|
||||||
|
- conditions: "{{ wait.trigger.id == 'skipped' }}"
|
||||||
|
sequence:
|
||||||
|
- service: logbook.log
|
||||||
|
data:
|
||||||
|
name: Tony Night Meds
|
||||||
|
message: have been skipped
|
||||||
|
entity_id: input_boolean.tony_night_meds_taken
|
||||||
|
domain: input_boolean
|
||||||
|
- conditions: "{{ wait.trigger.id == '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) }}
|
||||||
|
- service: logbook.log
|
||||||
|
data:
|
||||||
|
name: Tony Night Meds
|
||||||
|
message: delayed for 30 minutes
|
||||||
|
entity_id: input_boolean.tony_night_meds_taken
|
||||||
|
domain: input_boolean
|
||||||
|
- conditions: "{{ wait.trigger == 'none' }}"
|
||||||
|
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,5) }}
|
||||||
|
- service: logbook.log
|
||||||
|
data:
|
||||||
|
name: Tony Night Meds
|
||||||
|
message: No response, delayed for 5 minutes
|
||||||
|
entity_id: input_boolean.tony_night_meds_taken
|
||||||
|
domain: input_boolean
|
||||||
|
else:
|
||||||
|
- service: logbook.log
|
||||||
|
data:
|
||||||
|
name: Tony Night Meds
|
||||||
|
message: No response, cancelled
|
||||||
|
entity_id: input_boolean.tony_night_meds_taken
|
||||||
|
domain: input_boolean
|
||||||
|
- service: script.text_notify
|
||||||
|
data:
|
||||||
|
type: alert
|
||||||
|
who: tony
|
||||||
|
message: clear_notification
|
||||||
|
tag: tony-night-meds
|
||||||
|
|
||||||
tony_stream_today:
|
tony_stream_today:
|
||||||
alias: 'Tony Stream Today'
|
alias: 'Tony Stream Today'
|
||||||
sequence:
|
sequence:
|
||||||
|
@ -302,6 +302,14 @@ going_upstairs:
|
|||||||
target:
|
target:
|
||||||
entity_id: light.basement_studio_lights
|
entity_id: light.basement_studio_lights
|
||||||
alias: Turn off the lights
|
alias: Turn off the lights
|
||||||
|
- service: input_datetime.set_datetime
|
||||||
|
data:
|
||||||
|
time: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,2) }}
|
||||||
|
|
||||||
|
'
|
||||||
|
target:
|
||||||
|
entity_id: input_datetime.tony_night_meds_notify
|
||||||
|
alias: Schedule the night meds notification
|
||||||
- wait_template: '{{ is_state(''binary_sensor.upstairs_bathroom_occupied'',''on'')
|
- wait_template: '{{ is_state(''binary_sensor.upstairs_bathroom_occupied'',''on'')
|
||||||
or is_state(''input_boolean.goodnight'',''on'') }}'
|
or is_state(''input_boolean.goodnight'',''on'') }}'
|
||||||
timeout: '{{ wait.remaining }}'
|
timeout: '{{ wait.remaining }}'
|
||||||
|
Reference in New Issue
Block a user