Compare commits

...

18 Commits

Author SHA1 Message Date
bcfc6405ce Add scheduling automations for sports notifications
Signed-off-by: Tony Stork <tm24fan8@gmail.com>
2024-08-08 22:30:52 -04:00
1028f2d053 Fix typo for wife's name 2024-08-08 22:30:52 -04:00
e40785a382 Use time_from_calendar macro for K scheduling for two hour delays 2024-08-08 22:30:51 -04:00
d88f89475b Fix scheduling for wife's morning meds reminder
#205
2024-08-08 22:30:51 -04:00
4b3cfbc1df Add new macro for setting time AND date from calendars 2024-08-08 22:30:50 -04:00
1d537036c4 Change template condition to "or" condition for my meds cleanup
#205
2024-08-08 22:30:50 -04:00
f3b17dfd5e Change template condition to "or" condition for wife meds cleanup
#205
2024-08-08 22:30:49 -04:00
95d0a20e3d Implement new trackers for K
#205
2024-08-08 22:30:49 -04:00
3eb5f3a7cc Implement new trackers for wife
#205
2024-08-08 22:30:48 -04:00
6ee087ab56 We need to START the med scripts by incrementing the counter
Doing it at the end means things that should happen on the third reminder will not actually happen until the fourth.

#205
2024-08-08 22:30:48 -04:00
476cbac212 Rewrite Tony meds scripts to simply handle sending the reminders
#205
2024-08-08 22:30:48 -04:00
c8671a1b38 Add Tony Meds Cleanup automation
#205
2024-08-08 22:30:47 -04:00
b7424a0d74 Rewrite Tony Meds Handler automation
#205
2024-08-08 22:30:47 -04:00
7ea640c947 Switch from template sensors to input booleans for reminders
#205
2024-08-08 22:30:46 -04:00
404adcb60a Change logic for setting and resetting notification times
#205
2024-08-08 22:30:46 -04:00
3543e43672 Add triggers to help with reboot survival
#205
2024-08-08 22:30:45 -04:00
29b310fe5b Fix UUIDs
#205
2024-08-08 22:30:45 -04:00
cc69a937eb Initial notification framework for meds rework 2024-08-08 22:30:44 -04:00
9 changed files with 1392 additions and 777 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -152,4 +152,6 @@
{{ cleanup(data()) }}
{% endmacro %}
{{ sports_updates('pregame') }}
{% macro sports_datetime(team) %}
{{ as_timestamp(state_attr(team,'date')) | timestamp_custom('%Y-%m-%d %H:%M:%S') }}
{% endmacro%}

View File

@@ -68,6 +68,31 @@
{% endif %}
{% endmacro %}
{% macro datetime_from_calendar(calendar,start_or_end,action,operator,days,hours,minutes) %}
{% set base = as_timestamp(strptime(state_attr(calendar,start_or_end), '%Y-%m-%d %H:%M:%S')) | int %}
{% if minutes is defined %}
{% set mod = ((((days * 24) * 60) * 60) + (hours* 60) * 60) + (minutes * 60) | int %}
{% elif hours is defined %}
{% set mod = (((days * 24) * 60) * 60) + (hours* 60) * 60 | int %}
{% elif days is defined %}
{% set mod = ((days * 24) * 60) * 60 | int %}
{% endif %}
{% if action == 'set' %}
{% set ts = "%Y-%m-%d %H:%M:%S" %}
{% elif action == 'read' %}
{% set ts = "%Y-%m-%d %-I:%M %p" %}
{% endif %}
{% if operator is defined %}
{% if operator == 'add' %}
{{ (base + mod) | timestamp_custom(ts) }}
{% elif operator == 'subtract' %}
{{ (base - mod) | timestamp_custom(ts) }}
{% endif %}
{% else %}
{{ base | timestamp_custom(ts) }}
{% endif %}
{% endmacro %}
{% macro set_datetime(hours,minutes,seconds) %}
{% if seconds is defined %}
{{ (as_timestamp(now()) + (((hours * 60) * 60) + (minutes * 60)) + seconds) | int | timestamp_custom('%Y-%m-%d %H:%M:%S') }}

View File

