Implement new trackers for K

#205
This commit is contained in:
2024-08-04 14:36:25 -04:00
parent f61d79dee7
commit fc498ca23b
3 changed files with 369 additions and 253 deletions

View File

@ -4681,26 +4681,34 @@
mode: restart
- id: '1710611198911'
alias: Kallen Meds Handler
description: Make sure Kallen has taken his meds in the morning and at night
description: Handles the scheduling of medication reminders for Kallen
trigger:
- platform: time_pattern
minutes: /30
id: trigger30
alias: Every 30 minutes
- platform: time
at: input_datetime.kallen_morning_meds_notify
id: wakeup
id: morning-notify
alias: Morning Notify
- platform: time
at: input_datetime.kallen_night_meds_notify
id: sleep
id: night-notify
alias: Night Notify
- platform: state
entity_id: input_boolean.kallen_morning_meds_taken
entity_id:
- input_boolean.kallen_morning_meds_taken
to: 'on'
id: boolean-morning
alias: Morning Taken
from: 'off'
- platform: state
entity_id: input_boolean.kallen_night_meds_taken
to: 'on'
entity_id:
- input_boolean.kallen_night_meds_taken
id: boolean-night
alias: Night Taken
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: input_boolean.kallen_overnight
@ -4709,90 +4717,133 @@
action:
- alias: Routing
choose:
- conditions:
- condition: trigger
id:
- trigger30
sequence:
- alias: Check morning reminder switch
if:
- condition: state
entity_id: input_boolean.kallen_morning_meds_reminder
state: 'on'
alias: Morning meds reminder needed
then:
- service: script.kallen_morning_meds
metadata: {}
data: {}
alias: Run morning meds notification script
- alias: Check night reminder switch
if:
- condition: state
entity_id: input_boolean.kallen_night_meds_reminder
state: 'on'
alias: Night meds reminder needed
then:
- service: script.kallen_night_meds
metadata: {}
data: {}
alias: Run night meds notification script
alias: Every 30 minutes
- conditions:
- condition: and
conditions:
- condition: trigger
id: wakeup
id: morning-notify
- condition: state
entity_id: input_boolean.kallen_morning_meds_taken
state: 'off'
alias: Morning Notify
sequence:
- service: counter.increment
- service: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: counter.kallen_morning_meds_reminder_count
alias: Increment counter
- service: script.turn_on
target:
entity_id: script.kallen_morning_meds
entity_id: input_boolean.kallen_morning_meds_reminder
alias: Activate morning reminders
- service: script.kallen_morning_meds
metadata: {}
data: {}
alias: Run morning meds script
alias: Run morning meds notification script
- conditions:
- condition: and
conditions:
- condition: trigger
id: sleep
id:
- night-notify
- condition: state
entity_id: input_boolean.kallen_night_meds_taken
state: 'off'
alias: Night Notify
sequence:
- alias: Increment counter
service: counter.increment
- alias: Activate night reminders
service: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: counter.kallen_night_meds_reminder_count
- service: script.turn_on
target:
entity_id: script.kallen_night_meds
entity_id: input_boolean.kallen_night_meds_reminder
- service: script.kallen_night_meds
metadata: {}
data: {}
alias: Run night meds script
alias: Run night meds notification script
- conditions:
- condition: trigger
id: boolean-morning
alias: Morning Taken
sequence:
- service: counter.reset
metadata: {}
data: {}
target:
entity_id: counter.kallen_morning_meds_reminder_count
alias: Reset counter
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.kallen_morning_meds_taken
data:
datetime: '{% from ''time.jinja'' import current_time %} {{ current_time(''datetime'',24)
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0)
}}
'
alias: Set time morning meds were taken
- service: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.kallen_morning_meds_reminder
alias: Deactivate morning reminders
- service: script.text_notify
metadata: {}
data:
type: alert
who: kallen
message: clear_notification
tag: kallen-left-meds
alias: Clear kallen-left-meds notification tag
- conditions:
- condition: trigger
id: boolean-night
alias: Night Taken
sequence:
- alias: Reset counter
service: counter.reset
metadata: {}
data: {}
target:
entity_id: counter.kallen_night_meds_reminder_count
- service: input_datetime.set_datetime
target:
entity_id: input_datetime.kallen_night_meds_taken
data:
datetime: '{% from ''time.jinja'' import current_time %} {{ current_time(''datetime'',24)
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0)
}}
'
alias: Set time night meds were taken
- alias: Deactivate night reminders
service: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.kallen_night_meds_reminder
- service: script.text_notify
metadata: {}
data:
type: alert
who: kallen
message: clear_notification
tag: kallen-left-meds
alias: Clear kallen-left-meds notification tag
mode: parallel
max: 4
max: 12
- id: '1711657679853'
alias: Basement Briefing
description: ''
@ -5760,3 +5811,172 @@
tag: tina-left-meds
mode: queued
max: 10
- id: '1722387020007'
alias: Kallen Meds Cleanup
description: Handles the setting/clearing of medication configs for Kallen
trigger:
- platform: state
entity_id:
- input_boolean.kallen_morning_meds_reminder
from: 'on'
to: 'off'
id: morning-reminders-off
alias: Morning reminders off
- alias: Night reminders off
platform: state
entity_id:
- input_boolean.kallen_night_meds_reminder
from: 'on'
to: 'off'
id: night-reminders-off
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: KALLEN_MORNING_MEDS_TAKEN
id: morning-taken
alias: Morning taken
- alias: Night taken
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: KALLEN_NIGHT_MEDS_TAKEN
id: night-taken
- alias: Morning skipped
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: KALLEN_MORNING_MEDS_SKIPPED
id: morning-skipped
- alias: Night skipped
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: KALLEN_NIGHT_MEDS_SKIPPED
id: night-skipped
- platform: state
entity_id:
- person.kallen_stork
from: home
id: left
alias: Left
condition: []
action:
- alias: Routing
choose:
- conditions:
- condition: trigger
id:
- morning-reminders-off
alias: Morning Reminders Off
sequence:
- service: counter.reset
metadata: {}
data: {}
target:
entity_id: counter.kallen_morning_meds_reminder_count
alias: Reset morning reminder count
- service: script.text_notify
data:
type: alert
who: kallen
message: clear_notification
tag: kallen-morning-meds
alias: Clear morning notification
- conditions:
- condition: trigger
id:
- night-reminders-off
alias: Night reminders off
sequence:
- alias: Reset night reminder count
service: counter.reset
metadata: {}
data: {}
target:
entity_id: counter.kallen_night_meds_reminder_count
- service: script.text_notify
data:
type: alert
who: kallen
message: clear_notification
tag: kallen-night-meds
alias: Clear night notification
- conditions:
- condition: trigger
id:
- morning-taken
alias: Morning taken
sequence:
- service: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: input_boolean.kallen_morning_meds_taken
alias: Turn on morning meds taken
- conditions:
- condition: trigger
id:
- night-taken
alias: Night taken
sequence:
- service: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: input_boolean.kallen_night_meds_taken
alias: Turn on night meds taken
- conditions:
- condition: trigger
id:
- morning-skipped
alias: Morning skipped
sequence:
- service: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.kallen_morning_meds_reminder
alias: Deactivate morning reminders
- conditions:
- condition: trigger
id:
- night-skipped
alias: Night skipped
sequence:
- service: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.kallen_night_meds_reminder
alias: Deactivate night reminders
- conditions:
- condition: trigger
id:
- left
alias: Left
sequence:
- alias: Send critical TTS notification if any meds aren't taken
if:
- alias: Check if any reminders are active
condition: or
conditions:
- condition: state
entity_id: input_boolean.kallen_morning_meds_reminder
state: 'on'
alias: Morning meds reminder active
- condition: state
entity_id: input_boolean.kallen_night_meds_reminder
state: ''
alias: Night meds reminder active
then:
- alias: Send critical TTS notification
service: script.text_notify
metadata: {}
data:
type: critical
who: kallen
title: EYYO
message: YOU FORGOT TO TAKE YOUR MEDS!!!!!
tag: kallen-left-meds
mode: queued
max: 10