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: []

View File

@ -1,52 +0,0 @@
###################################
## Garadget Stuff - [Garadget](http://amzn.to/2jQLpVQ) - Garage Door opener/sensor
###################################
- alias: 'Wind Speed Garage Door Check'
#
trigger:
- platform: numeric_state
entity_id: sensor.dark_sky_wind_speed
above: 20
condition:
- condition: or
conditions:
- condition: template
value_template: "{{ states('cover.large_garage') == 'opened' }}"
- condition: template
value_template: "{{ states('cover.small_garage') == 'opened'}}"
action:
- service: script.notify_engine
data_template:
value1: 'Check Garage Doors:'
value2: "Small: {{ states('cover.small_garage')}}"
value3: "Large: {{ states('cover.large_garage')}}"
- service: input_boolean.turn_on
entity_id: input_boolean.alert_mode
- service: script.speech_engine
data_template:
value1: >
"The winds are picking up outside. The wind speed is {{ states('sensor.dark_sky_wind_speed')|round}} miles per hour. For safety, please close the garage doors.
{% if is_state('cover.large_garage', 'open') -%}
The Large Garage Door is open
{% endif -%}
{% if is_state('cover.small_garage', 'open') -%}
{% if is_state('cover.large_garage', 'open') -%}and
{%- endif %} The small Garage Door is open.
{% endif %}"
- service: script.tweet_engine_image
data_template:
tweet: >
{{ [
"Wind speed is {{ states('sensor.dark_sky_wind_speed')|round}} miles per hour. For safety, I'm going to close the @garadget doors.",
"Getting pretty windy! {{ states('sensor.dark_sky_wind_speed')|round}}MPH. Time to ask @Garadget to close the garage doors."
] | random + "(http://amzn.to/2jQLpVQ)"}}
image: >-
{{ [
"/config/www/custom_ui/floorplan/images/branding/windy.png"
] | random }}

View File

@ -1,19 +0,0 @@
######################################################################
## Garage Status Announcements - Only during normal hours.
######################################################################
- alias: 'Garage Door closed'
trigger:
- platform: state
entity_id:
- cover.large_garage
- cover.small_garage
from: 'open'
to: 'closed'
for: '00:02:00'
action:
- service: script.speech_engine
data_template:
DoorClosed: "The {{ trigger.to_state.name }} is now {{ trigger.to_state.state }}."
call_garage_check: 1

View File

@ -1,28 +0,0 @@
######################################################################
## Garage Status Announcements
######################################################################
- alias: 'Garage Opened'
trigger:
- platform: state
entity_id:
- cover.large_garage
- cover.small_garage
from: 'closed'
to: 'open'
for: '00:02:30'
action:
- service_template: >
{% set hour=states("sensor.time").split(':')[0] | int %}
{% if hour >= 7 and hour <= 9 and states.input_boolean.school_mode.state == 'on'%}
input_boolean.turn_off
{% else %}
input_boolean.turn_on
{% endif %}
entity_id: input_boolean.alert_mode
- service: script.speech_engine
data_template:
value1: "The {{ trigger.entity_id.split('.')[1]|replace('_', ' ') }} is now {{ (trigger.to_state.state)|replace('_', ' ') }}."
call_garage_check: 1

View File

@ -4,3 +4,7 @@ Family:
- device_tracker.carlo_xsmax_3
- device_tracker.stacey
- device_tracker.stacey_6s
Arriving:
name: Arriving
entities: []