@@ -16,9 +16,15 @@ input_boolean:
kallen_late_bedtime:
name: Kallen Late Bedtime
icon: mdi:weather-night
kallen_morning_meds_reminder:
name: Kallen Morning Meds Reminder
icon: mdi:medication
kallen_morning_meds_taken:
name: Kallen Morning Meds Taken
icon: mdi:medication
kallen_night_meds_reminder:
name: Kallen Night Meds Reminder
icon: mdi:medication
kallen_night_meds_taken:
name: Kallen Night Meds Taken
icon: mdi:medication
@@ -67,12 +73,12 @@ input_datetime:
icon: mdi:medication
kallen_morning_meds_notify:
name: Kallen Morning Meds Notify
has_date: false
has_date: true
has_time: true
icon: mdi:medication
kallen_night_meds_notify:
name: Kallen Night Meds Notify
has_date: false
has_date: true
has_time: true
icon: mdi:medication
kallen_alarm_clock:

View File

@@ -164,7 +164,7 @@ script:
time: >
{% from 'time.jinja' import time_from_calendar %}
{% if is_state('input_boolean.two_hour_delay','on') %}
10:00
{{ time_from_calendar('calendar.kallen_school_days','start_time','set','add',2)}}
{% else %}
{{ time_from_calendar('calendar.kallen_school_days','start_time','set') }}
{% endif %}
@@ -587,8 +587,9 @@ script:
entity_id: input_datetime.tina_morning_meds_notify
data:
time: >
{% from 'time.jinja' import datetime_from_calendar %}
{% if is_state('input_boolean.work_today','on') %}
{{ (state_attr('input_datetime.tina_workday_start','timestamp') | int - 1800) | timestamp_custom('%H:%M', false) }}
{{ datetime_from_calendar('calendar.family_tinawork','start_time','set','subtract',0,0,30) }}
{% else %}
{{ states('input_datetime.master_bedroom_wakeup') }}
{% endif %}

View File

@@ -3,6 +3,53 @@ input_boolean:
name: Sports Updates
icon: mdi:strategy
input_datetime:
michigan_wolverines_start:
name: Michigan Wolverines Start
has_date: true
has_time: true
icon: mdi:football
ohio_state_buckeyes_start:
name: Ohio State Buckeyes Start
has_date: true
has_time: true
icon: mdi:football
toledo_rockets_start:
name: Toledo Rockets Start
has_date: true
has_time: true
icon: mdi:football
minnesota_vikings_start:
name: Minnesota Vikings Start
has_date: true
has_time: true
icon: mdi:football
san_francisco_49ers_start:
name: San Francisco 49ers Start
has_date: true
has_time: true
icon: mdi:football
minnesota_twins_start:
name: Minnesota Twins Start
has_date: true
has_time: true
icon: mdi:baseball
cleveland_guardians_start:
name: Cleveland Guardians Start
has_date: true
has_time: true
icon: mdi:baseball
los_angeles_dodgers_start:
name: Los Angeles Dodgers Start
has_date: true
has_time: true
icon: mdi:baseball
minnesota_wild_start:
name: Minnesota Wild Start
has_date: true
has_time: true
icon: mdi:hockey-puck
template:
- binary_sensor:
- name: Michigan Wolverines Inhibit

View File

