Home-AssistantConfig/config/automation/Speech/announcements.yaml

82 lines
3.7 KiB
YAML
Raw Normal View History

2018-01-02 00:00:45 +00:00
########## ############################################################
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
2018-01-02 00:00:45 +00:00
## Announce when people come or go.
## Announce over all Chromecast Audios
2020-06-08 20:50:37 +00:00
# Read more at https://vCloudInfo.com
2018-01-02 00:00:45 +00:00
######################################################################
- alias: 'People Greeting'
trigger:
- platform: state
entity_id:
- device_tracker.carlo
- device_tracker.stacey
from: 'not_home'
to: 'home'
action:
# This Group is defined in the groups directory.
- service: group.set
data_template:
object_id: "arriving"
add_entities: >-
{{ trigger.to_state.entity_id }}
- wait_template: >-
{{ states.binary_sensor.kitchen_door.state == 'on' }}
- delay: '00:01:00'
2018-01-02 00:00:45 +00:00
- service: script.speech_engine
data_template:
# {% set person = state_attr(trigger.entity_id, "friendly_name")%} This is another way to do it.
# {% set person = trigger.entity_id.split('.')[1]|replace('_', ' ')%}
2018-01-02 00:00:45 +00:00
personarriving: >
{% set person = expand('group.arriving')|map(attribute='name')|join(' and ') %}
{% set peoplecount = expand('group.arriving') | count %}
{% if peoplecount == 1 %}
{% set is_are = ' is ' %}
{% else %}
{% set is_are = ' are ' %}
{% endif %}
{%- macro greeting_sentence(person, is_are) -%}
2018-01-02 00:00:45 +00:00
{{ [
"Welcome back home " ~ person,
"You had me at hello " ~ person,
"Guess who is home?" ~ person ~ is_are ,
2020-06-15 22:41:56 +00:00
"The wifi just got a little more crowded. Welcome Home" ~ person,
person ~ is_are + " now in the house.",
2018-01-02 00:00:45 +00:00
"Welcome Home " ~ person + ". We have missed you. Or at least Molly did.",
"Our home is now complete, Rest your head and relax your feet! Welcome Back " ~ person,
"Life is like a song, youre back where you belong. Welcome home " ~ person,
"Hey there " ~ person + " Welcome Home!",
"Knock Knock. Who is There? " ~ person ~ is_are ,
"The garage door opener just told me that " ~ person ~ is_are +" home.",
2018-09-27 14:16:52 +00:00
person + " can not hide from the system. Welcome home.",
2018-01-02 00:00:45 +00:00
person ~ "! You are home!",
"I know a secret! " ~ person ~ is_are +" home!",
2018-09-27 14:16:52 +00:00
"Hey " ~ person +". Your arrival has been recorded by the Smartest house on the block.",
"Take note Molly! " ~ person ~ is_are +" home.",
"I am sensing a disturbance in the force. " ~ person +" must be home!",
2018-06-25 22:04:25 +00:00
"And the house becomes a home. Welcome back " ~ person,
person ~ is_are + " now here. Hash tag Welcome Home.",
person ~ is_are + " now here. Hash tag Home.",
person ~ is_are + " now here. Hash tag Smart Home.",
2018-09-27 14:16:52 +00:00
"Just a quick announcement. " ~ person +" has arrived!",
"Hey" ~ person + "! High Five! Glad you are finally home.",
"Pardon the interruption but " ~ person ~ is_are +" home!",
"My systems are picking up the presence of additional humans. " ~ person ~ is_are +" being identified as home.",
"Welcome home "~person + "! It is nice to see you again! Let me turn on the lights. ",
2020-06-08 21:15:58 +00:00
"It looks like "~person ~ is_are + " finally home! I will get the house ready for you. "
2018-01-02 00:00:45 +00:00
] | random }}
{%- endmacro -%}
{{greeting_sentence(person, is_are)}}
2018-01-02 00:00:45 +00:00
call_responsibilities: 1
call_no_announcement: 1
call_garage_check: 1
call_window_check: 1
- service: group.set
data_template:
object_id: "arriving"
entities: []