Just don't play TTS on anywhere on second floor while anyone is sleeping
Critical notifications will of course still ignore all restrictions
This commit is contained in:
@ -1176,7 +1176,7 @@ script:
|
|||||||
{{ message }}
|
{{ message }}
|
||||||
</speak>
|
</speak>
|
||||||
|
|
||||||
# Called wheh notification needs to play on echos
|
# Notifications that play on the Alexa devices
|
||||||
alexa_voice:
|
alexa_voice:
|
||||||
alias: 'Alexa Voice'
|
alias: 'Alexa Voice'
|
||||||
sequence:
|
sequence:
|
||||||
@ -1194,6 +1194,11 @@ script:
|
|||||||
volume_level: 1.0
|
volume_level: 1.0
|
||||||
- delay:
|
- delay:
|
||||||
seconds: 3
|
seconds: 3
|
||||||
|
- if:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ is_state('binary_sensor.people_sleeping','on') and who in ['master_bedroom','master_bedroom_echo_dot','all_bedrooms'] and type not in ['critical','Critical'] }}"
|
||||||
|
then:
|
||||||
|
- stop: People are sleeping and this message is not important
|
||||||
- service: notify.alexa_media
|
- service: notify.alexa_media
|
||||||
data:
|
data:
|
||||||
message: >
|
message: >
|
||||||
@ -1227,28 +1232,31 @@ script:
|
|||||||
data:
|
data:
|
||||||
type: tts
|
type: tts
|
||||||
|
|
||||||
# Default audible notifications. Notifcations play on the google devices.
|
# Notifications that play on the Google devices.
|
||||||
jarvis_voice:
|
jarvis_voice:
|
||||||
alias: 'Jarvis Voice'
|
alias: 'Jarvis Voice'
|
||||||
sequence:
|
sequence:
|
||||||
- if:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ who in ['emma_bedroom','Emma Bedroom','media_player.emma_bedroom_speaker'] and is_state('input_boolean.emma_sleeping','on') }}"
|
|
||||||
then:
|
|
||||||
- stop: 'Emma is sleeping'
|
|
||||||
- if:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ who in ['kallen_bedroom','media_player.kallen_bedroom_speaker','Kallen Bedroom'] and is_state('input_boolean.kallen_sleeping','on') }}"
|
|
||||||
then:
|
|
||||||
- stop: 'Kallen is sleeping'
|
|
||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
{% if who in ['kids_bedrooms','all_bedrooms','everywhere','Everywhere','Kids Bedrooms','All Bedrooms'] %}
|
{% from 'time.jinja' import ct %}
|
||||||
{{ is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','on') }}
|
{% set ct = ct() | int %}
|
||||||
|
{% set kallen_wakeup = state_attr('input_datetime.kallen_wakeup_time','timestamp') %}
|
||||||
|
{% if type in ['critical','Critical'] %}
|
||||||
|
false
|
||||||
|
{% elif who in ['emma_bedroom','Emma Bedroom','media_player.emma_bedroom_speaker'] %}
|
||||||
|
{{ is_state('binary_sensor.people_sleeping','on') }}
|
||||||
|
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_speaker','Kallen Bedroom'] %}
|
||||||
|
{% if (kallen_wakeup - 3600) < ct < (kallen_wakeup + 3600) %}
|
||||||
|
false
|
||||||
|
{% else %}
|
||||||
|
{{ is_state('binary_sensor.people_sleeping','on') }}
|
||||||
|
{% endif %}
|
||||||
|
{% elif who in ['kids_bedrooms','all_bedrooms','everywhere','Everywhere','Kids Bedrooms','All Bedrooms'] %}
|
||||||
|
{{ is_state('binary_sensor.people_sleeping','on') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
then:
|
then:
|
||||||
- stop: 'Kids are sleeping'
|
- stop: 'People are sleeping'
|
||||||
- service: media_player.turn_on
|
- service: media_player.turn_on
|
||||||
data:
|
data:
|
||||||
entity_id: >-
|
entity_id: >-
|
||||||
@ -1266,12 +1274,6 @@ script:
|
|||||||
media_player.emma_bedroom_speaker
|
media_player.emma_bedroom_speaker
|
||||||
{% elif who in ['Basement Google','basement_google'] %}
|
{% elif who in ['Basement Google','basement_google'] %}
|
||||||
media_player.basement_google_speaker
|
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 %}
|
{% endif %}
|
||||||
- service: media_player.volume_set
|
- service: media_player.volume_set
|
||||||
data:
|
data:
|
||||||
|
@ -258,6 +258,10 @@ template:
|
|||||||
- name: "Upstairs Bathroom Occupied"
|
- name: "Upstairs Bathroom Occupied"
|
||||||
unique_id: 7ec69a26-1013-4b0d-8662-a91ab9f040ca
|
unique_id: 7ec69a26-1013-4b0d-8662-a91ab9f040ca
|
||||||
state: "{{ is_state('timer.upstairs_bathroom_motion_timer','active') or is_state('binary_sensor.upstairs_bathroom_motion','on') or is_state('input_boolean.shower_mode','on') }}"
|
state: "{{ is_state('timer.upstairs_bathroom_motion_timer','active') or is_state('binary_sensor.upstairs_bathroom_motion','on') or is_state('input_boolean.shower_mode','on') }}"
|
||||||
|
- name: "People Sleeping"
|
||||||
|
unique_id: 3f0a1504-fd01-4967-a6fb-0309813d31e3
|
||||||
|
state: "{{ is_state('input_boolean.emma_sleeping','on') or is_state('input_boolean.kallen_sleeping','on') or is_state('input_boolean.master_bedroom_sleeping','on') }}"
|
||||||
|
icon: mdi:sleep
|
||||||
|
|
||||||
mqtt:
|
mqtt:
|
||||||
sensor:
|
sensor:
|
||||||
|
Reference in New Issue
Block a user