@@ -7,9 +7,15 @@ input_boolean:
work_today_extended:
name: Work Today Extended
icon: mdi:briefcase-plus
tina_morning_meds_reminder:
name: Tina Morning Meds Reminder
icon: mdi:medication
tina_morning_meds_taken:
name: Tina Morning Meds Taken
icon: mdi:medication
tina_night_meds_reminder:
name: Tina Night Meds Reminder
icon: mdi:medication
tina_night_meds_taken:
name: Tina Night Meds Taken
icon: mdi:medication
@@ -35,7 +41,7 @@ input_datetime:
icon: mdi:medication
tina_morning_meds_notify:
name: Tina Morning Meds Notify
has_date: false
has_date: true
has_time: true
icon: mdi:medication
tina_night_meds_taken:
@@ -45,7 +51,7 @@ input_datetime:
icon: mdi:medication
tina_night_meds_notify:
name: Tina Night Meds Notify
has_date: false
has_date: true
has_time: true
icon: mdi:medication
@@ -191,165 +197,3 @@ script:
- service: script.master_bedroom_scheduling_evening
- service: script.emma_bedroom_scheduling_evening
- service: script.security_scheduling
tina_morning_meds:
alias: 'Tina Morning Meds'
icon: mdi:medication
mode: restart
sequence:
- service: script.text_notify
data:
who: tina
type: alert
title: Morning Meds
message: You need to take your morning meds
tag: tina-morning-meds
actions:
- action: "TINA_MORNING_MEDS_TAKEN"
title: Taken
- action: "TINA_MORNING_MEDS_SKIPPED"
title: Skip
- action: "TINA_MORNING_MEDS_ASK_LATER"
title: Ask Later
- wait_for_trigger:
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: "TINA_MORNING_MEDS_TAKEN"
id: taken
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: "TINA_MORNING_MEDS_SKIPPED"
id: skipped
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: "TINA_MORNING_MEDS_ASK_LATER"
id: ask-later
- platform: state
entity_id: person.christina_stork
from: 'home'
id: left
- platform: state
entity_id: input_boolean.tina_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_boolean.turn_on
target:
entity_id: input_boolean.tina_morning_meds_taken
- conditions: "{{ wait.trigger.id == 'ask-later' }}"
sequence:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.tina_morning_meds_notify
data:
datetime: >
{% from 'time.jinja' import set_datetime %}
{{ set_datetime(0,30) }}
- conditions: "{{ wait.trigger.id == 'left' }}"
sequence:
- service: script.text_notify
data:
who: tina
type: alert
title: HEY DUMBASS
message: YOU FORGOT TO TAKE YOUR MORNING MEDS!!!!!
- conditions: "{{ wait.trigger == 'none' or wait.trigger.idx is undefined }}"
sequence:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.tina_morning_meds_notify
data:
datetime: >
{% from 'time.jinja' import set_datetime %}
{{ set_datetime(0,1) }}
- service: script.text_notify
data:
type: alert
who: tina
message: clear_notification
tag: tina-morning-meds
tina_night_meds:
alias: 'Tina Night Meds'
icon: mdi:medication
mode: restart
sequence:
- service: script.text_notify
data:
who: tina
type: alert
title: Night Meds
message: You need to take your night meds
tag: tina-night-meds
actions:
- action: "TINA_NIGHT_MEDS_TAKEN"
title: Taken
- action: "TINA_NIGHT_MEDS_SKIPPED"
title: Skip
- action: "TINA_NIGHT_MEDS_ASK_LATER"
title: Ask Later
- wait_for_trigger:
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: "TINA_NIGHT_MEDS_TAKEN"
id: taken
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: "TINA_NIGHT_MEDS_SKIPPED"
id: skipped
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: "TINA_NIGHT_MEDS_ASK_LATER"
id: ask-later
- platform: state
entity_id: input_boolean.tina_night_meds_taken
to: 'on'
id: manual
- platform: state
entity_id:
- input_boolean.master_bedroom_sleeping
- input_boolean.goodnight
to: 'on'
id: sleeping
timeout: "00:30:00"
continue_on_timeout: true
- choose:
- conditions: "{{ wait.trigger.id in ['taken','manual'] }}"
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.tina_night_meds_taken
- conditions: "{{ wait.trigger.id == 'ask-later' }}"
sequence:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.tina_night_meds_notify
data:
datetime: >
{% from 'time.jinja' import set_datetime %}
{{ set_datetime(0,30) }}
- conditions: "{{ wait.trigger == 'none' or wait.trigger.idx is undefined }}"
sequence:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.tina_night_meds_notify
data:
datetime: >
{% from 'time.jinja' import set_datetime %}
{{ set_datetime(0,1) }}
- service: script.text_notify
data:
type: alert
who: tina
message: clear_notification
tag: tina-night-meds

View File

