Merge branch 'sleep-aware' into dev

#159
This commit is contained in:
2023-10-10 20:59:19 -04:00
5 changed files with 139 additions and 1 deletions

View File

@ -2874,6 +2874,78 @@
alias: TTS notification
alias: After wait completed
mode: single
- id: '1696884613752'
alias: Tony Sleep Handling
description: Awareness of when Tony is asleep or wakes up
trigger:
- platform: event
event_type: wakeup_event
event_data:
who: tony
type: alarm
context:
user_id:
- c3909d27048140729f002aaef0391775
alias: Any Alarm
id: wake-alarm
- platform: event
event_type: wakeup_event
event_data:
who: tony
type: wakeup
context:
user_id:
- c3909d27048140729f002aaef0391775
alias: Wakeup
id: wake-sched
- platform: zone
entity_id: person.tony_stork
zone: zone.home
event: leave
alias: Leave Home
id: wake-leave
- platform: conversation
command: Tony is awake
id: wake-sentence
alias: Sentence
- platform: state
entity_id:
- binary_sensor.tony_s_iphone_focus
from: 'on'
to: 'off'
for:
hours: 0
minutes: 0
seconds: 30
alias: Focus off
id: wake-focus
- platform: state
entity_id:
- binary_sensor.tony_desktop_on
from: 'off'
to: 'on'
alias: Computer
id: wake-computer
condition: []
action:
- variables:
trigger: '{{ trigger.id }}'
type: '{{ trigger.split(''-'')[0] }}'
reason: '{{ trigger.split(''-'')[1] }}'
alias: Define variables
- choose:
- conditions:
- condition: template
value_template: '{{ type == ''wake'' }}'
alias: Wakeup
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.tony_awake
alias: Set context that I am awake
alias: Routing
mode: restart
- id: '1696985389177'
alias: Master Bedroom Adaptive Resync
description: Deals with situations where the master bedroom lights should be adaptive

View File

@ -156,4 +156,13 @@ script:
manual_control: false
entity_id: switch.adaptive_lighting_master_bedroom
# TODO: Figure out which actions to move here, and which ones to keep in Node-RED
# TODO: Figure out which actions to move here, and which ones to keep in Node-RED
master_bedroom_wakeup_briefing:
alias: Master Bedroom Wakeup Briefing
mode: single
sequence:
- service: script.speech_engine
data:
who: "{{ who|default('master_bedroom') }}"
message: !include ../templates/speech/master_bedroom_wakeup.yaml

View File

@ -13,6 +13,9 @@ input_boolean:
tina_night_meds_taken:
name: Tina Night Meds Taken
icon: mdi:medication
tina_awake:
name: Tina Awake
icon: mdi:eye-check
input_datetime:
tina_workday_start:

View File

@ -16,6 +16,9 @@ input_boolean:
tony_custom_meds_taken_p1:
name: Tony Custom Meds Taken P1
icon: mdi:medication
tony_awake:
name: Tony Awake
icon: mdi:eye-check
input_datetime:
tony_streaming_start_time:

View File

@ -0,0 +1,51 @@
>
{# Master Bedroom Wakeup #}
{%- macro getReport() -%}
{% from 'speech.jinja' import greeting, today_is %}
{% from 'status.jinja' import tonyStatusReport, tinaStatusReport, kallenStatusReport, emmaStatusReport %}
{% from 'weather.jinja' import weatherReport %}
<p>
{{ greeting('date') }}
<p>
<p>
{{ today_is() }}
<p>
<p>
{{ weatherReport('alerts','tts','day') }}
{{ tonyStatusReport('full','tts') }}
{{ tinaStatusReport('full','tts') }}
{{ kallenStatusReport('full','tts') }}
{{ emmaStatusReport('full','tts') }}
</p>
<p>
Do not forget to set the living room thermostat to your desired daytime temperature!
</p>
<p>
{% if is_state('input_boolean.briefing_extras','on') %}
"And now we have the following extra information to pass along. {{ states('input_text.briefing_extras') }} "
{% endif %}
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}