Compare commits

...

23 Commits

Author SHA1 Message Date
tm24fan8 35e5891f5e Add start of school year automation 2024-09-04 15:01:59 -04:00
tm24fan8 3d4dc4c1d9 Fix wife and K's med notification scheduling
#205
2024-08-09 16:57:13 -04:00
tm24fan8 8c029143f2 Add scheduling automations for sports notifications
Signed-off-by: Tony Stork <tm24fan8@gmail.com>
2024-08-09 16:57:12 -04:00
tm24fan8 c773b29573 Fix typo for wife's name 2024-08-09 16:57:11 -04:00
tm24fan8 76841ecb19 Use time_from_calendar macro for K scheduling for two hour delays 2024-08-09 16:57:10 -04:00
tm24fan8 f3d5d90593 Fix scheduling for wife's morning meds reminder
#205
2024-08-09 16:57:09 -04:00
tm24fan8 c7d1696cca Add new macro for setting time AND date from calendars 2024-08-09 16:57:08 -04:00
tm24fan8 db9b221fd9 Change template condition to "or" condition for my meds cleanup
#205
2024-08-09 16:57:07 -04:00
tm24fan8 955bf32e81 Change template condition to "or" condition for wife meds cleanup
#205
2024-08-09 16:57:06 -04:00
tm24fan8 fc498ca23b Implement new trackers for K
#205
2024-08-09 16:57:05 -04:00
tm24fan8 f61d79dee7 Implement new trackers for wife
#205
2024-08-09 16:57:04 -04:00
tm24fan8 cc5a94e683 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-09 16:57:03 -04:00
tm24fan8 c8678d831a Rewrite Tony meds scripts to simply handle sending the reminders
#205
2024-08-09 16:57:02 -04:00
tm24fan8 e566d94d90 Add Tony Meds Cleanup automation
#205
2024-08-09 16:57:01 -04:00
tm24fan8 54de982d95 Rewrite Tony Meds Handler automation
#205
2024-08-09 16:57:00 -04:00
tm24fan8 8a4545abed Switch from template sensors to input booleans for reminders
#205
2024-08-09 16:56:59 -04:00
tm24fan8 bb9e604d33 Change logic for setting and resetting notification times
#205
2024-08-09 16:56:58 -04:00
tm24fan8 e912733bbc Add triggers to help with reboot survival
#205
2024-08-09 16:56:57 -04:00
tm24fan8 53b230e0ad Fix UUIDs
#205
2024-08-09 16:56:56 -04:00
tm24fan8 4761855858 Initial notification framework for meds rework 2024-08-09 16:56:55 -04:00
tm24fan8 b83c3e2ecd Disallow default issue template 2024-08-09 16:56:35 -04:00
tm24fan8 22ba35d631 Add feature request template 2024-08-09 16:47:39 -04:00
tm24fan8 b6539ea85c Add bug label to bug report template 2024-08-09 16:47:25 -04:00
13 changed files with 1450 additions and 785 deletions
+995 -132
View File
File diff suppressed because it is too large Load Diff
+3 -1
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%}
+25
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') }}
+1
View File
@@ -21,4 +21,5 @@ body:
validations:
required: true
labels:
- type/bug
- needs-response
+1
View File
@@ -0,0 +1 @@
blank_issues_enabled: false
+25
View File
@@ -0,0 +1,25 @@
name: Feature Request
about: Request a new feature to be added
title: "[Feature Request]: "
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request form!
- type: markdown
attributes:
value: |
This issue was created by an issue **template**
visible: [content]
- type: textarea
id: feature-request
attributes:
label: Feature Request
description: What new feature would you like to see?
placeholder: What is your feature request!
value: "I would like this feature"
validations:
required: true
labels:
- type/enhancement
- needs-response
+8 -2
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:
+23 -10
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 %}
@@ -247,11 +247,14 @@ script:
target:
entity_id: input_datetime.kallen_morning_meds_notify
data:
time: >
datetime: >
{% set date = now().strftime('%Y-%m-%d') %}
{% set wakeup = state_attr('input_datetime.kallen_wakeup_time','timestamp') | int %}
{% set wakeup_mod = (wakeup + 600) | timestamp_custom('%T',false) %}
{% if is_state('input_boolean.kallen_school_today','on') %}
{{ (state_attr('input_datetime.kallen_wakeup_time','timestamp') + 600) | timestamp_custom('%H:%M', false) }}
{{ date + ' ' + wakeup_mod }}
{% else %}
{{ states('input_datetime.kallen_wakeup_time') }}
{{ date + ' ' + states('input_datetime.kallen_wakeup_time') }}
{% endif %}
- service: input_boolean.turn_on
target:
@@ -324,7 +327,15 @@ script:
target:
entity_id: input_datetime.kallen_night_meds_notify
data:
time: "{{ (state_attr('input_datetime.kallen_bedtime','timestamp') - 600) | timestamp_custom('%H:%M', false) }}"
datetime: >
{% set bedtime = state_attr('input_datetime.kallen_bedtime','timestamp') | int %}
{% set bedtime_mod = (bedtime - 600) | timestamp_custom('%T',false) %}
{% if bedtime < 13800 %}
{% set date = (as_timestamp(now()) + 86400) | timestamp_custom("%Y-%m-%d", True) %}
{% else %}
{% set date = now().strftime('%Y-%m-%d') %}
{% endif %}
{{ date + ' ' + bedtime_mod }}
- if:
- condition: state
entity_id: input_boolean.kallen_late_bedtime
@@ -354,7 +365,7 @@ script:
target:
entity_id: input_datetime.kallen_night_meds_notify
data:
time: "{{ (state_attr('input_datetime.kallen_night_meds_notify','timestamp') + 3600) | timestamp_custom('%H:%M', false) }}"
datetime: "{{ (state_attr('input_datetime.kallen_night_meds_notify','timestamp') + 3600) | timestamp_custom('%Y-%m-%d %H:%M:%S') }}"
- service: input_boolean.turn_on
target:
entity_id: input_boolean.kallen_scheduling_evening_ran
@@ -586,11 +597,13 @@ script:
target:
entity_id: input_datetime.tina_morning_meds_notify
data:
time: >
datetime: >
{% from 'time.jinja' import datetime_from_calendar %}
{% set date = now().strftime('%Y-%m-%d') %}
{% 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') }}
{{ date + ' ' + states('input_datetime.master_bedroom_wakeup') }}
{% endif %}
- service: input_boolean.turn_on
target:
@@ -676,7 +689,7 @@ script:
target:
entity_id: input_datetime.tina_night_meds_notify
data:
time: '03:00'
datetime: "{{ (as_timestamp(now()) + 86400) | timestamp_custom('%Y-%m-%d', True) + ' 03:00:00' }}"
- service: input_boolean.turn_on
target:
entity_id: input_boolean.master_bedroom_scheduling_evening_ran
+11
View File
@@ -288,6 +288,17 @@ automation:
target:
entity_id: input_boolean.school_today_ran
- id: 59ae3bfe-5c58-4ff4-aaf5-7b76fd0ac442
alias: Start of School Year
initial_state: true
trigger:
- platform: template
value_template: "{{ states('sensor.school_start_days2go') | int == 1 }}"
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.school_in_session
- id: 05ee0f8d-5411-4486-8acf-9bfadad2b23a
alias: End of School Year
initial_state: true
+47
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
+8 -164
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
+47 -8
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
+256 -468
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: ''