@@ -4,12 +4,21 @@ input_boolean:
tony_streaming_today:
name: Tony Streaming Today
icon: mdi:twitch
tony_morning_meds_reminder:
name: Tony Morning Meds Reminder
icon: mdi:medication
tony_morning_meds_taken:
name: Tony Morning Meds Taken
icon: mdi:medication
tony_afternoon_meds_reminder:
name: Tony Afternoon Meds Reminder
icon: mdi:medication
tony_afternoon_meds_taken:
name: Tony Afternoon Meds Taken
icon: mdi:medication
tony_night_meds_reminder:
name: Tony Night Meds Reminder
icon: mdi:medication
tony_night_meds_taken:
name: Tony Night Meds Taken
icon: mdi:medication
@@ -64,17 +73,17 @@ input_datetime:
icon: mdi:medication
tony_morning_meds_notify:
name: Tony Morning Meds Notify
has_date: false
has_date: true
has_time: true
icon: mdi:medication
tony_afternoon_meds_notify:
name: Tony Afternoon Meds Notify
has_date: false
has_date: true
has_time: true
icon: mdi:medication
tony_night_meds_notify:
name: Tony Night Meds Notify
has_date: false
has_date: true
has_time: true
icon: mdi:medication
tony_custom_meds_taken_p1:
@@ -84,7 +93,7 @@ input_datetime:
icon: mdi:medication
tony_custom_meds_notify_p1:
name: Tony Custom Meds Notify P1
has_date: false
has_date: true
has_time: true
icon: mdi:medication
tony_custom_meds_taken_p2:
@@ -94,7 +103,7 @@ input_datetime:
icon: mdi:medication
tony_custom_meds_notify_p2:
name: Tony Custom Meds Notify P2
has_date: false
has_date: true
has_time: true
icon: mdi:medication
tony_ibuprofen_taken:
@@ -104,7 +113,7 @@ input_datetime:
icon: mdi:medication
tony_ibuprofen_notify:
name: Tony Ibuprofen Notify
has_date: false
has_date: true
has_time: true
icon: mdi:medication
tony_tylenol_taken:
@@ -114,7 +123,7 @@ input_datetime:
icon: mdi:medication
tony_tylenol_notify:
name: Tony Tylenol Notify
has_date: false
has_date: true
has_time: true
icon: mdi:medication
@@ -178,4 +187,34 @@ sensor:
json_attributes:
- project
- items
scan_interval: 30
scan_interval: 30
# template:
# - binary_sensor:
# - name: Tony Morning Meds Needed
# unique_id: 32f2f158-8c59-486e-bf85-f14909375ff7
# state: >
# {% set ct = as_timestamp(now()) %}
# {% set notify = state_attr('input_datetime.tony_morning_meds_notify','timestamp') %}
# {{ (ct >= notify) and is_state('input_boolean.tony_morning_meds_taken','off') }}
# attributes:
# reminder_time: "{{ states('input_datetime.tony_morning_meds_notify') }}"
# icon: mdi:medication
# - name: Tony Afternoon Meds Needed
# unique_id: 363b5ea0-3ad7-4e98-b0b0-5ff67bbef2f4
# state: >
# {% set ct = as_timestamp(now()) %}
# {% set notify = state_attr('input_datetime.tony_afternoon_meds_notify','timestamp') %}
# {{ (ct >= notify) and is_state('input_boolean.tony_afternoon_meds_taken','off') }}
# attributes:
# reminder_time: "{{ states('input_datetime.tony_afternoon_meds_notify') }}"
# icon: mdi:medication
# - name: Tony Night Meds Needed
# unique_id: b927b5a4-27a7-42aa-af4e-fa37a7036d25
# state: >
# {% set ct = as_timestamp(now()) %}
# {% set notify = state_attr('input_datetime.tony_night_meds_notify','timestamp') %}
# {{ (ct >= notify) and is_state('input_boolean.tony_night_meds_taken','off') }}
# attributes:
# reminder_time: "{{ states('input_datetime.tony_night_meds_notify') }}"
# icon: mdi:medication

View File

