From b6418b54b5b9aa4de9a2834ac3c7998c2bac80cb Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Wed, 22 Feb 2023 16:36:05 -0500 Subject: [PATCH] Volume control and sleep mode improvements --- automations.yaml | 139 ++++++++- node-red/projects/NerdFlows | 2 +- packages/notify.yaml | 544 ++++++++++++++++++++++++++++++++++-- scripts.yaml | 36 ++- 4 files changed, 667 insertions(+), 54 deletions(-) diff --git a/automations.yaml b/automations.yaml index a1bd2b0..b45740e 100644 --- a/automations.yaml +++ b/automations.yaml @@ -11,28 +11,30 @@ entity_id: input_boolean.vacation_mode state: 'off' action: - - service: input_boolean.turn_on - data: {} - target: - entity_id: input_boolean.audible_notifications - service: script.max_brightness data: {} - - service: notify.all_ios + - service: script.text_urgent_alert data: + who: all title: Tornado Warning - TAKE COVER! message: The National Weather Service has issued a Tornado Warning for our area. Take Cover NOW!!!! - - service: notify.tv_notifications + alias: CRITICAL PHONE ALERT + - service: script.tv_notify data: + who: all title: Tornado Warning - TAKE COVER! message: The National Weather Service has issued a Tornado Warning for our area. Take Cover NOW!!!! + alias: TV Alert - service: script.speech_engine data: - who: everywhere + who: Everywhere message: A tornado warning has been issued, please take cover immediately! A tornado warning has been issued, please take cover immediately! A tornado warning has been issued, please take cover immediately! + type: Alert + alias: Elevated TTS alert - delay: hours: 0 minutes: 1 @@ -44,6 +46,21 @@ message: A tornado warning has been issued, please take cover immediately! A tornado warning has been issued, please take cover immediately! A tornado warning has been issued, please take cover immediately! + type: critical + alias: CRITICAL TTS ALERT + - delay: + hours: 0 + minutes: 1 + seconds: 0 + milliseconds: 0 + - service: input_boolean.turn_off + data: {} + target: + entity_id: + - input_boolean.white_noise_kallen_bedroom + - input_boolean.white_noise_basement + - input_boolean.white_noise_emma_bedroom + alias: Turn off white noise mode: single - id: '1640916845901' alias: Cast to Chromecast @@ -370,7 +387,12 @@ data: topic: house/basement/server/glances payload: restart + qos: 0 + retain: false alias: Restart Glances via MQTT + - service: script.volume_reset + data: {} + alias: Reset all speaker volumes - if: - condition: state entity_id: input_boolean.studio_quiet @@ -389,7 +411,8 @@ alias: Shutdown then: - service: automation.turn_off - data: {} + data: + stop_actions: true target: entity_id: - automation.family_has_arrived @@ -428,6 +451,8 @@ entity_id: input_boolean.vacation_mode state: 'off' action: + - service: script.volume_reset + data: {} - service: script.max_brightness_cleanup data: {} - service: notify.all_ios @@ -477,19 +502,49 @@ - input_boolean.white_noise_emma_bedroom to: 'on' from: 'off' - id: emma + id: emma-on - platform: state entity_id: - input_boolean.white_noise_basement to: 'on' from: 'off' - id: basement + id: basement-on - platform: state entity_id: - input_boolean.white_noise_kallen_bedroom to: 'on' from: 'off' - id: kallen + id: kallen-on + - platform: state + entity_id: + - input_boolean.white_noise_emma_bedroom + from: 'on' + to: 'off' + for: + hours: 0 + minutes: 5 + seconds: 0 + id: emma-off + - platform: state + entity_id: + - input_boolean.white_noise_basement + from: 'on' + to: 'off' + id: basement-off + for: + hours: 0 + minutes: 0 + seconds: 5 + - platform: state + entity_id: + - input_boolean.white_noise_kallen_bedroom + from: 'on' + to: 'off' + for: + hours: 0 + minutes: 15 + seconds: 0 + id: kallen-off condition: [] action: - choose: @@ -504,7 +559,8 @@ milliseconds: 0 - service: media_player.volume_set data: - volume_level: 0.35 + volume_level: '{{ states(''input_number.emma_bedroom_google_speaker_night_volume'') + }}' target: entity_id: media_player.emma_bedroom_speaker - conditions: @@ -518,7 +574,8 @@ milliseconds: 0 - service: media_player.volume_set data: - volume_level: 0.5 + volume_level: '{{ states(''input_number.basement_google_speaker_night_volume'') + }}' target: entity_id: media_player.basement_google_speaker - conditions: @@ -532,11 +589,63 @@ milliseconds: 0 - service: media_player.volume_set data: - volume_level: 0.3 + volume_level: '{{ states(''input_number.kallen_bedroom_google_speaker_night_volume'') + }}' target: entity_id: media_player.kallen_bedroom_speaker + - conditions: + - condition: trigger + id: emma-off + sequence: + - if: + - condition: state + entity_id: input_boolean.emma_sleeping + state: 'off' + then: + - service: media_player.volume_set + data: + volume_level: "{% if is_state('input_boolean.give_me_darkness','on') %}\n + \ {{ states('input_number.emma_bedroom_google_speaker_night_volume') + }}\n{% else %}\n {{ states('input_number.emma_bedroom_google_speaker_day_volume') + }}\n{% endif %}\n" + target: + entity_id: media_player.emma_bedroom_speaker + - conditions: + - condition: trigger + id: basement-off + sequence: + - service: media_player.volume_set + data: + volume_level: "{% if is_state('input_boolean.give_me_darkness','on') %}\n + {{ states('input_number.basement_google_speaker_night_volume') }}\n{% + else %}\n {{ states('input_number.basement_google_speaker_day_volume') + }}\n{% endif %}\n" + target: + entity_id: media_player.basement_google_speaker + - conditions: + - condition: trigger + id: kallen-off + sequence: + - if: + - condition: and + conditions: + - condition: state + entity_id: input_boolean.kallen_sleeping + state: 'off' + - condition: state + entity_id: input_boolean.kallen_morning_briefing + state: 'off' + then: + - service: media_player.volume_set + data: + volume_level: "{% if is_state('input_boolean.give_me_darkness','on') %}\n + \ {{ states('input_number.kallen_bedroom_google_speaker_night_volume') + }}\n{% else %}\n {{ states('input_number.kallen_bedroom_google_speaker_day_volume') + }}\n{% endif %}\n" + target: + entity_id: media_player.kallen_bedroom_speaker mode: parallel - max: 6 + max: 10 - id: '1671584633378' alias: Delivery Mode Cleanup description: '' diff --git a/node-red/projects/NerdFlows b/node-red/projects/NerdFlows index f0b66f6..3c0b1ed 160000 --- a/node-red/projects/NerdFlows +++ b/node-red/projects/NerdFlows @@ -1 +1 @@ -Subproject commit f0b66f6becd7d534db4708ef6cbf9ce3e5ad4684 +Subproject commit 3c0b1ede3a7a4c2df7e3844749fb5b55aa5378a2 diff --git a/packages/notify.yaml b/packages/notify.yaml index 2130dba..a1ea74f 100644 --- a/packages/notify.yaml +++ b/packages/notify.yaml @@ -122,6 +122,80 @@ input_text: icon: mdi:text initial: Type your title here +input_number: + basement_echo_dot_day_volume: + name: Basement Echo Dot Day Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + basement_echo_dot_night_volume: + name: Basement Echo Dot Night Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + basement_google_speaker_day_volume: + name: Basement Google Speaker Day Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + basement_google_speaker_night_volume: + name: Basement Google Speaker Night Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + living_room_echo_dot_day_volume: + name: Living Room Echo Dot Day Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + living_room_echo_dot_night_volume: + name: Living Room Echo Dot Night Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + master_bedroom_echo_dot_day_volume: + name: Master Bedroom Echo Dot Day Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + master_bedroom_echo_dot_night_volume: + name: Master Bedroom Echo Dot Night Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + emma_bedroom_google_speaker_day_volume: + name: Emma Bedroom Google Speaker Day Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + emma_bedroom_google_speaker_night_volume: + name: Emma Bedroom Google Speaker Night Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + kallen_bedroom_google_speaker_day_volume: + name: Kallen Bedroom Google Speaker Day Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + kallen_bedroom_google_speaker_night_volume: + name: Kallen Bedroom Google Speaker Night Volume + min: 0 + max: 1.0 + step: 0.01 + icon: mdi:knob + # Amazon Polly Sensors to see last message and location of audible notification mqtt: sensor: @@ -216,8 +290,369 @@ notify: - service: alexa_media_living_room_echo_dot - service: alexa_media_basement_echo_dot -script: +# The below was the initial attempt at day/night volume handling. +# I am keeping it here in case I decide I want to use it, but for now I think I have a better solution. +# automation: +# - id: a3bfc13c-b01f-4b85-8e47-b45cd173a774 +# alias: 'Speaker Volume Handling' +# mode: parallel +# max: 12 +# trigger: +# - platform: state +# entity_id: input_number.basement_echo_dot_day_volume +# for: +# seconds: 1 +# id: basement-echo-day +# - platform: state +# entity_id: input_number.basement_echo_dot_night_volume +# for: +# seconds: 1 +# id: basement-echo-night +# - platform: state +# entity_id: input_number.basement_google_speaker_day_volume +# for: +# seconds: 1 +# id: basement-google-day +# - platform: state +# entity_id: input_number.basement_google_speaker_night_volume +# for: +# seconds: 1 +# id: basement-google-night +# - platform: state +# entity_id: input_number.living_room_echo_dot_day_volume +# for: +# seconds: 1 +# id: living-room-echo-day +# - platform: state +# entity_id: input_number.living_room_echo_dot_night_volume +# for: +# seconds: 1 +# id: living-room-echo-night +# - platform: state +# entity_id: input_number.master_bedroom_echo_dot_day_volume +# for: +# seconds: 1 +# id: master-bedroom-echo-day +# - platform: state +# entity_id: input_number.master_bedroom_echo_dot_night_volume +# for: +# seconds: 1 +# id: master-bedroom-echo-night +# - platform: state +# entity_id: input_number.emma_bedroom_google_speaker_day_volume +# for: +# seconds: 1 +# id: emma-bedroom-google-day +# - platform: state +# entity_id: input_number.emma_bedroom_google_speaker_night_volume +# for: +# seconds: 1 +# id: emma-bedroom-google-night +# - platform: state +# entity_id: input_number.kallen_bedroom_google_speaker_day_volume +# for: +# seconds: 1 +# id: kallen-bedroom-google-day +# - platform: state +# entity_id: input_number.kallen_bedroom_google_speaker_night_volume +# for: +# seconds: 1 +# id: kallen-bedroom-google-night +# action: +# - choose: +# - conditions: +# - condition: trigger +# id: basement-echo-day +# sequence: +# - if: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'off' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.basement_echo_dot +# data: +# volume_level: "{{ states('input_number.basement_echo_dot_day_volume') }}" +# - conditions: +# - condition: trigger +# id: basement-echo-night +# sequence: +# - if: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'on' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.basement_echo_dot +# data: +# volume_level: "{{ states('input_numnber.basement_echo_dot_night_volume') }}" +# - conditions: +# - condition: trigger +# id: basement-google-day +# sequence: +# - if: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'off' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.basement_google_speaker +# data: +# volume_level: "{{ states('input_number.basement_google_speaker_day_volume') }}" +# - conditions: +# - condition: trigger +# id: basement-google-night +# sequence: +# - if: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'on' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.basement_google_speaker +# data: +# volume_level: "{{ states('input_number.basement_google_speaker_night_volume') }}" +# - conditions: +# - condition: trigger +# id: living-room-echo-day +# sequence: +# - if: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'off' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.living_room_echo_dot +# data: +# volume_level: "{{ states('input_number.living_room_echo_dot_day_volume') }}" +# - conditions: +# - condition: trigger +# id: living-room-echo-night +# sequence: +# - if: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'on' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.living_room_echo_dot +# data: +# volume_level: "{{ states('input_number.living_room_echo_dot_night_volume') }}" +# - conditions: +# - condition: trigger +# id: master-bedroom-echo-day +# sequence: +# - if: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'off' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.master_bedroom_echo_dot +# data: +# volume_level: "{{ states('input_number.master_bedroom_echo_dot_day_volume') }}" +# - conditions: +# - condition: trigger +# id: master-bedroom-echo-night +# sequence: +# - if: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'on' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.master_bedroom_echo_dot +# data: +# volume_level: "{{ states('input_number.master_bedroom_echo_dot_night_volume') }}" +# - conditions: +# - condition: trigger +# id: emma-bedroom-google-day +# sequence: +# - if: +# - condition: and +# conditions: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'off' +# - condition: state +# entity_id: input_boolean.white_noise_emma_bedroom +# state: 'off' +# - condition: state +# entity_id: input_boolean.emma_sleeping +# state: 'off' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.emma_bedroom_speaker +# data: +# volume_level: "{{ states('input_number.emma_bedroom_google_speaker_day_volume') }}" +# - conditions: +# - condition: trigger +# id: emma-bedroom-google-night +# sequence: +# - if: +# - condition: and +# conditions: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'on' +# - condition: state +# entity_id: input_boolean.white_noise_emma_bedroom +# state: 'off' +# - condition: state +# entity_id: input_boolean.emma_sleeping +# state: 'off' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.emma_bedroom_speaker +# data: +# volume_level: "{{ states('input_number.emma_bedroom_google_speaker_night_volume') }}" +# - conditions: +# - condition: trigger +# id: kallen-bedroom-google-day +# sequence: +# - if: +# - condition: and +# conditions: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'off' +# - condition: state +# entity_id: input_boolean.white_noise_kallen_bedroom +# state: 'off' +# - condition: state +# entity_id: input_boolean.kallen_sleeping +# state: 'off' +# then: +# - service: media_player.volume_set +# target: +# entity_id: media_player.kallen_bedroom_speaker +# data: +# volume_level: "{{ states('input_number.kallen_bedroom_google_speaker_day_volume') }}" +# - conditions: +# - condition: trigger +# id: kallen-bedroom-google-night +# sequence: +# - if: +# - condition: and +# conditions: +# - condition: state +# entity_id: input_boolean.give_me_darkness +# state: 'on' +# - condition: state +# entity_id: input_boolean.white_noise_kallen_bedroom +# state: 'off' +# - condition: state +# entity_id: input_boolean.kallen_sleeping +# state: 'off' +# then: +# - 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') }}" + +script: + volume_reset: + alias: 'Volume Reset' + description: 'Use this to reset volumes to day or night on each speaker, depending on the time of day' + mode: restart + sequence: + - service: media_player.volume_set + target: + entity_id: media_player.basement_echo_dot + data: + volume_level: > + {% if is_state('input_boolean.give_me_darkness','on') %} + {{ states('input_number.basement_echo_dot_night_volume') }} + {% else %} + {{ states('input_number.basement_echo_dot_day_volume') }} + {% endif %} + - service: media_player.volume_set + target: + entity_id: media_player.basement_google_speaker + data: + volume_level: > + {% if is_state('input_boolean.give_me_darkness','on') %} + {{ states('input_number.basement_google_speaker_night_volume') }} + {% else %} + {{ states('input_number.basement_google_speaker_day_volume') }} + {% endif %} + - service: media_player.volume_set + target: + entity_id: media_player.living_room_echo_dot + data: + volume_level: > + {% if is_state('input_boolean.give_me_darkness','on') %} + {{ states('input_number.living_room_echo_dot_night_volume') }} + {% else %} + {{ states('input_number.living_room_echo_dot_day_volume') }} + {% endif %} + - if: + - condition: state + entity_id: input_boolean.master_bedroom_sleeping + state: 'off' + then: + - service: media_player.volume_set + target: + entity_id: media_player.master_bedroom_echo_dot + data: + volume_level: > + {% if is_state('input_boolean.give_me_darkness','on') %} + {{ states('input_number.master_bedroom_echo_dot_night_volume') }} + {% else %} + {{ states('input_number.master_bedroom_echo_dot_day_volume') }} + {% endif %} + - if: + - condition: and + conditions: + - condition: state + entity_id: input_boolean.white_noise_kallen_bedroom + state: 'off' + - condition: state + entity_id: input_boolean.kallen_sleeping + state: 'off' + then: + - service: media_player.volume_set + target: + entity_id: media_player.kallen_bedroom_speaker + data: + volume_level: > + {% if is_state('input_boolean.give_me_darkness','on') %} + {{ states('input_number.kallen_bedroom_google_speaker_night_volume') }} + {% else %} + {{ states('input_number.kallen_bedroom_google_speaker_day_volume') }} + {% endif %} + - if: + - condition: and + conditions: + - condition: state + entity_id: input_boolean.white_noise_emma_bedroom + state: 'off' + - condition: state + entity_id: input_boolean.emma_sleeping + state: 'off' + then: + - service: media_player.volume_set + target: + entity_id: media_player.emma_bedroom_speaker + data: + volume_level: > + {% if is_state('input_boolean.give_me_darkness','on') %} + {{ states('input_number.emma_bedroom_google_speaker_night_volume') }} + {% else %} + {{ states('input_number.emma_bedroom_google_speaker_day_volume') }} + {% endif %} ############################################################################### # Txt Notify @@ -725,6 +1160,17 @@ script: - Justin - Matthew - Salli + type: + name: 'Type' + description: 'What type of message is this? Can override some settings depending on the option selected. Alert bypasses time restrictions but respects volume settings. Critical also bypasses time restrictions, but also sets all volumes to max.' + required: false + example: 'normal, alert, critical' + selector: + select: + options: + - Normal + - Alert + - Critical variables: voice: "{{ states('input_select.jarvis_voice') }}" sequence: @@ -756,9 +1202,18 @@ script: topic: 'house/polly/lastloc' payload: '{{ who }}' retain: true - - condition: state - entity_id: input_boolean.audible_notifications - state: 'on' + - condition: or + conditions: + - condition: state + entity_id: input_boolean.audible_notifications + state: 'on' + - condition: template + value_template: > + {% if type in ['critical','Critical','alert','Alert'] %} + true + {% else %} + false + {% endif %} - condition: state entity_id: group.adults state: 'home' @@ -863,6 +1318,7 @@ script: {{ message }} {% endif %} voice: '{{ voice }}' + type: '{{ type }}' - condition: template value_template: > {% if who in ['Everywhere','everywhere','all_bedrooms','All Bedrooms','kids_bedrooms','Kids Bedrooms'] %} @@ -875,6 +1331,7 @@ script: who: '{{ who }}' message: > {{ message }} + type: '{{ type }}' @@ -943,6 +1400,25 @@ script: alexa_voice: alias: 'Alexa Voice' sequence: + - if: + - condition: template + value_template: > + {% if type in ['critical','Critical'] %} + true + {% else %} + false + {% endif %} + then: + - service: media_player.volume_set + target: + entity_id: + - media_player.living_room_echo_dot + - media_player.basement_echo_dot + - media_player.master_bedroom_echo_dot + data: + volume_level: 1.0 + - delay: + seconds: 3 - service: notify.alexa_media data: message: > @@ -1051,19 +1527,57 @@ script: media_player.emma_bedroom_speaker {% elif who in ['Basement Google','basement_google'] %} media_player.basement_google_speaker - {% else %} - {% if states.input_boolean.audible_notifications.state == 'on' %} - media_player.living_room_tv - {% else %} - media_player.living_room_tv - {% endif %} {% endif %} volume_level: >- - {% if states.input_boolean.audible_notifications.state == 'on' %} - 0.8 + {% set numbers_night = [ + states.input_number.emma_bedroom_google_speaker_night_volume.state, + states.input_number.kallen_bedroom_google_speaker_night_volume.state + ] %} + {% set numbers_day = [ + states.input_number.emma_bedroom_google_speaker_day_volume.state, + states.input_number.kallen_bedroom_google_speaker_day_volume.state + ] %} + {% set kidsgroup_night = numbers_night | list | min | float %} + {% set kidsgroup_day = numbers_day | list | max | float %} + {% if type in ['critical'] %} + 1.0 + {% elif is_state('input_boolean.give_me_darkness','on') %} + {% if who in ['Everywhere','everywhere','kids_bedrooms','all_bedrooms'] %} + {% if is_state('input_boolean.emma_sleeping','on') and is_state('input_boolean.kallen_sleeping','off') %} + {{ states('input_number.kallen_bedroom_google_speaker_night_volume') }} + {% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %} + {{ states('input_number.emma_bedroom_google_speaker_night_volume') }} + {% else %} + {{ kidsgroup_night }} + {% endif %} + {% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %} + {{ states('input_number.kallen_bedroom_google_speaker_night_volume') }} + {% elif who in ['emma_bedroom','media_player.emma_bedroom_speaker'] %} + {{ states('input_number.emma_bedroom_google_speaker_night_volume') }} + {% elif who in ['Basement Google','basement_google'] %} + {{ states('input_number.basement_google_speaker_night_volume') }} {% else %} 0.3 {% endif %} + {% else %} + {% if who in ['Everywhere','everywhere','kids_bedrooms','all_bedrooms'] %} + {% if is_state('input_boolean.emma_sleeping','on') and is_state('input_boolean.kallen_sleeping','off') %} + {{ states('input_number.kallen_bedroom_google_speaker_day_volume') }} + {% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %} + {{ states('input_number.emma_bedroom_google_speaker_day_volume') }} + {% else %} + {{ kidsgroup_day }} + {% endif %} + {% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker'] %} + {{ states('input_number.kallen_bedroom_google_speaker_day_volume') }} + {% elif who in ['emma_bedroom','media_player.emma_bedroom_speaker'] %} + {{ states('input_number.emma_bedroom_google_speaker_day_volume') }} + {% elif who in ['Basement Google','basement_google'] %} + {{ states('input_number.basement_google_speaker_day_volume') }} + {% else %} + 0.6 + {% endif %} + {% endif %} - service: tts.amazon_polly_say data_template: entity_id: >- @@ -1081,12 +1595,6 @@ script: media_player.emma_bedroom_speaker {% elif who in ['Basement Google','basement_google'] %} media_player.basement_google_speaker - {% else %} - {% if states.input_boolean.audible_notifications.state == 'on' %} - media_player.living_room_tv - {% else %} - media_player.living_room_tv - {% endif %} {% endif %} message: >- diff --git a/scripts.yaml b/scripts.yaml index 34a5179..2126547 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -50,6 +50,8 @@ give_me_darkness: continue_on_timeout: true timeout: seconds: 5 + - service: script.volume_reset + data: {} - service: script.evening_on_first_floor data: {} - service: script.evening_on_second_floor @@ -435,15 +437,9 @@ max_brightness_cleanup: - input_text.upstairs_hallway_selected_scene mode: single icon: mdi:broom -freeze_cleanup: - alias: Freeze Cleanup +cleanup_crash: + alias: Cleanup Crash sequence: - - service: input_boolean.turn_off - data: {} - target: - entity_id: - - input_boolean.night_mode - - input_boolean.shower_mode - service: switch.turn_off data: {} target: @@ -452,6 +448,7 @@ freeze_cleanup: - switch.basement_echo_dot_do_not_disturb_switch - switch.living_room_echo_dot_do_not_disturb_switch - switch.master_bedroom_echo_dot_do_not_disturb_switch + alias: Turn off switches - if: - condition: time after: input_datetime.master_bedroom_wakeup @@ -474,6 +471,7 @@ freeze_cleanup: data: {} target: entity_id: button.master_bedroom_night_mode + alias: Set climate state - if: - condition: state entity_id: sensor.twitch_ironnerd24 @@ -488,6 +486,7 @@ freeze_cleanup: data: {} target: entity_id: input_boolean.studio_quiet + alias: Set studio quiet if Twitch stream is live - if: - condition: state entity_id: calendar.family_tinawork @@ -505,6 +504,7 @@ freeze_cleanup: data: {} target: entity_id: input_boolean.work_today + alias: Set Tina Work booleans - if: - condition: state entity_id: calendar.kallen_school_days @@ -528,6 +528,7 @@ freeze_cleanup: - input_boolean.kallen_school_today - input_boolean.kallen_school_today_extended - input_boolean.kallen_at_school + alias: Set Kallen School booleans - if: - condition: time before: input_datetime.audible_notification_on @@ -542,6 +543,7 @@ freeze_cleanup: data: {} target: entity_id: input_boolean.audible_notifications + alias: Set audible notifications - service: switch.turn_on data: {} target: @@ -558,6 +560,7 @@ freeze_cleanup: - switch.adaptive_lighting_emma_bedroom - switch.adaptive_lighting_upstairs_bathroom - switch.adaptive_lighting_upstairs_hallway + alias: Turn on all adaptive lighting - service: input_text.set_value data: value: Adaptive @@ -575,21 +578,14 @@ freeze_cleanup: - input_text.upstairs_bathroom_selected_scene - input_text.upstairs_hallway_selected_scene - input_text.dining_room_lamp_selected_scene - - service: media_player.volume_set - data: - volume_level: 0.6 - target: - entity_id: - - media_player.basement_echo_dot - - media_player.living_room_echo_dot - - service: media_player.volume_set - data: - volume_level: 0.5 - target: - entity_id: media_player.master_bedroom_echo_dot + alias: Reset input texts to adaptive + - service: script.volume_reset + data: {} + alias: Reset all speaker volumes - service: button.press data: {} target: entity_id: button.cleanup + alias: Run Node-RED cleanup flow mode: single icon: mdi:truck-snowflake