More Tweaks to audible notifications...think we are good now

This commit is contained in:
Jeffrey Stone
2020-12-12 20:50:38 -05:00
parent 7d64e92426
commit 2af1b8086d
5 changed files with 61 additions and 46 deletions

View File

@@ -152,8 +152,8 @@ automation:
action:
- service: scene.turn_on
entity_id: scene.skylar_room_morning
- service: script.skylar_morning_briefing_jarvis
- service: script.skylar_morning_briefing
- id: bbbafc52-eab1-44cd-ac24-4f9b7f4210b6
alias: set skylar morning report time
trigger:
@@ -213,10 +213,12 @@ script:
- service: script.speech_engine
data:
who: >
{%- if is_state('binary_sensor.theater_occupancy', 'on') and is_state('media_player.theater_tv', 'on') %}
{%- if is_state('media_player.theater_tv', 'on') %}
theater
{% else %}
{%- elif is_state('binary_sensor.skylar_room_occupancy', 'on') %}
skylar_bedroom
{% else %}
main
{%- endif %}
message: !include ../templates/speech/skylar_morning_briefing.yaml

View File

@@ -113,29 +113,31 @@ sensor:
room_audio:
friendly_name: "Room Audio"
value_template: >-
{% set sensor_count = expand('group.occupancy') | selectattr('state', 'eq', 'on') | list | count %}
{% if sensor_count >= 1 %}
{% for sensor in expand('group.occupancy') %}
{% if as_timestamp(sensor.last_changed) == as_timestamp(expand('group.occupancy') | selectattr('state', 'eq', 'on') | map(attribute='last_changed') | max) %}
{%- if is_state('media_player.theater_tv', 'on') %}
theater
{% elif sensor.name == 'Kitchen Occupancy' %}
kitchen
{% elif sensor.name == 'Living Room Occupancy' and is_state('input_boolean.audible_notifications', 'on') %}
main
{% elif sensor.name == 'Living Room Occupancy' and is_state('input_boolean.audible_notifications', 'off') %}
kitchen
{% elif sensor.name == 'Croft Occupancy' %}
croft
{% elif sensor.name == 'Master Bedroom Occupancy' %}
master_bedroom
{% else %}
all_google
{%- endif %}
{% endif %}
{% endfor %}
{%- if is_state('media_player.theater_tv', 'on') %}
theater
{% else %}
main
{% set sensor_count = expand('group.occupancy') | selectattr('state', 'eq', 'on') | list | count %}
{% if sensor_count >= 1 %}
{% for sensor in expand('group.occupancy') %}
{% if as_timestamp(sensor.last_changed) == as_timestamp(expand('group.occupancy') | selectattr('state', 'eq', 'on') | map(attribute='last_changed') | max) %}
{% if is_state('input_boolean.audible_notifications', 'on') %}
{% if sensor.name == 'Kitchen Motion Occupancy' %}
kitchen
{% elif sensor.name == 'Master Bedroom Occupancy' %}
master_bedroom
{% else %}
main
{%- endif %}
{% else %}
{% if sensor.name == 'Croft Occupancy' %}
croft
{% else %}
kitchen
{%- endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
alexa_audio:
friendly_name: "Alexa Audio"