@@ -1647,19 +1647,28 @@ 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: counter.increment
metadata: {}
data: {}
target:
entity_id: counter.tony_morning_meds_reminder_count
alias: Increment morning reminder counter
- 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,99 +1680,45 @@ 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
tony_night_meds:
alias: Tony Night Meds
icon: mdi:medication
mode: restart
sequence:
- service: counter.increment
metadata: {}
data: {}
target:
entity_id: counter.tony_night_meds_reminder_count
alias: Increment night reminder counter
- 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 text notification
service: script.text_notify
data:
who: tony
type: alert
@@ -1775,87 +1730,6 @@ tony_night_meds:
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
tony_stream_today:
alias: Tony Stream Today
sequence:
@@ -2004,20 +1878,31 @@ 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: counter.increment
metadata: {}
data: {}
target:
entity_id: counter.tony_afternoon_meds_reminder_count
alias: Increment afternoon reminder counter
- 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 +1914,20 @@ 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
tony_ibuprofen:
alias: Tony Ibuprofen
sequence:
@@ -2480,203 +2288,109 @@ tony_tylenol:
mode: queued
icon: mdi:medication
max: 10
'1710612011154':
kallen_morning_meds:
alias: Kallen Morning Meds
sequence:
- service: script.text_notify
data:
who: kallen
type: alert
title: Morning Meds
message: You need to take your morning meds. Go to mom or dad to confirm.
tag: kallen-morning-meds-self
- service: script.text_notify
data:
who: parents
type: alert
title: Morning Meds
message: Kallen needs to take his morning meds
tag: kallen-morning-meds-parents
actions:
- action: KALLEN_MORNING_MEDS_TAKEN
title: Taken
- action: KALLEN_MORNING_MEDS_SKIPPED
title: Skip
- action: KALLEN_MORNING_MEDS_ASK_LATER
title: Ask Later
- wait_for_trigger:
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: KALLEN_MORNING_MEDS_TAKEN
id: taken
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: KALLEN_MORNING_MEDS_SKIPPED
id: skipped
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: KALLEN_MORNING_MEDS_ASK_LATER
id: ask-later
- platform: state
entity_id: person.kallen_stork
from: home
id: left
- platform: state
entity_id: input_boolean.kallen_morning_meds_taken
to: 'on'
id: manual
timeout: 00:10:00
continue_on_timeout: true
- choose:
- conditions:
- condition: template
value_template: '{{ wait.trigger.id in [''taken'',''manual''] }}'
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.kallen_morning_meds_taken
data: {}
- conditions:
- condition: template
value_template: '{{ wait.trigger.id == ''ask-later'' }}'
sequence:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.kallen_morning_meds_notify
data:
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,5)
}}
'
- conditions:
- condition: template
value_template: '{{ wait.trigger.id == ''left'' or wait.trigger == ''none''
or wait.trigger.idx is undefined }}'
sequence:
- if:
- condition: state
entity_id: person.kallen_stork
state: home
then:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.kallen_morning_meds_notify
data:
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1)
}}
'
- service: script.text_notify
data:
type: alert
who: kallen
message: clear_notification
tag: kallen-morning-meds-parents
- service: script.text_notify
data:
type: alert
who: kallen
message: clear_notification
tag: kallen-morning-meds-self
- service: counter.increment
metadata: {}
data: {}
target:
entity_id: counter.kallen_morning_meds_reminder_count
alias: Increment morning reminder counter
- alias: Clear previous morning notifications
parallel:
- service: script.text_notify
data:
type: alert
who: parents
message: clear_notification
tag: kallen-morning-meds-parents
alias: Clear for parents
- service: script.text_notify
data:
type: alert
who: kallen
message: clear_notification
tag: kallen-morning-meds-self
alias: Clear for Kallen
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- alias: Send text notifications
parallel:
- alias: Send to parents
service: script.text_notify
data:
who: parents
type: alert
title: Morning Meds
message: Kallen needs to take his morning meds
tag: kallen-morning-meds-parents
actions:
- action: KALLEN_MORNING_MEDS_TAKEN
title: Taken
- action: KALLEN_MORNING_MEDS_SKIPPED
title: Skip
- service: script.text_notify
data:
who: kallen
type: alert
title: Morning Meds
message: You need to take your morning meds. Go to mom or dad to confirm.
tag: kallen-morning-meds-self
alias: Send to Kallen
icon: mdi:medication
mode: restart
'1710612164315':
kallen_night_meds:
alias: Kallen Night Meds
sequence:
- service: script.text_notify
data:
who: kallen
type: alert
title: Night Meds
message: You need to take your night meds (melatonin)
tag: kallen-night-meds
actions:
- action: KALLEN_NIGHT_MEDS_TAKEN
title: Taken
- action: KALLEN_NIGHT_MEDS_SKIPPED
title: Skip
- action: KALLEN_NIGHT_MEDS_ASK_LATER
title: Ask Later
- service: script.text_notify
data:
who: "{% if states('person.christina_stork') in ['Bob Evans','BobEvans'] %}\n
\ tony\n{% else %}\n parents\n{% endif %}\n"
type: alert
title: Night Meds
message: Kallen needs to take his night meds (melatonin)
tag: kallen-night-meds
actions:
- action: KALLEN_NIGHT_MEDS_TAKEN
title: Taken
- action: KALLEN_NIGHT_MEDS_SKIPPED
title: Skip
- action: KALLEN_NIGHT_MEDS_ASK_LATER
title: Ask Later
- wait_for_trigger:
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: KALLEN_NIGHT_MEDS_TAKEN
id: taken
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: KALLEN_NIGHT_MEDS_SKIPPED
id: skipped
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: KALLEN_NIGHT_MEDS_ASK_LATER
id: ask-later
- platform: state
entity_id: input_boolean.kallen_night_meds_taken
to: 'on'
id: manual
timeout: 00:05:00
continue_on_timeout: true
- choose:
- conditions:
- condition: template
value_template: '{{ wait.trigger.id in [''taken'',''manual''] }}'
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.kallen_night_meds_taken
data: {}
- conditions:
- condition: template
value_template: '{{ wait.trigger.id == ''ask-later'' }}'
sequence:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.kallen_night_meds_notify
data:
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,15)
}}
'
- conditions:
- condition: template
value_template: '{{ wait.trigger == ''none'' or wait.trigger.idx is undefined
}}'
sequence:
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.kallen_night_meds_notify
data:
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1)
}}
'
- service: counter.increment
metadata: {}
data: {}
alias: Increment night reminder counter
- service: script.text_notify
data:
type: alert
who: all
message: clear_notification
tag: kallen-night-meds
alias: Clear previous night notification
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- parallel:
- service: script.text_notify
data:
who: "{% if states('person.christina_stork') in ['Bob Evans','BobEvans'] %}\n
\ tony\n{% else %}\n parents\n{% endif %}\n"
type: alert
title: Night Meds
message: Kallen needs to take his night meds (melatonin)
tag: kallen-night-meds
actions:
- action: KALLEN_NIGHT_MEDS_TAKEN
title: Taken
- action: KALLEN_NIGHT_MEDS_SKIPPED
title: Skip
alias: Send to parents
- alias: Send to Kallen
service: script.text_notify
data:
who: kallen
type: alert
title: Night Meds
message: You need to take your night meds (melatonin)
tag: kallen-night-meds
actions:
- action: KALLEN_NIGHT_MEDS_TAKEN
title: Taken
- action: KALLEN_NIGHT_MEDS_SKIPPED
title: Skip
alias: Send text notifications
icon: mdi:medication
mode: restart
reset_annc_switches:
@@ -3260,3 +2974,77 @@ emma_sleep:
alias: Turn on white noise
icon: mdi:lightbulb-night
mode: restart
tina_morning_meds:
alias: Tina Morning Meds
icon: mdi:medication
mode: restart
sequence:
- service: counter.increment
metadata: {}
data: {}
target:
entity_id: counter.tina_morning_meds_reminder_count
alias: Increment morning reminder counter
- service: script.text_notify
data:
type: alert
who: tina
message: clear_notification
tag: tina-morning-meds
alias: Clear previous morning notification
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- alias: Send text notification
service: script.text_notify
data:
who: tina
type: alert
title: Morning Meds
message: You need to take your morning meds
tag: tina-morning-meds
actions:
- action: TINA_MORNING_MEDS_TAKEN
title: Taken
- action: TINA_MORNING_MEDS_SKIPPED
title: Skip
description: ''
tina_night_meds:
alias: Tina Night Meds
icon: mdi:medication
mode: restart
sequence:
- service: counter.increment
metadata: {}
data: {}
target:
entity_id: counter.tina_night_meds_reminder_count
alias: Increment night reminder counter
- service: script.text_notify
data:
type: alert
who: tina
message: clear_notification
tag: tina-night-meds
alias: Clear previous night notification
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- alias: Send text notification
service: script.text_notify
data:
who: tina
type: alert
title: Night Meds
message: You need to take your night meds
tag: tina-night-meds
actions:
- action: TINA_NIGHT_MEDS_TAKEN
title: Taken
- action: TINA_NIGHT_MEDS_SKIPPED
title: Skip
description: ''