Continue refactor of speech engine

This commit is contained in:
Jeffrey Stone 2019-07-15 21:40:39 -04:00
parent a10cc41998
commit 76e52ce7a7
6 changed files with 68 additions and 244 deletions

View File

@ -75,6 +75,7 @@ automation:
call_weather_alerts: 1
call_overnight_forecast: 1
call_upcoming_holidays: 1
call_reminders: 1
call_chores: 1
- id: good_morning_report
@ -94,6 +95,8 @@ automation:
call_current_conditions_inside: 1
call_daily_forecast: 1
call_upcoming_birthdays: 1
call_reminders: 1
call_chores: 1
- service: script.twitter_notify
data:
message: 'I just provided a morning briefing including weather, and traffic

View File

@ -58,118 +58,4 @@ automation:
data:
name: Camping
type: trip
date: 09/10/2019
- id: first_day_info
alias: First Day Info
initial_state: true
trigger:
- platform: time
at: '00:10:00'
condition:
- condition: template
value_template: >
{% set day=states("sensor.date").split('-')[2] | int %}
{%- if day == 1 -%}
true
{%- endif -%}
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_github
data_template:
message: >-
"Its a new month, so this is a good time to remind you that I am powered by @homeassistant and configured by @thejeffreystone. Find my code at https://github.com/thejeffreystone/home-assistant-configuration"
- id: tweet_new_ha_version
alias: Tweet New HA Version
trigger:
- platform: state
entity_id: updater.updater
action:
- service: script.twitter_new_ha
- id: tweet_some_snark
alias: Tweet Some Snark
initial_state: true
trigger:
- platform: time
at: '08:00:00'
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_snark
- id: tweet_some_stats
alias: Tweet Some Stats
initial_state: true
trigger:
- platform: time
at: '08:00:00'
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_stats
- id: bot_info
alias: Bot Info
initial_state: true
trigger:
- platform: time
at: '10:00:00'
condition:
- condition: template
value_template: >
{% set day=states("sensor.date").split('-')[2] | int %}
{%- if day == 15 -%}
true
{%- endif -%}
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_notify
data_template:
message: >-
"This is a good time to remind you that I am a bot powered by @home_assistant and configured by @thejeffreystone. Find my code at https://github.com/thejeffreystone/home-assistant-configuration"
- id: rex_manning_day_tweet_1
alias: Rex Manning Day Tweet One
initial_state: true
trigger:
- platform: time
at: '08:00:00'
condition:
- condition: state
entity_id: calendar.anchorage_holidays
state: "on"
- condition: template
value_template: >
{%- set event=states.calendar.anchorage_holidays.attributes.message %}
{%- if event == 'Rex Manning Day' %}
true
{%- endif -%}
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_notify
data_template:
message: >-
"Happy Rex Manning Day! https://www.youtube.com/watch?v=30fw5My1QJM #damntheman #savetheempire"
- id: rex_manning_day_tweet_2
alias: Rex Manning Day Tweet Two
initial_state: true
trigger:
- platform: time
at: '13:00:00'
condition:
- condition: state
entity_id: calendar.anchorage_holidays
state: "on"
- condition: template
value_template: >
{%- set event=states.calendar.anchorage_holidays.attributes.message %}
{%- if event == 'Rex Manning Day' %}
true
{%- endif -%}
action:
- delay: '0{{ (range(1, 5)|random|int) }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:00'
- service: script.twitter_notify
data_template:
message: >-
"We mustn't dwell. No, not today. We can't. Not on Rex Manning day! https://www.youtube.com/watch?v=szvt8iWJ0oo #damntheman #savetheempire"
date: 09/10/2019

View File

