Compare commits

...

19 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
faef1d02b2 Add bug report issue template
(cherry picked from commit 94cbb81be1)
2024-08-08 22:29:56 -04:00
10 changed files with 1414 additions and 777 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -152,4 +152,6 @@
{{ cleanup(data()) }} {{ cleanup(data()) }}
{% endmacro %} {% 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 %} {% endif %}
{% endmacro %} {% 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) %} {% macro set_datetime(hours,minutes,seconds) %}
{% if seconds is defined %} {% if seconds is defined %}
{{ (as_timestamp(now()) + (((hours * 60) * 60) + (minutes * 60)) + seconds) | int | timestamp_custom('%Y-%m-%d %H:%M:%S') }} {{ (as_timestamp(now()) + (((hours * 60) * 60) + (minutes * 60)) + seconds) | int | timestamp_custom('%Y-%m-%d %H:%M:%S') }}

View File

@@ -0,0 +1,22 @@
name: Bug Report
about: Report a bug that you have found
title: "[Bug]: "
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: markdown
attributes:
value: |
This issue was created by an issue **template**
visible: [content]
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also, what were you expecting to happen?
placeholder: Tell me what you saw!
value: "A bug happened!"
validations:
required: true

View File

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

View File

@@ -164,7 +164,7 @@ script:
time: > time: >
{% from 'time.jinja' import time_from_calendar %} {% from 'time.jinja' import time_from_calendar %}
{% if is_state('input_boolean.two_hour_delay','on') %} {% if is_state('input_boolean.two_hour_delay','on') %}
10:00 {{ time_from_calendar('calendar.kallen_school_days','start_time','set','add',2)}}
{% else %} {% else %}
{{ time_from_calendar('calendar.kallen_school_days','start_time','set') }} {{ time_from_calendar('calendar.kallen_school_days','start_time','set') }}
{% endif %} {% endif %}
@@ -587,8 +587,9 @@ script:
entity_id: input_datetime.tina_morning_meds_notify entity_id: input_datetime.tina_morning_meds_notify
data: data:
time: > time: >
{% from 'time.jinja' import datetime_from_calendar %}
{% if is_state('input_boolean.work_today','on') %} {% 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 %} {% else %}
{{ states('input_datetime.master_bedroom_wakeup') }} {{ states('input_datetime.master_bedroom_wakeup') }}
{% endif %} {% endif %}

View File

@@ -3,6 +3,53 @@ input_boolean:
name: Sports Updates name: Sports Updates
icon: mdi:strategy 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: template:
- binary_sensor: - binary_sensor:
- name: Michigan Wolverines Inhibit - name: Michigan Wolverines Inhibit

View File

