mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-04-29 06:48:16 +00:00
Tweak speech. Add a separate music function
This commit is contained in:
14
packages/functions/music.yaml
Normal file
14
packages/functions/music.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
script:
|
||||
music_play:
|
||||
alias: "Music - Play"
|
||||
sequence:
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
volume_level: 0.3
|
||||
- service: media_player.select_source
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
source: "Evening Chill"
|
||||
- service: fan.turn_off
|
||||
entity_id: fan.philips_airpurifier
|
||||
@@ -7,9 +7,11 @@ script:
|
||||
say:
|
||||
alias: Speech - Say
|
||||
sequence:
|
||||
# Don't talk while in sleep mode.
|
||||
- condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: "off"
|
||||
# Combine partials for speech message.
|
||||
- service: script.say_discretely
|
||||
data_template:
|
||||
message: >-
|
||||
@@ -24,6 +26,7 @@ script:
|
||||
say_discretely:
|
||||
alias: Speech - Say discretely
|
||||
sequence:
|
||||
# Figure out whether to talk or send a text.
|
||||
- service_template: >
|
||||
{% if is_state('media_player.master_bedroom', 'playing')
|
||||
or is_state('input_boolean.speech_notifications', 'off')
|
||||
@@ -47,8 +50,13 @@ script:
|
||||
sequence:
|
||||
- service: media_player.volume_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
volume_level: 0.5
|
||||
data_template:
|
||||
volume_level: >-
|
||||
{% if now().strftime('%H')|int < 6 and now().strftime('%H')|int > 1 %}
|
||||
0.2
|
||||
{% else %}
|
||||
0.5
|
||||
{% endif %}
|
||||
- service: tts.amazon_polly_say
|
||||
data_template:
|
||||
entity_id: media_player.master_bedroom
|
||||
|
||||
@@ -11,6 +11,7 @@ automation:
|
||||
platform: homeassistant
|
||||
event: start
|
||||
action:
|
||||
- delay: 00:00:06
|
||||
- service: script.say
|
||||
data:
|
||||
message: "Hey! I was out for a bit, but I'm back online!"
|
||||
|
||||
@@ -8,25 +8,22 @@ script:
|
||||
routine_coming_home:
|
||||
alias: Routine - Coming home
|
||||
sequence:
|
||||
# Enter home mode.
|
||||
- service: script.security_camera_off
|
||||
- service: light.turn_on
|
||||
entity_id: light.living_room_all_lights
|
||||
|
||||
# Check if welcome home is enabled, proceed with welcome routine.
|
||||
- condition: state
|
||||
entity_id: input_boolean.routine_welcome_home
|
||||
state: "on"
|
||||
- delay: 00:00:03
|
||||
- service: script.coming_home_say_welcome
|
||||
|
||||
# TODO: Add condition for time - don't blast music late at night :)
|
||||
- delay: 00:00:03
|
||||
- service: media_player.shuffle_set
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
shuffle: true
|
||||
- service: media_player.select_source
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
source: Evening Chill
|
||||
# Wait a while for me to enter before welcoming.
|
||||
- delay: 00:00:02
|
||||
|
||||
- service: script.coming_home_say_welcome
|
||||
- delay: 00:00:13
|
||||
- service: script.music_play
|
||||
|
||||
coming_home_say_welcome:
|
||||
alias: Routine - Coming home - Say welcome
|
||||
|
||||
@@ -3,17 +3,12 @@ script:
|
||||
alias: Routine - Waking up
|
||||
sequence:
|
||||
- service: script.routine_morning_briefing
|
||||
- delay: 00:00:25
|
||||
- delay: 00:00:35
|
||||
- service: script.say
|
||||
data:
|
||||
message: "Here's some music to start the day!"
|
||||
- delay: 00:00:02
|
||||
- service: media_player.select_source
|
||||
entity_id: media_player.master_bedroom
|
||||
data:
|
||||
source: "Evening Chill"
|
||||
- service: fan.turn_off
|
||||
entity_id: fan.philips_airpurifier
|
||||
- service: script.music_play
|
||||
|
||||
routine_morning_briefing:
|
||||
alias: Routine - Morning Briefing
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
>-
|
||||
|
||||
{%- if is_state('group.all_windows', 'on') -%}
|
||||
{%- 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 -%}
|
||||
{%- 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 -%}
|
||||
{%- else -%}
|
||||
All windows are closed.
|
||||
{%- endif -%}
|
||||
|
||||
Reference in New Issue
Block a user