Migrating to Amazon Polly

This commit is contained in:
Jeffrey Stone 2019-07-12 16:35:11 -04:00
parent 4a5e1b915b
commit 950e8f5822
7 changed files with 220 additions and 86 deletions

View File

@ -142,5 +142,22 @@ automation:
- service: script.turn_on
entity_id: script.weather_report
- service: script.voice_reports_off
- id: guest_mode_feedback
alias: Guest Mode Audio Feedback
trigger:
- platform: state
entity_id:
- input_boolean.guest_mode
from: 'off'
to: 'on'
action:
- service: script.jarvis_voice
data_template:
message: >
{{ [
"Guest Mode has been enabled as you requested.",
"I have switched to the system to guest mode",
"I have enabled guest mode. ",
"System Guest Mode has been enabled."
] | random }}

View File

@ -1,8 +1,8 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 03/13/2019
# @package : Disney
# @description : A little Imaginering to bring disney into our home.
# @package : Security
# @description : Everything related to security functions.
###############################################################################
input_boolean:

View File

@ -15,6 +15,13 @@ tts:
cache: true
cache_dir: /tmp/tts
time_memory: 300
- platform: amazon_polly
aws_access_key_id: !secret aws_key
aws_secret_access_key: !secret aws_secret
region_name: 'us-east-1'
text_type: ssml
voice: Brian
cache: True
notify:
- platform: ios
@ -104,6 +111,17 @@ script:
message: >
{{ message }}
jarvis_alert:
sequence:
- service: tts.amazon_polly_say
data_template:
entity_id: media_player.hass_speaker
message: >-
<speak>
{{ message }}
</speak>
cache: true
###############################################################################
# Voice Notify
@ -131,6 +149,32 @@ script:
message: >
{{message }}
jarvis_voice:
sequence:
- condition: template
value_template: '{{ states.input_boolean.audible_notifications.state == "on" }}'
- condition: state
entity_id: sensor.family_status
state: 'Home'
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
- wait_template: >-
{{ not is_state('media_player.hass_speaker', 'playing') }}
- service: tts.amazon_polly_say
data_template:
entity_id: media_player.hass_speaker
# entity_id: >
# {% if states.input_boolean.audible_notifications.state == 'on' %}
# media_player.hass_speaker
# {% else %}
# media_player.googlehome0715, media_player.googlehomehub3492
# {% endif %}
message: >-
<speak>
{{ message }}
</speak>
cache: true
###############################################################################
# Twitter
@ -185,7 +229,7 @@ script:
###############################################################################
morning_report:
sequence:
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: !include ../templates/morning_report.yaml
@ -195,7 +239,7 @@ script:
###############################################################################
skylar_morning_greeting:
sequence:
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: !include ../templates/skylar_morning.yaml
@ -204,7 +248,13 @@ script:
###############################################################################
nightly_report:
sequence:
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: !include ../templates/nightly_report.yaml
test_nightly_report:
sequence:
- service: script.jarvis_voice
data_template:
message: !include ../templates/nightly_report.yaml
@ -213,16 +263,25 @@ script:
###############################################################################
weather_report:
sequence:
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: !include ../templates/jarvis_confirmations.yaml
- delay:
seconds: 3
- service: script.jarvis_voice
data_template:
message: !include ../templates/weather_report.yaml
- delay:
minutes: 5
- service: scriot.turn_off
entity_id: script.weather_report
###############################################################################
# Traffic Report
###############################################################################
traffic_report:
sequence:
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: !include ../templates/traffic_report.yaml
@ -231,7 +290,7 @@ script:
###############################################################################
jeff_eta_report:
sequence:
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: !include ../templates/jeff_eta.yaml
@ -240,7 +299,7 @@ script:
###############################################################################
kat_eta_report:
sequence:
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: !include ../templates/kat_eta.yaml
@ -249,7 +308,7 @@ script:
###############################################################################
prebed_routine:
sequence:
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: !include ../templates/skylar_night.yaml
# message: >

109
packages/presence.yaml Normal file
View File

