I think I have this implimented correctly now to handle more than one person as long as the system picks them up while in the garage. #767

This commit is contained in:
ccostan
2020-06-08 16:46:42 -04:00
parent 6908244972
commit 8a7a9cecba
5 changed files with 43 additions and 118 deletions

View File

@@ -1,6 +1,9 @@
########## ############################################################
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
## Announce when people come or go.
## Announce over all Chromecast Audios
# Read more at https://vCloudInfo.com
######################################################################
- alias: 'People Greeting'
@@ -9,50 +12,67 @@
entity_id:
- device_tracker.carlo
- device_tracker.stacey
- device_tracker.franco
- device_tracker.yolanda
from: 'not_home'
to: 'home'
for: '00:02:00'
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' }}
- 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('_', ' ')%}
personarriving: >
{% set person = trigger.entity_id.split('.')[1]|replace('_', ' ')%}
{%- macro greeting_sentence(person) -%}
{% 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) -%}
{{ [
"Welcome back home " ~ person,
"Guess who is home?" ~ person +" is!",
person + " is now in the house.",
"Guess who is home?" ~ person ~ is_are ,
person ~ is_are + " now in the house.",
"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!",
"The garage door opener just told me that " ~ person +" is home.",
"Knock Knock. Who is There? " ~ person ~ is_are ,
"The garage door opener just told me that " ~ person ~ is_are +" home.",
person + " can not hide from the system. Welcome home.",
person ~ "! You are home!",
"I know a secret! " ~ person +" is home!",
"I know a secret! " ~ person ~ is_are +" home!",
"Hey " ~ person +". Your arrival has been recorded by the Smartest house on the block.",
"Take note Molly! " ~ person +" is home.",
"Take note Molly! " ~ person ~ is_are +" home.",
"I am sensing a disturbance in the force. " ~ person +" must be home!",
"And the house becomes a home. Welcome back " ~ person,
person + " is now here. Hash tag Welcome Home.",
person + " is now here. Hash tag Home.",
person + " is now here. Hash tag Smart Home.",
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.",
"Just a quick announcement. " ~ person +" has arrived!",
"Pardon the interruption but " ~ person +" is home!",
"My systems are picking up the presence of additional humans. " ~ person +" has been identified as home.",
"Welcome home "~person~"! It is nice to see you again! Let me turn on the lights. ",
"It looks like "~person~" is finally home! I will get the house ready for you. "
"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. ",
"It looks like "~person ~ is_are + " finally home! I will get the house ready for you. "
] | random }}
{%- endmacro -%}
{{greeting_sentence(person)}}
{{greeting_sentence(person, is_are)}}
call_responsibilities: 1
call_no_announcement: 1
call_garage_check: 1
call_window_check: 1
- service: group.set
data_template:
object_id: "Arriving"
entities: []