diff --git a/automations.yaml b/automations.yaml index 4c65632..a4415d1 100644 --- a/automations.yaml +++ b/automations.yaml @@ -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 diff --git a/packages/master_bedroom.yaml b/packages/master_bedroom.yaml index a19aeaf..e0dce40 100644 --- a/packages/master_bedroom.yaml +++ b/packages/master_bedroom.yaml @@ -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 \ No newline at end of file +# 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 \ No newline at end of file diff --git a/packages/tina.yaml b/packages/tina.yaml index 4d01d92..d47ceac 100644 --- a/packages/tina.yaml +++ b/packages/tina.yaml @@ -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: diff --git a/packages/tony.yaml b/packages/tony.yaml index 52cb8e2..341bc1d 100644 --- a/packages/tony.yaml +++ b/packages/tony.yaml @@ -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: diff --git a/templates/speech/master_bedroom_wakeup.yaml b/templates/speech/master_bedroom_wakeup.yaml new file mode 100644 index 0000000..a55489e --- /dev/null +++ b/templates/speech/master_bedroom_wakeup.yaml @@ -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 %} +
+ {{ greeting('date') }} +
+ +
+ {{ today_is() }} +
+ +
+ {{ weatherReport('alerts','tts','day') }} + + {{ tonyStatusReport('full','tts') }} + + {{ tinaStatusReport('full','tts') }} + + {{ kallenStatusReport('full','tts') }} + + {{ emmaStatusReport('full','tts') }} +
+ ++ Do not forget to set the living room thermostat to your desired daytime temperature! +
+ ++ {% 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 %} +
+ + {%- 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()) -}}