@ -0,0 +1,109 @@
###############################################################################
# @author : Jeffrey Stone
# @date : 02/19/2019
# @package : Presence
# @description : A Collection of Presence Related Trackers and Sensors
###############################################################################
sensor:
- platform: template
sensors:
jeff_location:
friendly_name: "Jeff's Current Location"
unit_of_measurement: ''
value_template: >-
{%- if is_state('device_tracker.jeffreystonesiphone', 'not_home') %}
{%- if states.device_tracker.life360_jeffrey_stone.attributes.moving == True %}
Flue Network
{%- elif states.device_tracker.life360_jeffrey_stone.attributes.driving == True %}
Flue Network
{% else %}
Lost
{%- endif %}
{% elif is_state('device_tracker.jeffreystonesiphone', 'Sprouts') %}
Grocery Store
{% elif is_state('device_tracker.jeffreystonesiphone', 'Kroger Grayson') %}
Grocery Store
{% elif is_state('device_tracker.jeffreystonesiphone', 'Kroger Snellville') %}
Grocery Store
{% elif is_state('device_tracker.jeffreystonesiphone', 'Home Depot') %}
Home Improvement Store
{% elif is_state('device_tracker.jeffreystonesiphone', 'Lowes') %}
Home Improvement Store
{% elif is_state('device_tracker.jeffreystonesiphone', 'Walmart') %}
Super Store
{% elif is_state('device_tracker.jeffreystonesiphone', 'Target') %}
Super Store
{% else %}
{{ states.device_tracker.jeffreystonesiphone.state }}
{%- endif %}
- platform: template
sensors:
skylar_location:
friendly_name: "Skylar's Current Location"
unit_of_measurement: ''
value_template: >-
{%- if is_state('device_tracker.jeffreystonesiphone', 'home') and is_state('device_tracker.katherinestonesiphone', 'home')%}
home
{% else %}
Mortal Peril
{%- endif %}
- platform: template
sensors:
kat_location:
friendly_name: "Kat's Current Location"
unit_of_measurement: ''
value_template: >-
{%- if is_state('device_tracker.katherinestonesiphone', 'not_home') %}
{%- if states.device_tracker.life360_kat_stone.attributes.moving == True %}
Flue Network
{% elif states.device_tracker.life360_kat_stone.attributes.driving == True %}
Flue Network
{% else %}
Lost
{%- endif %}
{% elif is_state('device_tracker.katherinestonesiphone', 'Sprouts') %}
Grocery Store
{% elif is_state('device_tracker.katherinestonesiphone', 'Kroger Grayson') %}
Grocery Store
{% elif is_state('device_tracker.katherinestonesiphone', 'Kroger Snellville') %}
Grocery Store
{% elif is_state('device_tracker.katherinestonesiphone', 'Home Depot') %}
Home Improvement Store
{% elif is_state('device_tracker.katherinestonesiphone', 'Lowes') %}
Home Improvement Store
{% elif is_state('device_tracker.katherinestonesiphone', 'Walmart') %}
Super Store
{% elif is_state('device_tracker.katherinestonesiphone', 'Target') %}
Super Store
{% else %}
{{ states.device_tracker.katherinestonesiphone.state }}
{%- endif %}
- platform: mqtt
name: "Family Status"
state_topic: "house/family/status"
payload_available: "online"
payload_not_available: "offline"
- platform: template
sensors:
jeff_home:
value_template: >-
{{ is_state('device_tracker.jeffreystonesiphone', 'home')
or is_state('device_tracker.hass_jeffsiphone', 'home')
or is_state('device_tracker.life360_jeffrey_stone', 'home') }}
- platform: template
sensors:
kat_home:
value_template: >-
{{ is_state('device_tracker.katherinestonesiphone', 'home')
or is_state('device_tracker.life360_kat_stone', 'home') }}
- platform: template
sensors:
family_home:
value_template: >-
{{ is_state('device_tracker.jeffreystonesiphone', 'home')
or is_state('device_tracker.hass_jeffsiphone', 'home')
or is_state('device_tracker.life360_jeffrey_stone', 'home')
or is_state('device_tracker.katherinestonesiphone', 'home')
or is_state('device_tracker.life360_kat_stone', 'home')
or is_state('sensor.family_status', 'Home') }}

View File

