Merge branch 'jarvis-rewrite'

This commit is contained in:
2022-06-30 17:15:26 -04:00
7 changed files with 99 additions and 63 deletions

File diff suppressed because one or more lines are too long

View File

@ -175,7 +175,7 @@ sensor:
{% elif is_state('sensor.last_alexa', 'media_player.master_bedroom_echo_dot') %} {% elif is_state('sensor.last_alexa', 'media_player.master_bedroom_echo_dot') %}
Master Bedroom Echo Dot Master Bedroom Echo Dot
{% else %} {% else %}
Everywhere Living Room Echo Dot
{%- endif %} {%- endif %}
last_alexa: last_alexa:
value_template: > value_template: >

View File

@ -898,3 +898,10 @@ script:
entity_id: sensor.flood_warning entity_id: sensor.flood_warning
- service: homeassistant.update_entity - service: homeassistant.update_entity
entity_id: sensor.flood_watch entity_id: sensor.flood_watch
weather_briefing:
sequence:
- service: script.speech_engine
data_template:
who: "{{ who }}"
message: !include ../templates/speech/weather_briefing_full.yaml

View File

@ -35,7 +35,7 @@ tts:
aws_secret_access_key: !secret aws_secret_access_key aws_secret_access_key: !secret aws_secret_access_key
region_name: 'us-east-1' region_name: 'us-east-1'
text_type: ssml text_type: ssml
voice: Joanna voice: Emma
cache: true cache: true
engine: neural engine: neural

View File

@ -12,6 +12,15 @@ input_boolean:
name: House Party Switch name: House Party Switch
icon: mdi:party-popper icon: mdi:party-popper
input_select:
jarvis_voice:
name: Jarvis voice
options:
- Brian
- Emma
- Joanna
initial: Brian
# automation: # automation:
# - id: house_party_protocol_on # - id: house_party_protocol_on
# alias: Turn On House Party Protocol # alias: Turn On House Party Protocol

View File

@ -87,6 +87,19 @@ mqtt:
- name: "Jarvis Last Msg Time" - name: "Jarvis Last Msg Time"
state_topic: "house/polly/msgtime" state_topic: "house/polly/msgtime"
group:
alexa_everywhere:
name: Alexa Everywhere
entities:
- media_player.living_room_echo_dot
- media_player.basement_echo_dot
- media_player.master_bedroom_echo_dot
common_areas:
name: Alexa Common Areas
entities:
- media_player.living_room_echo_dot
- media_player.basement_echo_dot
notify: notify:
- platform: ios - platform: ios
- name: all_ios - name: all_ios
@ -421,6 +434,8 @@ script:
############################################################################### ###############################################################################
speech_engine: speech_engine:
variables:
voice: "{{ states('input_select.jarvis_voice') }}"
sequence: sequence:
- service: mqtt.publish - service: mqtt.publish
data_template: data_template:
@ -488,11 +503,17 @@ script:
who: '{{ who }}' who: '{{ who }}'
message: > message: >
{{ message }} {{ message }}
- service: >- voice: '{{ voice }}'
- condition: template
value_template: >
{% if who in ['Everywhere','everywhere'] %} {% if who in ['Everywhere','everywhere'] %}
{% set who = 'everywhere' %} true
script.jarvis_voice {% else %}
false
{% endif %} {% endif %}
- service: >-
{% set who = 'everywhere' %}
script.jarvis_voice
data: data:
who: '{{ who }}' who: '{{ who }}'
message: > message: >
@ -563,63 +584,32 @@ script:
# Called wheh notification needs to play on echos # Called wheh notification needs to play on echos
alexa_voice: alexa_voice:
sequence: sequence:
# - service: media_player.turn_on - service: notify.alexa_media
# data_template:
# entity_id: >-
# {% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %}
# media_player.living_room_echo_dot
# {% elif who in ['master_bedroom','master_bedroom_echo_dot'] %}
# media_player.master_bedroom_echo_dot
# {% elif who in ['basement','basement_echo_dot'] %}
# media_player.basement_echo_dot
# {% elif who in ['Everywhere','everywhere'] %}
# - media_player.basement_echo_dot
# - media_player.living_room_echo_dot
# - media_player.master_bedroom_echo_dot
# {% else %}
# media_player.living_room_echo_dot
# {% endif %}
# - service: media_player.volume_set
# data_template:
# entity_id: >-
# {% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %}
# media_player.living_room_echo_dot
# {% elif who in ['master_bedroom','master_bedroom_echo_dot'] %}
# media_player.master_bedroom_echo_dot
# {% elif who in ['basement','basement_echo_dot'] %}
# media_player.basement_echo_dot
# {% elif who in ['Everywhere','everywhere'] %}
# - media_player.basement_echo_dot
# - media_player.living_room_echo_dot
# - media_player.master_bedroom_echo_dot
# {% else %}
# media_player.living_room_echo_dot
# {% endif %}
# volume_level: >-
# {% if is_state('input_boolean.audible_notifications.state','on') %}
# .7
# {% else %}
# .3
# {% endif %}
- service: >-
{% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %}
notify.alexa_media_living_room_echo_dot
{% elif who in ['master_bedroom','master_bedroom_echo_dot'] %}
notify.alexa_media_master_bedroom_echo_dot
{% elif who in ['basement','basement_echo_dot'] %}
notify.alexa_media_basement_echo_dot
{% elif who in ['common'] %}
notify.alexa_common_areas
{% elif who in ['Everywhere','everywhere'] %}
notify.alexa_everywhere
{% else %}
notify.alexa_media_living_room_echo_dot
{% endif %}
data: data:
message: > message: >
{{ message }} <voice name="{{ voice }}">
data: <amazon:auto-breaths>
type: tts <prosody rate="fast">
{{ message }}
</prosody>
</amazon:auto-breaths>
</voice>
target: >
{% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %}
media_player.living_room_echo_dot
{% elif who in ['master_bedroom','master_bedroom_echo_dot'] %}
media_player.master_bedroom_echo_dot
{% elif who in ['basement','basement_echo_dot'] %}
media_player.basement_echo_dot
{% elif who in ['common'] %}
group.common_areas
{% elif who in ['Everywhere','everywhere'] %}
group.alexa_everywhere
{% else %}
media_player.living_room_echo_dot
{% endif %}
data:
type: tts
# Default audible notifications. Notifcations play on the google devices. # Default audible notifications. Notifcations play on the google devices.
jarvis_voice: jarvis_voice:

View File

@ -0,0 +1,30 @@
>
{# Weather Briefing #}
{%- macro getReport() -%}
<p>
{{ states('sensor.current_conditions_detail') }}
</p>
<p>
{{ states('sensor.tomorrow_forecast_detail') }}
</p>
<p>
{{ states('sensor.clothing_forecast_detail') }}
</p>
{%- endmacro -%}
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{{ getReport() }}
{%- endmacro -%}
{# Call the macro #}
{{- cleanup(mother_of_all_macros()) -}}