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

View File

@ -113,29 +113,31 @@ sensor:
room_audio: room_audio:
friendly_name: "Room Audio" friendly_name: "Room Audio"
value_template: >- value_template: >-
{% set sensor_count = expand('group.occupancy') | selectattr('state', 'eq', 'on') | list | count %} {%- if is_state('media_player.theater_tv', 'on') %}
{% if sensor_count >= 1 %} theater
{% 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 %}
{% else %} {% 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 %} {% endif %}
alexa_audio: alexa_audio:
friendly_name: "Alexa Audio" friendly_name: "Alexa Audio"

View File

@ -2,13 +2,9 @@
{# Morning Wakeup Report #} {# Morning Wakeup Report #}
{%- macro getReport() -%} {%- macro getReport() -%}
<p> <p>
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
Good morning. Good morning.
{% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
Good afternoon.
{% else %}
Good evening.
{% endif %}
</p> </p>
<p> <p>
{% if now().strftime('%H')|int < 12 %} {% if now().strftime('%H')|int < 12 %}
@ -84,6 +80,9 @@
'Skylar needs to head to school in about forty minutes. ', 'Skylar needs to head to school in about forty minutes. ',
'Skylar should go to school today. ' 'Skylar should go to school today. '
] | random }} ] | random }}
{% if states.calendar.skylar_school.attributes.description == 'digital-learning' %}
And today is a digital learning day so the commute will be short.
{% endif %}
{% if states.calendar.skylar_school.attributes.description == 'early-release' %} {% if states.calendar.skylar_school.attributes.description == 'early-release' %}
But It is early release! But It is early release!
{% endif %} {% endif %}
@ -112,7 +111,7 @@
{% endif %} {% endif %}
</p> </p>
<p> <p>
{% if is_state('input_boolean.skylar_is_awake', 'on') %} {% if is_state('input_boolean.skylar_awake', 'on') %}
Skylar was up and moving at {{ states.input_datetime.skylar_awake_at.state }}. Skylar was up and moving at {{ states.input_datetime.skylar_awake_at.state }}.
{% if is_state('media_player.theater_tv', 'on') %} {% if is_state('media_player.theater_tv', 'on') %}
and he appears to be in the Theater and he appears to be in the Theater

View File

@ -55,6 +55,9 @@
<p> <p>
{% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %} {% if states.calendar.skylar_school.attributes.offset_reached == True and is_state('calendar.school_holiday', 'off') %}
Because you have school today! Because you have school today!
{% if states.calendar.skylar_school.attributes.description == 'digital-learning' %}
And today is a digital learning day.
{% endif %}
{% if states.calendar.skylar_school.attributes.description == 'early-release' %} {% if states.calendar.skylar_school.attributes.description == 'early-release' %}
And guess what? It is early release! And guess what? It is early release!
{% endif %} {% endif %}

View File

@ -42,20 +42,25 @@
'If you have not looked outside lately, the light of the day is almost gone.' 'If you have not looked outside lately, the light of the day is almost gone.'
]|random }} ]|random }}
</p> </p>
<p>
{% if is_state('binary_sensor.garage_door', 'on') %} {% if is_state('binary_sensor.garage_door', 'on') %}
<p>
{{ [ 'The garage door is open. ', {{ [ 'The garage door is open. ',
'The pod bay doors are open. ', 'The pod bay doors are open. ',
'Someone forgot to close the garage.' 'Someone forgot to close the garage.'
] | random }} ] | random }}
</p>
{% elif is_state('binary_sensor.side_door', 'on') %} {% elif is_state('binary_sensor.side_door', 'on') %}
<p>
{{ [ 'The side door is ajar. ', {{ [ 'The side door is ajar. ',
'The side door is open. ', 'The side door is open. ',
'Someone forgot to close the side door.' 'Someone forgot to close the side door.'
] | random }} ] | random }}
</p>
{% else %} {% else %}
{% endif %} {% endif %}
</p>
<p> <p>
{% if states.sensor.nws_alerts.state | int > 0 %} {% if states.sensor.nws_alerts.state | int > 0 %}
There are currently {{states.sensor.nws_alerts.state }} active weather alerts for our area. There are currently {{states.sensor.nws_alerts.state }} active weather alerts for our area.
@ -82,25 +87,29 @@
]|random }} ]|random }}
{{ states.sensor.nws_overnight_forecast.state }} {{ states.sensor.nws_overnight_forecast.state }}
</p> </p>
<p>
{% if is_state('input_boolean.freeze_warning','on') %} {% if is_state('input_boolean.freeze_warning','on') %}
<p>
{{ [ 'The temperature is expected to be near or below freezing. <emphasis>Someone</emphasis> might want to bring the lemon tree in. ', {{ [ 'The temperature is expected to be near or below freezing. <emphasis>Someone</emphasis> might want to bring the lemon tree in. ',
'It appears that it will be cold tonight. Like, the turn water solid <emphasis>kind</emphasis> of cold. Think of the poor plants.', 'It appears that it will be cold tonight. Like, the turn water solid <emphasis>kind</emphasis> of cold. Think of the poor plants.',
'I suggest bringing in the plants other wise, the temperature might kill them. And that will be on <emphasis>you</emphasis>.', 'I suggest bringing in the plants other wise, the temperature might kill them. And that will be on <emphasis>you</emphasis>.',
'I would say winter is coming. But, based on the weather forecast <emphasis>it</emphasis> appears to be here.', 'I would say winter is coming. But, based on the weather forecast <emphasis>it</emphasis> appears to be here.',
'It will be freezing cold tonight. I would bring in the plants but I lack legs. And Arms. So I am forced to rely on you. Do not let me down.' 'It will be freezing cold tonight. I would bring in the plants but I lack legs. And Arms. So I am forced to rely on you. Do not let me down.'
] | random }} ] | random }}
</p>
{% endif %} {% endif %}
</p>
{% if is_state('sensor.today_is', 'Tuesday') %} {% if is_state('sensor.today_is', 'Tuesday') %}
{% if now().strftime('%H')|int > 17 %}
{{ [ 'Do not forget to bring in the trash cans. ', {% if now().strftime('%H')|int > 17 %}
'The trash cans will feel lonely if you leave them out all night. ', <p>
'The <say-as interpret-as="characters">HOA</say-as> will get mad if you leave those trash cans out on the street.' {{ [ 'Do not forget to bring in the trash cans. ',
] | random }} 'The trash cans will feel lonely if you leave them out all night. ',
{% endif %} 'The <say-as interpret-as="characters">HOA</say-as> will get mad if you leave those trash cans out on the street.'
] | random }}
</p>
{% endif %}
{% endif %} {% endif %}
</p>
<p> <p>
{% if states.sensor.halloween_countdown.state | int == 1 %} {% if states.sensor.halloween_countdown.state | int == 1 %}
Tomorrow is Halloween. I hope you have picked out a costume. Tomorrow is Halloween. I hope you have picked out a costume.