mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-06-15 09:12:57 +00:00
Implement speech partials
This commit is contained in:
+2
-1
@@ -106,8 +106,9 @@ tts:
|
||||
- platform: amazon_polly
|
||||
aws_access_key_id: !secret aws_polly_client_id
|
||||
aws_secret_access_key: !secret aws_polly_client_secret
|
||||
region_name: eu-central-1
|
||||
region_name: us-east-1
|
||||
voice: Amy
|
||||
engine: neural
|
||||
|
||||
# https://www.home-assistant.io/integrations/tuya
|
||||
tuya:
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
input_boolean:
|
||||
speech_notifications:
|
||||
name: Speech notifications
|
||||
initial: on
|
||||
icon: mdi:chat
|
||||
|
||||
script:
|
||||
talk_with_partials:
|
||||
alias: Speech - Talk with combined partials
|
||||
sequence:
|
||||
- service: script.talk
|
||||
data_template:
|
||||
message: >-
|
||||
{%- for partial in partials -%}
|
||||
{{ partial }}{{ " " }}
|
||||
{%- endfor -%}
|
||||
|
||||
talk:
|
||||
alias: Speech - Talk
|
||||
sequence:
|
||||
@@ -20,7 +29,8 @@ script:
|
||||
sequence:
|
||||
- service_template: >
|
||||
{% if is_state('media_player.master_bedroom', 'playing')
|
||||
or is_state('input_boolean.speech_notifications', 'off') %}
|
||||
or is_state('input_boolean.speech_notifications', 'off')
|
||||
or is_state('input_boolean.georgi_home', 'off') %}
|
||||
script.telegram_say
|
||||
{% else %}
|
||||
script.sonos_blast
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
script:
|
||||
routine_briefing:
|
||||
alias: Routine - Briefing
|
||||
sequence:
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
volume_level: 0.3
|
||||
- service: script.talk
|
||||
data_template:
|
||||
message: !include ../../templates/briefing.yaml
|
||||
@@ -9,14 +9,14 @@ script:
|
||||
alias: Routine - Coming home
|
||||
sequence:
|
||||
- service: script.security_camera_off
|
||||
- service: script.coming_home_say_welcome
|
||||
- service: light.turn_on
|
||||
entity_id: light.living_room_all_lights
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.speech_notifications
|
||||
- condition: state
|
||||
entity_id: input_boolean.routine_welcome_home
|
||||
state: "on"
|
||||
- delay: "00:00:01"
|
||||
- service: script.coming_home_say_welcome
|
||||
- delay: "00:00:15"
|
||||
- service: media_player.shuffle_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
@@ -37,9 +37,19 @@ script:
|
||||
coming_home_say_welcome:
|
||||
alias: Routine - Coming home - Say welcome
|
||||
sequence:
|
||||
- condition: state
|
||||
entity_id: input_boolean.routine_welcome_home
|
||||
state: "on"
|
||||
- service: script.sonos_blast
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
message: "Welcome home, George!"
|
||||
volume_level: 0.5
|
||||
- service: script.talk_with_partials
|
||||
data_template:
|
||||
partials:
|
||||
- !include ../../templates/partials/greeting.yaml
|
||||
- !include ../../templates/partials/window_check.yaml
|
||||
- >-
|
||||
{{
|
||||
[
|
||||
"I'll play some music.",
|
||||
"Here's some music."
|
||||
] | random
|
||||
}}
|
||||
|
||||
@@ -15,5 +15,3 @@ script:
|
||||
entity_id:
|
||||
- light.living_room_all_lights
|
||||
- light.bedside_light
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.speech_notifications
|
||||
|
||||
@@ -2,7 +2,7 @@ script:
|
||||
routine_waking_up:
|
||||
alias: Routine - Waking up
|
||||
sequence:
|
||||
- service: script.routine_briefing
|
||||
- service: script.routine_morning_briefing
|
||||
- delay: "00:00:25"
|
||||
- service: script.talk
|
||||
data:
|
||||
@@ -14,3 +14,30 @@ script:
|
||||
source: "Evening Chill"
|
||||
- service: fan.turn_off
|
||||
entity_id: fan.philips_airpurifier
|
||||
|
||||
routine_morning_briefing:
|
||||
alias: Routine - Morning Briefing
|
||||
sequence:
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
volume_level: 0.3
|
||||
- service: script.talk_with_partials
|
||||
data_template:
|
||||
partials:
|
||||
- !include ../../templates/partials/greeting.yaml
|
||||
- >-
|
||||
{{
|
||||
[
|
||||
"Here's your briefing for today!",
|
||||
"Here's what's up!",
|
||||
"Here are the updates today!"
|
||||
] | random
|
||||
}}
|
||||
- !include ../../templates/partials/master_bedroom_climate.yaml
|
||||
- !include ../../templates/partials/outside_forecast.yaml
|
||||
- !include ../../templates/partials/light_check.yaml
|
||||
- !include ../../templates/partials/window_check.yaml
|
||||
- !include ../../templates/partials/iss.yaml
|
||||
- !include ../../templates/partials/moon.yaml
|
||||
- !include ../../templates/partials/inspirational_quote.yaml
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
>-
|
||||
|
||||
{%- macro light_check() -%}
|
||||
{%- if is_state('light.living_room_all_lights', 'on') -%}
|
||||
There are
|
||||
{%- for state in states.light if state.state == 'on' -%}
|
||||
{%if loop.last %} {{ loop.index }} {% endif %}
|
||||
{%- endfor -%}
|
||||
lights on right now.
|
||||
{%- else -%}
|
||||
There are no lights on right now.
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro window_check() -%}
|
||||
{%- if is_state('binary_sensor.living_room_right_window_on_off', 'on') -%}
|
||||
The living room window is opened.
|
||||
{%- endif -%}
|
||||
{%- if is_state('binary_sensor.bedroom_right_window_on_off', 'on') -%}
|
||||
The master bedroom window is opened.
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro inside_weather() -%}
|
||||
In the bedroom, it is {{ states('sensor.bedroom_weather_temperature') }} degrees with around {{ states('sensor.bedroom_weather_humidity') }} percent humidity.
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro outside_weather() -%}
|
||||
Outside, it's going to be {{ states('sensor.dark_sky_hourly_summary') }} Expect {{ states('sensor.dark_sky_daily_summary') }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro iss() -%}
|
||||
{% if is_state('binary_sensor.iss', 'on') -%}
|
||||
Here is something interesting. The international space station is above us now. There are {{ states.binary_sensor.iss.attributes['number_of_people_in_space'] }} people in space right now.
|
||||
{% endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro moon() -%}
|
||||
{%- if states.sensor.moon.state == 'Full moon' -%}
|
||||
{{ [
|
||||
"Check out the full moon tonight!",
|
||||
"Hey look, There is the full moon.",
|
||||
"The moon is huge! And full.",
|
||||
"If you want to see the full moon, tonight is the night."
|
||||
] | random }}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro inspirational_quote() -%}
|
||||
{%- set inspirational_quote = [
|
||||
"And one more thing, Life is about making an impact, make it a positive one.",
|
||||
"And one more thing, Whatever the mind of man can conceive and believe, it can achieve.",
|
||||
"And one more thing, Strive not to be a success, but rather to be of value.",
|
||||
"And one more thing, I attribute my overall success to never giving or taking an excuse.",
|
||||
"And one more thing, You miss one hundred percent of the shots you don’t take.",
|
||||
"And one more thing, The most difficult thing is the decision to act, the rest is merely tenacity.",
|
||||
"And one more thing, Every strike brings me closer to the next home run.",
|
||||
"And one more thing, Defining thepurpose is the starting point of all achievement.",
|
||||
"And one more thing, Life is not about getting and having, it's about giving and being.",
|
||||
"And one more thing, We become what we think about.",
|
||||
"And one more thing, Life is ten percent what happens to you and ninety percent of how you react to it.",
|
||||
"And one more thing, The most common way people give up their power is by thinking they do not have any.",
|
||||
"And one more thing, The mind is everything. What you think, you will become. ",
|
||||
"And one more thing, The best time to plant a tree was twenty years ago. The second best time is now.",
|
||||
"And one more thing, An unexamined life is not worth living.",
|
||||
"And one more thing, Eighty percent of success is showing up.",
|
||||
"And one more thing, Your time is limited, so do not waste it living someone elses life.",
|
||||
"And one more thing, Winning is not everything, but wanting to win is.",
|
||||
"And one more thing, I am not a product of my circumstances. I am a product of my decisions.",
|
||||
"And one more thing, You can never cross the ocean until you have the courage to lose sight of the shore.",
|
||||
"And one more thing, Either you run the day, or the day runs you.",
|
||||
"And one more thing, Whether you think you can or you think you cannot, you will be right.",
|
||||
"And one more thing, The two most important days in your life are the day you are born and the day you find out why.",
|
||||
"And one more thing, Whatever you can do, or dream you can, begin it. Boldness has genius, power, and magic in it.",
|
||||
"And one more thing, The best revenge is massive success.",
|
||||
"And one more thing, The universe can’t put good into your hands unless you let go of the bad.",
|
||||
"And one more thing, People often say that motivation does not last. Well, neither does bathing. That is why we recommend it daily.",
|
||||
"And one more thing, Life shrinks or expands in proportion to ones courage.",
|
||||
"And one more thing, If you hear a voice within you say you cannot paint, then by all means paint and that voice will be silenced.",
|
||||
"And one more thing, There is only one way to avoid criticism: do nothing, say nothing, and be nothing.",
|
||||
"And one more thing, Ask and it will be given to you; search, and you will find; knock and the door will be opened for you.",
|
||||
"And one more thing, The only person you are destined to become is the person you decide to be.",
|
||||
"And one more thing, Go confidently in the direction of your dreams. Live the life you have imagined.",
|
||||
"And one more thing, Certain things catch your eye, but pursue only those that capture the heart.",
|
||||
"And one more thing, Believe you can and you are halfway there.",
|
||||
"And one more thing, Everything you have ever wanted is on the other side of fear.",
|
||||
"And one more thing, Start where you are. Use what you have. Do what you can.",
|
||||
"And one more thing, Fall seven times and stand up eight.",
|
||||
"And one more thing, Everything has beauty, but not everyone can see.",
|
||||
"And one more thing, Life is not measured by the number of breaths we take, but by the moments that take our breath away.",
|
||||
"And one more thing, Happiness is not something readymade. It comes from your own actions.",
|
||||
"And one more thing, If you are offered a seat on a rocket ship, do not ask what seat! Just get on.",
|
||||
"And one more thing, If the wind will not serve, take to the oars.",
|
||||
"And one more thing, You can not fall if you do not climb. But there’s no joy in living your whole life on the ground.",
|
||||
"And one more thing, Too many of us are not living our dreams because we are living our fears.",
|
||||
"And one more thing, Challenges are what make life interesting and overcoming them is what makes life meaningful.",
|
||||
"And one more thing, If you want to lift yourself up, lift up someone else.",
|
||||
"And one more thing, Be nice to others and nice things will happen to you.",
|
||||
"And one more thing, It is nice to be important, but more important to be nice."
|
||||
] -%}
|
||||
{{inspirational_quote|random}}
|
||||
{%- endmacro -%}
|
||||
|
||||
|
||||
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
|
||||
Good morning.
|
||||
{% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
|
||||
Good afternoon.
|
||||
{% else %}
|
||||
Good evening.
|
||||
{% endif %}
|
||||
|
||||
{{ [
|
||||
"Here's your briefing for today!",
|
||||
"Here's what's up!",
|
||||
"Here are the updates today!"
|
||||
]|random }}
|
||||
|
||||
{{ inside_weather() }}
|
||||
{{ outside_weather() }}
|
||||
{{ light_check() }}
|
||||
{{ window_check() }}
|
||||
{{ iss() }}
|
||||
{{ moon() }}
|
||||
{{ inspirational_quote() }}
|
||||
@@ -0,0 +1,9 @@
|
||||
>-
|
||||
|
||||
{%- if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 -%}
|
||||
Good morning!
|
||||
{%- elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 -%}
|
||||
Good afternoon!
|
||||
{%- else -%}
|
||||
Good evening!
|
||||
{%- endif -%}
|
||||
@@ -0,0 +1,3 @@
|
||||
>-
|
||||
|
||||
It's {{ states('sensor.bedroom_weather_temperature') | round }} degrees inside.
|
||||
@@ -0,0 +1,55 @@
|
||||
>-
|
||||
|
||||
{{
|
||||
[
|
||||
"And one more thing, Life is about making an impact, make it a positive one.",
|
||||
"And one more thing, Whatever the mind of man can conceive and believe, it can achieve.",
|
||||
"And one more thing, Strive not to be a success, but rather to be of value.",
|
||||
"And one more thing, I attribute my overall success to never giving or taking an excuse.",
|
||||
"And one more thing, You miss one hundred percent of the shots you don’t take.",
|
||||
"And one more thing, The most difficult thing is the decision to act, the rest is merely tenacity.",
|
||||
"And one more thing, Every strike brings me closer to the next home run.",
|
||||
"And one more thing, Defining thepurpose is the starting point of all achievement.",
|
||||
"And one more thing, Life is not about getting and having, it's about giving and being.",
|
||||
"And one more thing, We become what we think about.",
|
||||
"And one more thing, Life is ten percent what happens to you and ninety percent of how you react to it.",
|
||||
"And one more thing, The most common way people give up their power is by thinking they do not have any.",
|
||||
"And one more thing, The mind is everything. What you think, you will become. ",
|
||||
"And one more thing, The best time to plant a tree was twenty years ago. The second best time is now.",
|
||||
"And one more thing, An unexamined life is not worth living.",
|
||||
"And one more thing, Eighty percent of success is showing up.",
|
||||
"And one more thing, Your time is limited, so do not waste it living someone elses life.",
|
||||
"And one more thing, Winning is not everything, but wanting to win is.",
|
||||
"And one more thing, I am not a product of my circumstances. I am a product of my decisions.",
|
||||
"And one more thing, You can never cross the ocean until you have the courage to lose sight of the shore.",
|
||||
"And one more thing, Either you run the day, or the day runs you.",
|
||||
"And one more thing, Whether you think you can or you think you cannot, you will be right.",
|
||||
"And one more thing, The two most important days in your life are the day you are born and the day you find out why.",
|
||||
"And one more thing, Whatever you can do, or dream you can, begin it. Boldness has genius, power, and magic in it.",
|
||||
"And one more thing, The best revenge is massive success.",
|
||||
"And one more thing, The universe can’t put good into your hands unless you let go of the bad.",
|
||||
"And one more thing, People often say that motivation does not last. Well, neither does bathing. That is why we recommend it daily.",
|
||||
"And one more thing, Life shrinks or expands in proportion to ones courage.",
|
||||
"And one more thing, If you hear a voice within you say you cannot paint, then by all means paint and that voice will be silenced.",
|
||||
"And one more thing, There is only one way to avoid criticism: do nothing, say nothing, and be nothing.",
|
||||
"And one more thing, Ask and it will be given to you; search, and you will find; knock and the door will be opened for you.",
|
||||
"And one more thing, The only person you are destined to become is the person you decide to be.",
|
||||
"And one more thing, Go confidently in the direction of your dreams. Live the life you have imagined.",
|
||||
"And one more thing, Certain things catch your eye, but pursue only those that capture the heart.",
|
||||
"And one more thing, Believe you can and you are halfway there.",
|
||||
"And one more thing, Everything you have ever wanted is on the other side of fear.",
|
||||
"And one more thing, Start where you are. Use what you have. Do what you can.",
|
||||
"And one more thing, Fall seven times and stand up eight.",
|
||||
"And one more thing, Everything has beauty, but not everyone can see.",
|
||||
"And one more thing, Life is not measured by the number of breaths we take, but by the moments that take our breath away.",
|
||||
"And one more thing, Happiness is not something readymade. It comes from your own actions.",
|
||||
"And one more thing, If you are offered a seat on a rocket ship, do not ask what seat! Just get on.",
|
||||
"And one more thing, If the wind will not serve, take to the oars.",
|
||||
"And one more thing, You can not fall if you do not climb. But there’s no joy in living your whole life on the ground.",
|
||||
"And one more thing, Too many of us are not living our dreams because we are living our fears.",
|
||||
"And one more thing, Challenges are what make life interesting and overcoming them is what makes life meaningful.",
|
||||
"And one more thing, If you want to lift yourself up, lift up someone else.",
|
||||
"And one more thing, Be nice to others and nice things will happen to you.",
|
||||
"And one more thing, It is nice to be important, but more important to be nice."
|
||||
] | random
|
||||
}}
|
||||
@@ -0,0 +1,5 @@
|
||||
>-
|
||||
|
||||
{%- if is_state('binary_sensor.iss', 'on') -%}
|
||||
Here is something interesting. The international space station is above us now. There are {{ states.binary_sensor.iss.attributes['number_of_people_in_space'] }} people in space right now.
|
||||
{%- endif -%}
|
||||
@@ -0,0 +1,11 @@
|
||||
>-
|
||||
|
||||
{%- if is_state('light.living_room_all_lights', 'on') -%}
|
||||
There are
|
||||
{%- for state in states.light if state.state == 'on' -%}
|
||||
{%if loop.last %} {{ loop.index }} {% endif %}
|
||||
{%- endfor -%}
|
||||
lights on right now.
|
||||
{%- else -%}
|
||||
There are no lights on right now.
|
||||
{%- endif -%}
|
||||
@@ -0,0 +1,3 @@
|
||||
>-
|
||||
|
||||
In the bedroom, it is {{ states('sensor.bedroom_weather_temperature') | round }} degrees with around {{ states('sensor.bedroom_weather_humidity') | round }} percent humidity.
|
||||
@@ -0,0 +1,12 @@
|
||||
>-
|
||||
|
||||
{%- if states.sensor.moon.state == 'Full moon' -%}
|
||||
{{
|
||||
[
|
||||
"Check out the full moon tonight!",
|
||||
"Hey look, There is the full moon.",
|
||||
"The moon is huge! And full.",
|
||||
"If you want to see the full moon, tonight is the night."
|
||||
] | random
|
||||
}}
|
||||
{%- endif -%}
|
||||
@@ -0,0 +1,3 @@
|
||||
>-
|
||||
|
||||
Outside, it's going to be {{ states('sensor.dark_sky_hourly_summary') }} Expect {{ states('sensor.dark_sky_daily_summary') }}
|
||||
@@ -0,0 +1,9 @@
|
||||
>-
|
||||
|
||||
{%- if is_state('binary_sensor.living_room_right_window_on_off', 'on') -%}
|
||||
The living room window is opened.
|
||||
{%- endif -%}
|
||||
|
||||
{%- if is_state('binary_sensor.bedroom_right_window_on_off', 'on') -%}
|
||||
The master bedroom window is opened.
|
||||
{%- endif -%}
|
||||
Reference in New Issue
Block a user