@ -120,38 +120,13 @@ automation:
- id: door_chime
alias: Door Chine
trigger:
- entity_id: binary_sensor.front_door_contact_2
- platform: state
entity_id:
- binary_sensor.front_door_contact_2
- binary_sensor.laundry_room_door_contact_2
- binary_sensor.attic_door_contact_2
- binary_sensor.back_door_contact_2
from: 'off'
platform: state
to: 'on'
- entity_id: binary_sensor.front_door_contact_2
from: 'on'
platform: state
to: 'off'
- entity_id: binary_sensor.laundry_room_door_contact_2
from: 'off'
platform: state
to: 'on'
- entity_id: binary_sensor.laundry_room_door_contact_2
from: 'on'
platform: state
to: 'off'
- entity_id: binary_sensor.attic_door_contact_2
from: 'off'
platform: state
to: 'on'
- entity_id: binary_sensor.attic_door_contact_2
from: 'on'
platform: state
to: 'off'
- entity_id: binary_sensor.back_door_contact_2
from: 'off'
platform: state
to: 'on'
- entity_id: binary_sensor.back_door_contact_2
from: 'on'
platform: state
to: 'off'
condition:
- condition: state
entity_id: input_boolean.audible_notifications
@ -166,51 +141,21 @@ automation:
- id: security_breach_door
alias: Security Breach Doors
trigger:
- entity_id: binary_sensor.front_door_contact_2
- platform: state
entity_id:
- binary_sensor.front_door_contact_2
- binary_sensor.laundry_room_door_contact_2
- binary_sensor.attic_door_contact_2
- binary_sensor.back_door_contact_2
from: 'off'
platform: state
to: 'on'
- entity_id: binary_sensor.front_door_contact_2
from: 'on'
platform: state
to: 'off'
- entity_id: binary_sensor.back_door_2
from: 'off'
platform: state
to: 'on'
- entity_id: binary_sensor.back_door_2
from: 'on'
platform: state
to: 'off'
- entity_id: binary_sensor.laundry_room_door_contact_2
from: 'off'
platform: state
to: 'on'
- entity_id: binary_sensor.laundry_room_door_contact_2
from: 'on'
platform: state
to: 'off'
- entity_id: binary_sensor.side_door_contact_2
from: 'off'
platform: state
to: 'on'
- entity_id: binary_sensor.side_door_contact_2
from: 'on'
platform: state
to: 'off'
- entity_id: binary_sensor.attic_door_contact_2
from: 'on'
platform: state
to: 'off'
- entity_id: binary_sensor.garage_door
from: 'on'
platform: state
to: 'off'
condition:
- condition: state
entity_id: input_boolean.sentry_mode
state: 'on'
action:
- service: script.jarvis_notify
data_template:
message: "The {{ trigger.to_state.attributes.friendly_name }} has been opened."
- service: input_boolean.turn_on
entity_id: input_boolean.security_issue
initial_state: true

View File

@ -81,8 +81,12 @@ automation:
- binary_sensor.iss
to: 'on'
from: 'off'
condition:
- condition: state
entity_id: input_boolean.audible_notifications
state: 'on'
action:
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: !include ../templates/iss_report.yaml

View File

@ -118,7 +118,7 @@ automation:
- condition: template
value_template: "{{ (('Severe' in states.sensor.nws_alerts.attributes.title) or ('Thunderstorm' in states.sensor.nws_alerts.attributes.title)) and 'Warning' in states.sensor.nws_alerts.attributes.title }}"
action:
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: >
{% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
@ -140,7 +140,7 @@ automation:
"The weather outside is getting intense, so I just made a weather announcement.",
"Anchorage House monitors the NWS using #HomeAssistant just for these occasions. Thanks for the heads up @NWSAtlanta " ] | random }}'
- delay: '00:00:15'
- service: script.voice_notify
- service: script.jarvis_voice
data_template:
message: >
{% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
@ -170,7 +170,7 @@ automation:
- condition: template
value_template: "{{ 'Tornado Warning' in states.sensor.nws_alerts.attributes.title}}"
action:
- service: script.alert_notify
- service: script.jarvis_alert
data_template:
message: "Attention!,,,Attention!,,,The National Weather Service Has issued a Tornado Warning for our area."
- service: script.twitter_notify
@ -179,7 +179,7 @@ automation:
"Anchorage House is heading to the closet because the NWS just issued a tornado warning for our area.",
"I just activated the internal Tornado Alarm at the request of the NWS. Thanks for the heads up @NWSAtlanta " ] | random }}'
- delay: '00:00:15'
- service: script.alert_notify
- service: script.jarvis_alert
data_template:
message: "Attention!,,,Attention!,,,The National Weather Service Has issued a Tornado Warning for our area."
- delay: '00:00:15'