Compare commits
24 Commits
2025.5.1
...
150c0cec8a
| Author | SHA1 | Date | |
|---|---|---|---|
|
150c0cec8a
|
|||
|
734b39f88b
|
|||
|
e13d3879c6
|
|||
|
67086b340c
|
|||
|
c7456cad29
|
|||
|
3fc4e91b68
|
|||
|
bcfc6405ce
|
|||
|
1028f2d053
|
|||
|
e40785a382
|
|||
|
d88f89475b
|
|||
|
4b3cfbc1df
|
|||
|
1d537036c4
|
|||
|
f3b17dfd5e
|
|||
|
95d0a20e3d
|
|||
|
3eb5f3a7cc
|
|||
|
6ee087ab56
|
|||
|
476cbac212
|
|||
|
c8671a1b38
|
|||
|
b7424a0d74
|
|||
|
7ea640c947
|
|||
|
404adcb60a
|
|||
|
3543e43672
|
|||
|
29b310fe5b
|
|||
|
cc69a937eb
|
1127
automations.yaml
1127
automations.yaml
File diff suppressed because it is too large
Load Diff
@@ -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%}
|
||||
|
||||
@@ -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') }}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -984,7 +984,33 @@ script:
|
||||
- critical
|
||||
variables:
|
||||
voice: "{{ states('input_select.jarvis_voice') }}"
|
||||
groupname: >-
|
||||
{% if who == 'kids_bedrooms' %}
|
||||
kids_bedroom_speakers
|
||||
{% elif who == 'all_bedrooms' %}
|
||||
all_bedroom_speakers
|
||||
{% elif who == 'basement' and is_state('input_boolean.studio_quiet','on') %}
|
||||
alexa_no_basement
|
||||
{% else %}
|
||||
{{ who }}
|
||||
{% endif %}
|
||||
sequence:
|
||||
- service: script.get_room_speakers
|
||||
data:
|
||||
room: "{{ who }}"
|
||||
response_variable: "get_room_speakers"
|
||||
- choose:
|
||||
- conditions: "{{ who in ['everywhere','Everywhere'] }}"
|
||||
sequence:
|
||||
- service: script.get_all_speakers
|
||||
response_variable: "get_all_speakers"
|
||||
- conditions: "{{ get_room_speakers.jarvis_tts == 'group' }}"
|
||||
sequence:
|
||||
- service: script.get_group_speakers
|
||||
data:
|
||||
group: "{{ who }}"
|
||||
response_variable: "get_group_speakers"
|
||||
# Need to figure out whether to do this part here, or in alexa/jarvis voice scripts, or both
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: 'house/polly/lastmsg'
|
||||
@@ -1028,44 +1054,13 @@ script:
|
||||
- service: >-
|
||||
{% if voice == 'nabu' %}
|
||||
script.nabu_voice
|
||||
{% elif who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room','Living Room Echo Dot','Living Room'] %}
|
||||
script.alexa_voice
|
||||
{% elif who in ['kallen_bedroom','Kallen Bedroom'] %}
|
||||
{% if is_state('input_boolean.kallen_sleeping','on') and type not in ['critical','Critical'] %}
|
||||
script.alexa_voice
|
||||
{% else %}
|
||||
script.jarvis_voice
|
||||
{% endif %}
|
||||
{% elif who in ['emma_bedroom','Emma Bedroom'] %}
|
||||
{% if is_state('input_boolean.emma_sleeping','on') and type not in ['critical','Critical'] %}
|
||||
script.alexa_voice
|
||||
{% else %}
|
||||
script.jarvis_voice
|
||||
{% endif %}
|
||||
{% elif who in ['master_bedroom','master_bedroom_echo_dot','media_player.master_bedroom_echo_dot','Master Bedroom Echo Dot','Master Bedroom'] %}
|
||||
script.alexa_voice
|
||||
{% elif who in ['kids_bedrooms','Kids Bedrooms'] %}
|
||||
script.jarvis_voice
|
||||
{% elif who in ['all_bedrooms','All Bedrooms'] %}
|
||||
script.alexa_voice
|
||||
{% elif who in ['Basement','basement','basement_echo_dot','media_player.basement_echo_dot','Basement Echo Dot'] %}
|
||||
script.alexa_voice
|
||||
{% elif who in ['Basement Google','basement_google'] %}
|
||||
{% if is_state('input_boolean.studio_quiet','on') %}
|
||||
script.alexa_voice
|
||||
{% else %}
|
||||
script.jarvis_voice
|
||||
{% endif %}
|
||||
{% elif who in ['Common Areas','common','common_areas'] %}
|
||||
script.alexa_voice
|
||||
{% elif who in ['alexa_everywhere','Alexa Everywhere'] %}
|
||||
script.alexa_voice
|
||||
{% elif who in ['Everywhere','everywhere'] %}
|
||||
{% elif get_room_services.jarvis_tts in ['group','alexa'] %}
|
||||
script.alexa_voice
|
||||
{% else %}
|
||||
script.alexa_voice
|
||||
script.jarvis_voice
|
||||
{% endif %}
|
||||
data:
|
||||
# Work on where this redirect logic should go
|
||||
who: >
|
||||
{% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room','Living Room Echo Dot','Living Room'] %}
|
||||
living_room
|
||||
@@ -1142,7 +1137,7 @@ script:
|
||||
type: '{{ type }}'
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ who in ['Everywhere','everywhere','all_bedrooms','All Bedrooms','kids_bedrooms','Kids Bedrooms'] }}"
|
||||
value_template: "{{ get_room_speakers.jarvis_tts == 'group' and get_group_speakers.google is defined }}"
|
||||
then:
|
||||
- service: script.jarvis_voice
|
||||
data:
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
126
packages/variables.yaml
Normal file
126
packages/variables.yaml
Normal file
@@ -0,0 +1,126 @@
|
||||
script:
|
||||
get_room_speakers:
|
||||
alias: Get Room Speakers
|
||||
sequence:
|
||||
- variables:
|
||||
room_services: >-
|
||||
{% if room in areas() %}
|
||||
{% set alexa_speaker = states.media_player |
|
||||
selectattr('entity_id', 'in', area_entities(room)) |
|
||||
rejectattr('attributes.last_called', 'undefined') |
|
||||
selectattr('entity_id', 'search', 'echo_dot') |
|
||||
map(attribute='entity_id') |
|
||||
list | first %}
|
||||
|
||||
{% set google_speaker = states.media_player |
|
||||
selectattr('entity_id', 'in', area_entities(room)) |
|
||||
rejectattr('attributes.device_class', 'undefined') |
|
||||
selectattr('attributes.device_class', 'search', '(speaker)') |
|
||||
selectattr('entity_id', 'search', 'google') |
|
||||
map(attribute='entity_id') |
|
||||
list | first %}
|
||||
|
||||
{% set tts = "alexa" if alexa_speaker is defined else "google" %}
|
||||
{% else %}
|
||||
{% set tts = "group" %}
|
||||
{% endif %}
|
||||
{"area":"{{room}}","alexa_speaker":"{{alexa_speaker|default({}) }}","jarvis_tts":"{{tts|default("google") }}","google_speaker":"{{google_speaker|default({}) }}"}
|
||||
- stop: "Services acquired"
|
||||
response_variable: "get_room_speakers"
|
||||
|
||||
get_group_speakers:
|
||||
alias: Get Group Speakers
|
||||
sequence:
|
||||
- variables:
|
||||
get_group_speakers: >-
|
||||
{% set speakers = expand('group.' + group) | map(attribute='entity_id') | list | join(',') %}
|
||||
{% set alexa_speakers = expand('group.' + group) |
|
||||
rejectattr('attributes.last_called', 'undefined') |
|
||||
selectattr('entity_id', 'search', 'echo_dot') |
|
||||
map(attribute='entity_id') |
|
||||
list | join(',') %}
|
||||
{% set google_speakers = expand('group.' + group) |
|
||||
rejectattr('attributes.device_class', 'undefined') |
|
||||
selectattr('attributes.device_class', 'search', '(speaker)') |
|
||||
selectattr('entity_id', 'search', 'google') |
|
||||
map(attribute='entity_id') |
|
||||
list | join(',') %}
|
||||
{"alexa":"{{alexa_speakers|default({})}}","google":"{{google_speakers|default({})}}"}
|
||||
- stop: "Speakers acquired"
|
||||
response_variable: "get_group_speakers"
|
||||
|
||||
get_echo_dots:
|
||||
alias: Get Echo Dots
|
||||
sequence:
|
||||
- variables:
|
||||
get_echo_dots: >-
|
||||
{% if group is defined %}
|
||||
{% set speakers = expand('group.' + group) %}
|
||||
{% else %}
|
||||
{% set speakers = states.media_player %}
|
||||
{% endif %}
|
||||
{% set echo_dots = speakers |
|
||||
rejectattr('attributes.last_called', 'undefined') |
|
||||
selectattr('entity_id', 'search', 'echo_dot') |
|
||||
map(attribute='entity_id') |
|
||||
list | join(',') %}
|
||||
{"speakers":"{{echo_dots}}"}
|
||||
- stop: "Echo Dots acquired"
|
||||
response_variable: "get_echo_dots"
|
||||
|
||||
get_google_speakers:
|
||||
alias: Get Google Speakers
|
||||
sequnce:
|
||||
- variables:
|
||||
get_google_speakers: >-
|
||||
{% if group is defined %}
|
||||
{% set speakers = expand('group.' + group) %}
|
||||
{% else %}
|
||||
{% set speakers = states.media_player %}
|
||||
{% endif %}
|
||||
{% set google_speaker = speakers |
|
||||
rejectattr('attributes.device_class', 'undefined') |
|
||||
selectattr('attributes.device_class', 'search', '(speaker)') |
|
||||
selectattr('entity_id', 'search', 'google') |
|
||||
map(attribute='entity_id') |
|
||||
list | join(',') %}
|
||||
{"speakers":"{{google_speaker}}"}
|
||||
- stop: "Google speakers acquired"
|
||||
response_variable: "get_google_speakers"
|
||||
|
||||
get_all_speakers:
|
||||
alias: Get All Speakers
|
||||
sequence:
|
||||
- variables: >-
|
||||
get_speakers:
|
||||
{% set alexa_speaker = states.media_player |
|
||||
rejectattr('attributes.last_called', 'undefined') |
|
||||
selectattr('entity_id', 'search', 'echo_dot') |
|
||||
map(attribute='entity_id')
|
||||
%}
|
||||
|
||||
{% set google_speaker = states.media_player |
|
||||
rejectattr('attributes.device_class', 'undefined') |
|
||||
selectattr('attributes.device_class', 'search', '(speaker)') |
|
||||
selectattr('entity_id', 'search', 'google') |
|
||||
map(attribute='entity_id')
|
||||
%}
|
||||
{% set alexa_list = alexa_speaker | list | join(',') %}
|
||||
{% set google_list = google_speaker | list | join(',') %}
|
||||
{% set all_speakers = alexa_list + ',' + google_list %}
|
||||
{"all_speakers":"{{all_speakers}}"}
|
||||
|
||||
get_room_lights:
|
||||
alias: Get Room Lights
|
||||
sequence:
|
||||
- variables:
|
||||
area: >
|
||||
{{ room }}
|
||||
entities: >
|
||||
{% set lights = states.light |
|
||||
selectattr('entity_id', 'in', area_entities(area)) |
|
||||
map(attribute='entity_id') |
|
||||
list | join(',') %}
|
||||
{"lights":"{{lights}}"}
|
||||
- stop: "Lights acquired"
|
||||
response_variable: "entities"
|
||||
724
scripts.yaml
724
scripts.yaml
@@ -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: ''
|
||||
|
||||
Reference in New Issue
Block a user