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

@@ -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"