@ -6,56 +6,16 @@
###############################################################################
automation:
- 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.",
"I have switched to the system to guest mode.",
"I have enabled guest mode. ",
"Guest Mode is on."
] | random }}
- id: sentry_mode_feedback
alias: Sentry Mode Audio Feedback
trigger:
- platform: state
entity_id:
- input_boolean.sentry_mode
from: 'off'
to: 'on'
action:
- service: script.jarvis_voice
data_template:
message: >
{{ [
"Sentry Mode has been enabled.",
"Anchorage House is secure.",
"I have enabled sentry mode. ",
"I am monitoring Anchorage House."
] | random }}
script:
activate_house_party_protocol:
sequence:
- service: script.jarvis_voice
data_template:
message: !include ../templates/jarvis_confirmations.yaml
- delay:
seconds: 3
- service: scene.turn_on
entity_id: scene.house_party_protocol
- service: script.jarvis_voice
- service: script.ah_report
data_template:
message: >
speech_message: >
{{ [
"Anchorage House has been configured for a House Party.",
"Incense has been turned on.",

View File

@ -245,26 +245,6 @@ script:
</speak>
cache: true
# speech_jarvis:
# sequence:
# - condition: state
# entity_id: binary_sensor.quiet_time
# state: 'off'
# - service: tts.amazon_polly_say
# data_template:
# 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
ah_report:
sequence:
- condition: or
@ -302,6 +282,9 @@ script:
"No Problem.",
"I think I can handle that.",
"Working on it now.",
"Why not. It's not like I ever sleep.",
"As Always, a great pleasure watching you work.",
"I am afraid I can't do that Dave,,,I'm kidding.",
"Funny, I was just about to do that. "
] | random }}
{% endmacro %}
@ -522,14 +505,22 @@ script:
{% else %}
{% endif %}
{% endmacro %}
{% macro reminders() %}
{% if is_state("input_boolean.heartworm", "on") %}
Today is the day Winston gets his heartworm medicine.
{% endif %}
{% endmacro %}
{% macro chores() %}
Be sure to make your bed!
{% if is_state("sensor.weekday", "mon") %}
{{ [ "Don't forget tomorrow is Trash Day. ",
"I advise you move the trash cans to the curb for the weekly pickup. ",
" The trash and recycle should go out"
] | random }}
{% endif %}
{% endmacro %}
{% macro door_status() %}
@ -797,6 +788,10 @@ script:
{% if call_clothes_suggestion == 1 %}
{{ clothes_suggestion() }}
{% endif %}
{% if call_reminders == 1 %}
{{ reminders() }}
{% endif %}
{% if call_chores == 1 %}
{{ chores() }}
@ -888,40 +883,6 @@ script:
data_template:
message: !include ../templates/twitter_new_ha.yaml
###############################################################################
# Morning Report
###############################################################################
# morning_report:
# sequence:
# - service: script.jarvis_voice
# data_template:
# message: !include ../templates/morning_report.yaml
###############################################################################
# Skylar Get Dressed
###############################################################################
# skylar_morning_greeting:
# sequence:
# - service: script.jarvis_voice
# data_template:
# message: !include ../templates/skylar_morning.yaml
###############################################################################
# Nightly Report
###############################################################################
# nightly_report:
# sequence:
# - 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
###############################################################################
# Weather Report
###############################################################################
@ -986,13 +947,3 @@ script:
- service: script.ah_report
data:
call_kat_headed_home: 1
###############################################################################
# Prebed Routing
###############################################################################
# prebed_routine:
# sequence:
# - service: script.jarvis_voice
# data_template:
# message: !include ../templates/skylar_night.yaml
# # message: >
# # Bed time is in 30 mins. If you are taking a bath now is the time to get in the tub, otherwise time to put on pajamas and brush teeth.

View File

@ -155,9 +155,10 @@ automation:
entity_id: input_boolean.audible_notifications
state: 'on'
action:
- service: script.jarvis_voice
- service: script.ah_report
data_template:
message: "I thought you might like to know, the {{ trigger.to_state.attributes.friendly_name }} has been standing open for more than a minute."
speech_message: " the {{ trigger.to_state.attributes.friendly_name }} has been standing open for more than a minute."
call_interuption: 1
initial_state: true
- id: garage_opened_night
@ -202,7 +203,7 @@ automation:
entity_id: input_boolean.sentry_mode
state: 'on'
action:
- service: script.jarvis_notify
- service: script.jarvis_alert
data_template:
message: "My security protocols are being overidden,, The {{ trigger.to_state.attributes.friendly_name }} has been opened."
- service: script.text_alert
@ -222,9 +223,9 @@ automation:
from: 'off'
to: 'on'
action:
- service: script.jarvis_voice
data:
message: >
- service: script.ah_report
data_template:
speech_message: >
{{ [
"Barn door protocol has been activated.",
"Anchorage House has been secured! ",
@ -241,15 +242,34 @@ automation:
from: 'on'
to: 'off'
action:
- service: script.jarvis_voice
data:
message: >
- service: script.ah_report
data_template:
speech_message: >
{{ [
"Barn door protocol has been deactivated.",
"I am no longer monitoring the access points. ",
"Sentry Mode has been switched off. "
] | random }}
- 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.ah_report
data_template:
speech_message: >
{{ [
"Guest Mode has been enabled.",
"I have switched to the system to guest mode.",
"I have enabled guest mode. ",
"Guest Mode is on."
] | random }}
script:
lockdown_issue:
sequence:
@ -367,25 +387,29 @@ script:
activate_barn_door_protocol:
sequence:
- service: script.jarvis_voice
data_template:
message: !include ../templates/jarvis_confirmations.yaml
- service: script.ah_report
data:
call_confirmation: 1
- delay:
seconds: 2
- service: input_boolean.turn_on
entity_id: input_boolean.sentry_mode
deactivate_barn_door_protocol:
sequence:
- service: script.jarvis_voice
data_template:
message: !include ../templates/jarvis_confirmations.yaml
- service: script.ah_report
data:
call_confirmation: 1
- delay:
seconds: 2
- service: input_boolean.turn_off
entity_id: input_boolean.sentry_mode
activate_guest_mode:
sequence:
- service: script.jarvis_voice
data_template:
message: !include ../templates/jarvis_confirmations.yaml
- service: script.ah_report
data:
call_confirmation: 1
- delay:
seconds: 2
- service: input_boolean.turn_on

View File

@ -119,9 +119,9 @@ 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.jarvis_voice
- service: script.ah_report
data_template:
message: >
speech_message: >
{% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] }}
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] is defined %}
@ -141,9 +141,9 @@ 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.jarvis_voice
- service: script.ah_report
data_template:
message: >
speech_message: >
{% if states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] is defined %}
The National Weather Service Has issued a {{ states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[5] }}
{% elif states.sensor.nws_alerts.attributes.spoken_desc.split('\n\n-\n\n')[4] is defined %}