@@ -7,9 +7,15 @@ input_boolean:
work_today_extended: work_today_extended:
name: Work Today Extended name: Work Today Extended
icon: mdi:briefcase-plus icon: mdi:briefcase-plus
tina_morning_meds_reminder:
name: Tina Morning Meds Reminder
icon: mdi:medication
tina_morning_meds_taken: tina_morning_meds_taken:
name: Tina Morning Meds Taken name: Tina Morning Meds Taken
icon: mdi:medication icon: mdi:medication
tina_night_meds_reminder:
name: Tina Night Meds Reminder
icon: mdi:medication
tina_night_meds_taken: tina_night_meds_taken:
name: Tina Night Meds Taken name: Tina Night Meds Taken
icon: mdi:medication icon: mdi:medication
@@ -35,7 +41,7 @@ input_datetime:
icon: mdi:medication icon: mdi:medication
tina_morning_meds_notify: tina_morning_meds_notify:
name: Tina Morning Meds Notify name: Tina Morning Meds Notify
has_date: false has_date: true
has_time: true has_time: true
icon: mdi:medication icon: mdi:medication
tina_night_meds_taken: tina_night_meds_taken:
@@ -45,7 +51,7 @@ input_datetime:
icon: mdi:medication icon: mdi:medication
tina_night_meds_notify: tina_night_meds_notify:
name: Tina Night Meds Notify name: Tina Night Meds Notify
has_date: false has_date: true
has_time: true has_time: true
icon: mdi:medication icon: mdi:medication
@@ -191,165 +197,3 @@ script:
- service: script.master_bedroom_scheduling_evening - service: script.master_bedroom_scheduling_evening
- service: script.emma_bedroom_scheduling_evening - service: script.emma_bedroom_scheduling_evening
- service: script.security_scheduling - 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: tony_streaming_today:
name: Tony Streaming Today name: Tony Streaming Today
icon: mdi:twitch icon: mdi:twitch
tony_morning_meds_reminder:
name: Tony Morning Meds Reminder
icon: mdi:medication
tony_morning_meds_taken: tony_morning_meds_taken:
name: Tony Morning Meds Taken name: Tony Morning Meds Taken
icon: mdi:medication icon: mdi:medication
tony_afternoon_meds_reminder:
name: Tony Afternoon Meds Reminder
icon: mdi:medication
tony_afternoon_meds_taken: tony_afternoon_meds_taken:
name: Tony Afternoon Meds Taken name: Tony Afternoon Meds Taken
icon: mdi:medication icon: mdi:medication
tony_night_meds_reminder:
name: Tony Night Meds Reminder
icon: mdi:medication
tony_night_meds_taken: tony_night_meds_taken:
name: Tony Night Meds Taken name: Tony Night Meds Taken
icon: mdi:medication icon: mdi:medication
@@ -64,17 +73,17 @@ input_datetime:
icon: mdi:medication icon: mdi:medication
tony_morning_meds_notify: tony_morning_meds_notify:
name: Tony Morning Meds Notify name: Tony Morning Meds Notify
has_date: false has_date: true
has_time: true has_time: true
icon: mdi:medication icon: mdi:medication
tony_afternoon_meds_notify: tony_afternoon_meds_notify:
name: Tony Afternoon Meds Notify name: Tony Afternoon Meds Notify
has_date: false has_date: true
has_time: true has_time: true
icon: mdi:medication icon: mdi:medication
tony_night_meds_notify: tony_night_meds_notify:
name: Tony Night Meds Notify name: Tony Night Meds Notify
has_date: false has_date: true
has_time: true has_time: true
icon: mdi:medication icon: mdi:medication
tony_custom_meds_taken_p1: tony_custom_meds_taken_p1:
@@ -84,7 +93,7 @@ input_datetime:
icon: mdi:medication icon: mdi:medication
tony_custom_meds_notify_p1: tony_custom_meds_notify_p1:
name: Tony Custom Meds Notify P1 name: Tony Custom Meds Notify P1
has_date: false has_date: true
has_time: true has_time: true
icon: mdi:medication icon: mdi:medication
tony_custom_meds_taken_p2: tony_custom_meds_taken_p2:
@@ -94,7 +103,7 @@ input_datetime:
icon: mdi:medication icon: mdi:medication
tony_custom_meds_notify_p2: tony_custom_meds_notify_p2:
name: Tony Custom Meds Notify P2 name: Tony Custom Meds Notify P2
has_date: false has_date: true
has_time: true has_time: true
icon: mdi:medication icon: mdi:medication
tony_ibuprofen_taken: tony_ibuprofen_taken:
@@ -104,7 +113,7 @@ input_datetime:
icon: mdi:medication icon: mdi:medication
tony_ibuprofen_notify: tony_ibuprofen_notify:
name: Tony Ibuprofen Notify name: Tony Ibuprofen Notify
has_date: false has_date: true
has_time: true has_time: true
icon: mdi:medication icon: mdi:medication
tony_tylenol_taken: tony_tylenol_taken:
@@ -114,7 +123,7 @@ input_datetime:
icon: mdi:medication icon: mdi:medication
tony_tylenol_notify: tony_tylenol_notify:
name: Tony Tylenol Notify name: Tony Tylenol Notify
has_date: false has_date: true
has_time: true has_time: true
icon: mdi:medication icon: mdi:medication
@@ -178,4 +187,34 @@ sensor:
json_attributes: json_attributes:
- project - project
- items - 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 icon: mdi:medication
mode: restart mode: restart
sequence: sequence:
- parallel: - service: counter.increment
- if: metadata: {}
- condition: numeric_state data: {}
entity_id: counter.tony_morning_meds_reminder_count target:
above: 2 entity_id: counter.tony_morning_meds_reminder_count
then: alias: Increment morning reminder counter
- service: script.speech_engine - service: script.text_notify
data: data:
who: common_areas type: alert
type: alert who: tony
message: Tony, you need to take your morning meds. This is reminder number message: clear_notification
{{ states('counter.tony_morning_meds_reminder_count') }} for today. tag: tony-morning-meds
- service: script.text_notify 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: data:
who: tony who: tony
type: alert type: alert
@@ -1671,99 +1680,45 @@ 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
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
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: counter.increment
metadata: {}
data: {}
target:
entity_id: counter.tony_night_meds_reminder_count
alias: Increment night reminder counter
- service: script.text_notify - 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: data:
who: tony who: tony
type: alert type: alert
@@ -1775,87 +1730,6 @@ tony_night_meds:
title: Taken title: Taken
- action: TONY_NIGHT_MEDS_SKIPPED - action: TONY_NIGHT_MEDS_SKIPPED
title: Skip 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: tony_stream_today:
alias: Tony Stream Today alias: Tony Stream Today
sequence: sequence:
@@ -2004,20 +1878,31 @@ 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: counter.increment
- if: metadata: {}
- condition: numeric_state data: {}
entity_id: counter.tony_afternoon_meds_reminder_count target:
above: 2 entity_id: counter.tony_afternoon_meds_reminder_count
then: alias: Increment afternoon reminder counter
- service: script.speech_engine - service: script.text_notify
data: data:
who: common_areas type: alert
type: alert who: tony
message: Tony, you need to take your afternoon meds. This is reminder number message: clear_notification
{{ states('counter.tony_afternoon_meds_reminder_count') }} for today. tag: tony-afternoon-meds
- service: script.text_notify 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: data:
who: tony who: tony
type: alert type: alert
@@ -2029,97 +1914,20 @@ 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
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
tony_ibuprofen: tony_ibuprofen:
alias: Tony Ibuprofen alias: Tony Ibuprofen
sequence: sequence:
@@ -2480,203 +2288,109 @@ tony_tylenol:
mode: queued mode: queued
icon: mdi:medication icon: mdi:medication
max: 10 max: 10
'1710612011154': kallen_morning_meds:
alias: Kallen Morning Meds alias: Kallen Morning Meds
sequence: sequence:
- service: script.text_notify - service: counter.increment
data: metadata: {}
who: kallen data: {}
type: alert target:
title: Morning Meds entity_id: counter.kallen_morning_meds_reminder_count
message: You need to take your morning meds. Go to mom or dad to confirm. alias: Increment morning reminder counter
tag: kallen-morning-meds-self - alias: Clear previous morning notifications
- service: script.text_notify parallel:
data: - service: script.text_notify
who: parents data:
type: alert type: alert
title: Morning Meds who: parents
message: Kallen needs to take his morning meds message: clear_notification
tag: kallen-morning-meds-parents tag: kallen-morning-meds-parents
actions: alias: Clear for parents
- action: KALLEN_MORNING_MEDS_TAKEN - service: script.text_notify
title: Taken data:
- action: KALLEN_MORNING_MEDS_SKIPPED type: alert
title: Skip who: kallen
- action: KALLEN_MORNING_MEDS_ASK_LATER message: clear_notification
title: Ask Later tag: kallen-morning-meds-self
- wait_for_trigger: alias: Clear for Kallen
- platform: event - delay:
event_type: ios.notification_action_fired hours: 0
event_data: minutes: 0
actionName: KALLEN_MORNING_MEDS_TAKEN seconds: 5
id: taken milliseconds: 0
- platform: event - alias: Send text notifications
event_type: ios.notification_action_fired parallel:
event_data: - alias: Send to parents
actionName: KALLEN_MORNING_MEDS_SKIPPED service: script.text_notify
id: skipped data:
- platform: event who: parents
event_type: ios.notification_action_fired type: alert
event_data: title: Morning Meds
actionName: KALLEN_MORNING_MEDS_ASK_LATER message: Kallen needs to take his morning meds
id: ask-later tag: kallen-morning-meds-parents
- platform: state actions:
entity_id: person.kallen_stork - action: KALLEN_MORNING_MEDS_TAKEN
from: home title: Taken
id: left - action: KALLEN_MORNING_MEDS_SKIPPED
- platform: state title: Skip
entity_id: input_boolean.kallen_morning_meds_taken - service: script.text_notify
to: 'on' data:
id: manual who: kallen
timeout: 00:10:00 type: alert
continue_on_timeout: true title: Morning Meds
- choose: message: You need to take your morning meds. Go to mom or dad to confirm.
- conditions: tag: kallen-morning-meds-self
- condition: template alias: Send to Kallen
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
icon: mdi:medication icon: mdi:medication
mode: restart mode: restart
'1710612164315': kallen_night_meds:
alias: Kallen Night Meds alias: Kallen Night Meds
sequence: sequence:
- service: script.text_notify - service: counter.increment
data: metadata: {}
who: kallen data: {}
type: alert alias: Increment night reminder counter
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: script.text_notify - service: script.text_notify
data: data:
type: alert type: alert
who: all who: all
message: clear_notification message: clear_notification
tag: kallen-night-meds 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 icon: mdi:medication
mode: restart mode: restart
reset_annc_switches: reset_annc_switches:
@@ -3260,3 +2974,77 @@ emma_sleep:
alias: Turn on white noise alias: Turn on white noise
icon: mdi:lightbulb-night icon: mdi:lightbulb-night
mode: restart 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: ''