587 lines
18 KiB
YAML
587 lines
18 KiB
YAML
# This file is for entities/automations that are specific to Kallen
|
|
|
|
input_boolean:
|
|
kallen_sleeping:
|
|
name: Kallen Sleeping
|
|
icon: mdi:sleep
|
|
kallen_computer_updates:
|
|
name: Kallen Computer Updates
|
|
icon: mdi:update
|
|
kallen_overnight:
|
|
name: Kallen Overnight
|
|
icon: mdi:weather-night
|
|
kallen_awake:
|
|
name: Kallen Awake
|
|
icon: mdi:eye-check
|
|
kallen_late_bedtime:
|
|
name: Kallen Late Bedtime
|
|
icon: mdi:weather-night
|
|
kallen_morning_meds_taken:
|
|
name: Kallen Morning Meds Taken
|
|
icon: mdi:medical-bag
|
|
kallen_night_meds_taken:
|
|
name: Kallen Night Meds Taken
|
|
icon: mdi:medical-bag
|
|
|
|
input_datetime:
|
|
kallen_bedtime:
|
|
name: Kallen Bedtime
|
|
has_date: false
|
|
has_time: true
|
|
icon: mdi:weather-night
|
|
kallen_wakeup_time:
|
|
name: Kallen Wake-up Time
|
|
has_date: false
|
|
has_time: true
|
|
icon: mdi:bell-alert
|
|
kallen_fan:
|
|
name: Kallen Fan
|
|
has_date: false
|
|
has_time: true
|
|
icon: mdi:fan-auto
|
|
kallen_morning_meds_taken:
|
|
name: Kallen Morning Meds Taken
|
|
has_date: true
|
|
has_time: true
|
|
icon: mdi:medical-bag
|
|
kallen_night_meds_taken:
|
|
name: Kallen Night Meds Taken
|
|
has_date: true
|
|
has_time: true
|
|
icon: mdi:medical-bag
|
|
kallen_morning_meds_notify:
|
|
name: Kallen Morning Meds Notify
|
|
has_date: false
|
|
has_time: true
|
|
icon: mdi:medical-bag
|
|
kallen_night_meds_notify:
|
|
name: Kallen Night Meds Notify
|
|
has_date: false
|
|
has_time: true
|
|
icon: mdi:medical-bag
|
|
|
|
automation:
|
|
- id: 67fbdb66-b94b-4351-86de-a388d601e93c
|
|
alias: Kallen Meds Handler
|
|
description: Make sure Kallen has taken his meds in the morning and at night
|
|
mode: restart
|
|
trigger:
|
|
- platform: time
|
|
at: input_datetime.kallen_morning_meds_notify
|
|
id: wakeup
|
|
- platform: time
|
|
at: input_datetime.kallen_night_meds_notify
|
|
id: sleep
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: and
|
|
conditions:
|
|
- condition: trigger
|
|
id: wakeup
|
|
- condition: state
|
|
entity_id: input_boolean.kallen_morning_meds_taken
|
|
state: 'off'
|
|
sequence:
|
|
- service: script.turn_on
|
|
target:
|
|
entity_id: script.kallen_morning_meds
|
|
- conditions:
|
|
- condition: and
|
|
conditions:
|
|
- condition: trigger
|
|
id: sleep
|
|
- condition: state
|
|
entity_id: input_boolean.kallen_night_meds_taken
|
|
state: 'off'
|
|
sequence:
|
|
- service: script.turn_on
|
|
target:
|
|
entity_id: script.kallen_night_meds
|
|
|
|
- id: 28609544-f768-4ef3-b859-50439e224e01
|
|
alias: Kallen Bedroom Handling
|
|
description: "For scheduled operations in Kallen's bedroom"
|
|
initial_state: true
|
|
mode: queued
|
|
max: 3
|
|
trigger:
|
|
- platform: time
|
|
at: input_datetime.kallen_bedtime
|
|
id: bedtime
|
|
- platform: time
|
|
at: input_datetime.kallen_wakeup_time
|
|
id: wakeup
|
|
- platform: time
|
|
at: input_datetime.kallen_fan
|
|
id: fan
|
|
condition:
|
|
- condition: state
|
|
entity_id: input_boolean.vacation_mode
|
|
state: 'off'
|
|
- condition: state
|
|
entity_id: input_boolean.kallen_overnight
|
|
state: 'off'
|
|
- condition: state
|
|
entity_id: person.kallen_stork
|
|
state: 'home'
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: bedtime
|
|
sequence:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.kallen_sleeping
|
|
- conditions:
|
|
- condition: trigger
|
|
id: wakeup
|
|
sequence:
|
|
- if:
|
|
- condition: state
|
|
entity_id: input_booolean.night_mode
|
|
state: 'on'
|
|
then:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.night_mode
|
|
- service: timer.cancel
|
|
target:
|
|
entity_id: timer.living_room_motion_timer
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.kallen_sleeping
|
|
- conditions:
|
|
- condition: trigger
|
|
id: fan
|
|
sequence:
|
|
- if:
|
|
- condition: template
|
|
value_template: "{{ states('input_datetime.kallen_fan') != states('input_datetime.kallen_bedtime') }}"
|
|
then:
|
|
- service: fan.turn_on
|
|
target:
|
|
entity_id: fan.kallen_bedroom_fan
|
|
|
|
- id: 4ae15672-31ea-4209-9079-3129423885a5
|
|
alias: "Kallen Sleeping"
|
|
description: "Handles the response to the Kallen Sleeping toggle"
|
|
initial_state: true
|
|
mode: restart
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_boolean.kallen_sleeping
|
|
from: 'off'
|
|
to: 'on'
|
|
id: sleep-on
|
|
- platform: state
|
|
entity_id: input_boolean.kallen_sleeping
|
|
from: 'on'
|
|
to: 'off'
|
|
id: sleep-off
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: sleep-on
|
|
sequence:
|
|
- service: script.kallen_sleep
|
|
- conditions:
|
|
- condition: trigger
|
|
id: sleep-off
|
|
sequence:
|
|
- service: script.kallen_wakeup
|
|
|
|
- id: 1d552b1f-c0ed-4d80-b8ba-3c085d2c3d3a
|
|
alias: "Kallen Late Bedtime"
|
|
description: "For those nights we want to let Kallen stay up later for whatever reason"
|
|
mode: restart
|
|
trigger:
|
|
- platform: state
|
|
entity_id: input_boolean.kallen_late_bedtime
|
|
from: 'off'
|
|
to: 'on'
|
|
id: late-on
|
|
- platform: state
|
|
entity_id: input_boolean.kallen_late_bedtime
|
|
from: 'on'
|
|
to: 'off'
|
|
id: late-off
|
|
condition:
|
|
- condition: time
|
|
after: input_datetime.kallen_wakeup_time
|
|
before: input_datetime.kallen_bedtime
|
|
action:
|
|
- if:
|
|
- condition: state
|
|
entity_id: input_boolean.kallen_scheduling_evening_ran
|
|
state: 'on'
|
|
then:
|
|
- service: script.kallen_scheduling_evening
|
|
- service: script.house_scheduling_evening
|
|
|
|
script:
|
|
kallen_morning_meds:
|
|
alias: 'Kallen Morning Meds'
|
|
icon: mdi:medical-bag
|
|
mode: restart
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.kallen_morning_meds_taken
|
|
- 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:30:00"
|
|
continue_on_timeout: true
|
|
- choose:
|
|
- conditions: "{{ wait.trigger.id in ['taken','manual'] }}"
|
|
sequence:
|
|
- service: input_datetime.set_datetime
|
|
target:
|
|
entity_id: input_datetime.kallen_morning_meds_taken
|
|
data:
|
|
datetime: >
|
|
{% from 'time.jinja' import set_datetime %}
|
|
{{ set_datetime (0) }}
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.kallen_morning_meds_taken
|
|
- service: logbook.log
|
|
data:
|
|
name: Kallen Morning Meds
|
|
message: Taken
|
|
entity_id: input_boolean.kallen_morning_meds_taken
|
|
domain: input_boolean
|
|
- conditions: "{{ wait.trigger.id == 'skipped' }}"
|
|
sequence:
|
|
- service: logbook.log
|
|
data:
|
|
name: Kallen Morning Meds
|
|
message: Skipped
|
|
entity_id: input_boolean.kallen_morning_meds_taken
|
|
domain: input_boolean
|
|
- conditions: "{{ 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) }}
|
|
- service: logbook.log
|
|
data:
|
|
name: Kallen Morning Meds
|
|
message: Delayed for 5 minutes
|
|
entity_id: input_boolean.kallen_morning_meds_taken
|
|
domain: input_boolean
|
|
- conditions: "{{ wait.trigger.id == 'left' or wait.trigger == 'none' }}"
|
|
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: logbook.log
|
|
data:
|
|
name: Kallen Morning Meds
|
|
message: No response, delayed for 1 minute
|
|
entity_id: input_boolean.kallen_morning_meds_taken
|
|
domain: input_boolean
|
|
else:
|
|
- service: logbook.log
|
|
data:
|
|
name: Kallen Morning Meds
|
|
message: No response, Kallen has left home, cancelled.
|
|
entity_id: input_boolean.kallen_morning_meds_taken
|
|
domain: input_boolean
|
|
- 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
|
|
|
|
kallen_night_meds:
|
|
alias: 'Kallen Night Meds'
|
|
icon: mdi:medical-bag
|
|
mode: restart
|
|
sequence:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.kallen_night_meds_taken
|
|
- 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
|
|
- 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:30:00"
|
|
continue_on_timeout: true
|
|
- choose:
|
|
- conditions: "{{ wait.trigger.id in ['taken','manual'] }}"
|
|
sequence:
|
|
- service: input_datetime.set_datetime
|
|
target:
|
|
entity_id: input_datetime.kallen_night_meds_taken
|
|
data:
|
|
datetime: >
|
|
{% from 'time.jinja' import set_datetime %}
|
|
{{ set_datetime (0) }}
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.kallen_night_meds_taken
|
|
- service: logbook.log
|
|
data:
|
|
name: Kallen Night Meds
|
|
message: have been taken
|
|
entity_id: input_boolean.kallen_night_meds_taken
|
|
domain: input_boolean
|
|
- conditions: "{{ wait.trigger.id == 'skipped' }}"
|
|
sequence:
|
|
- service: logbook.log
|
|
data:
|
|
name: Kallen Night Meds
|
|
message: have been skipped
|
|
entity_id: input_boolean.kallen_night_meds_taken
|
|
domain: input_boolean
|
|
- conditions: "{{ 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) }}
|
|
- service: logbook.log
|
|
data:
|
|
name: Kallen Night Meds
|
|
message: Delayed for 15 minutes
|
|
entity_id: input_boolean.kallen_night_meds_taken
|
|
domain: input_boolean
|
|
- conditions: "{{ wait.trigger == 'none' }}"
|
|
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: logbook.log
|
|
data:
|
|
name: Kallen Night Meds
|
|
message: No response, delayed for 1 minute
|
|
entity_id: input_boolean.kallen_night_meds_taken
|
|
domain: input_boolean
|
|
- service: script.text_notify
|
|
data:
|
|
type: alert
|
|
who: kallen
|
|
message: clear_notification
|
|
tag: kallen-night-meds
|
|
|
|
kallen_sleep:
|
|
alias: 'Kallen Sleep'
|
|
icon: mdi:lightbulb-night
|
|
mode: restart
|
|
sequence:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: light.kallen_bedroom_lights
|
|
- service: media_player.volume_set
|
|
target:
|
|
entity_id: media_player.kallen_bedroom_speaker
|
|
data:
|
|
volume_level: "{{ states('input_number.kallen_bedroom_google_speaker_night_volume') }}"
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.scheduled_climate_mode_kallen_fan
|
|
state: 'White Noise'
|
|
sequence:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.white_noise_kallen_bedroom
|
|
- if:
|
|
- condition: template
|
|
value_template: >
|
|
{% from 'time.jinja' import ct %}
|
|
{% set ct = ct() | int %}
|
|
{{ ct >= state_attr('input_datetime.kallen_bedtime','timestamp') }}
|
|
then:
|
|
- service: script.speech_engine
|
|
data:
|
|
who: everywhere
|
|
type: normal
|
|
voice: Joanna
|
|
message: >
|
|
{{ [
|
|
"No fan in Collin's room tonight. Too cold outside. Brr. Enjoy your white noise. ",
|
|
"It is a little too cold for a fan tonight. I will play white noise for Collin. ",
|
|
"Collin will not need any help staying cool tonight. I will play white noise instead. ",
|
|
"My sources are telling me that it is not fan weather tonight. White noise it is. "
|
|
] | random }} Goodnight!
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_select.scheduled_climate_mode_kallen_fan
|
|
state: 'Fan'
|
|
sequence:
|
|
- service: fan.turn_on
|
|
target:
|
|
entity_id: fan.kallen_bedroom_fan
|
|
- if:
|
|
- condition: template
|
|
value_template: >
|
|
{% from 'time.jinja' import ct %}
|
|
{% set ct = ct() | int %}
|
|
{{ ct >= state_attr('input_datetime.kallen_bedtime','timestamp') }}
|
|
then:
|
|
- service: script.speech_engine
|
|
data:
|
|
who: everywhere
|
|
type: normal
|
|
voice: Joanna
|
|
message: >
|
|
{{ [
|
|
"Collin's fan is now on. Stay cool! ",
|
|
"It is rather warm outside, so I am turning on Collin's fan. ",
|
|
"To prevent an ocean of sweat from drowning us all, I have enabled Collin's fan. ",
|
|
"My sensors indicate that for optimal comfort, a cooling device is needed for Collin tonight. ",
|
|
"I am a fan of Collin. So I have turned on a fan for Collin. "
|
|
] | random }} Goodnight!
|
|
default:
|
|
- if:
|
|
- condition: template
|
|
value_template: >
|
|
{% from 'time.jinja' import ct %}
|
|
{% set ct = ct() | int %}
|
|
{{ ct >= state_attr('input_datetime.kallen_bedtime','timestamp') }}
|
|
then:
|
|
- service: script.speech_engine
|
|
data:
|
|
who: everywhere
|
|
type: normal
|
|
voice: Joanna
|
|
message: >
|
|
{{ [
|
|
"Lights are now on in Collin's bedroom. ",
|
|
"Collin, your bedroom lights are now on. "
|
|
] | random }} Goodnight!
|
|
|
|
kallen_wakeup:
|
|
alias: 'Kallen Wakeup'
|
|
icon: mdi:weather-sunset-up
|
|
mode: restart
|
|
sequence:
|
|
- service: fan.turn_off
|
|
target:
|
|
entity_id: fan.kallen_bedroom_fan
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.white_noise_kallen_bedroom
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.kallen_school_today
|
|
state: 'on'
|
|
sequence:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id:
|
|
- light.kallen_bedroom_lights
|
|
- light.living_room_lights
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.kallen_school_today
|
|
state: 'off'
|
|
sequence:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.kallen_awake |