If so, I created 2 input_booleans:
kay_home_manual:
name: "Kay"
initial: on
peter_home_manual:
name: "Peter"
initial: on
Then 2 automations. When device_trackers are on then turn on the input_boolean.
(When 1 device_tracker become offline I’m still at home. Otherwise all are off.
# _____ _____ __ __ __ _____ _____ _____ _ _____ _____ _____ _____ _____ _____
# | | | _ | | | | | | __| __|_ _| / | | _ | __ | __ | | | | __|
# | -| |_ _| | |__| __| __| | | / / | | -| -|- -| | | __|
# |__|__|__|__| |_| |_____|_____|__| |_| |_/ |__|__|__|__|__|__|_____|\___/|_____|
###########################################################################################
# SYSTEM WHEN AUTOMATION TRACKER NOT WORK WE CAN MANUAL TURN ON OFF OF KAY IS AT HOME OR NOT
###########################################################################################
###########################################################################################
- id: "arrive_left_kay_manual"
alias: "System - Kay Left or Arrive Locative or GeoFency Manual"
trigger:
- platform: state
entity_id:
- device_tracker.e7b5aad4_fc4c_4ee8_98fd_2337da788a0f
- device_tracker.kay_iphone_geofency
action:
- service: "{{ 'input_boolean.turn_on' if trigger.to_state.state == 'home' else 'input_boolean.turn_off' }}"
entity_id: input_boolean.kay_home_manual
Here it create a group that will be used in the automation later on to greets 1 of 2 or both persons:
# _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
# | | __ | __| _ |_ _| __| | _ | __ | __ | | | | __| | __| __ | | | | _ |
# | --| -| __| | | | | __| | | -| -|- -| | | __| | | | -| | | | | __|
# |_____|__|__|_____|__|__| |_| |_____| |__|__|__|__|__|__|_____|\___/|_____| |_____|__|__|_____|_____|__|
###########################################################################################
# CREATE A GROUP.ARRIVING for "Notify - Greets People Home" automation
###########################################################################################
###########################################################################################
- id: "create_arrive_group"
alias: "System - Create group.arriving for Greetings People Engine"
trigger:
- platform: state
entity_id:
- input_boolean.kay_home_manual
- input_boolean.peter_home_manual
from: "off"
to: "on"
action:
- service: group.set
data:
object_id: "arriving"
add_entities: "{{ trigger.to_state.entity_id }}"
- id: "arrive_left_peter_manual"
alias: "System - Peter Left or Arrive Locative or GeoFency Manual"
trigger:
- platform: state
entity_id:
device_tracker.peter_iphone_ios_app
# - device_tracker.1717fe36_3c70_4599_963c_b70b6ee95eba
# - device_tracker.peter_iphone_geofency
action:
- service: "{{ 'input_boolean.turn_on' if trigger.to_state.state == 'home' else 'input_boolean.turn_off' }}"
entity_id: input_boolean.peter_home_manual
- choose:
- conditions:
- condition: state
entity_id: input_boolean.kay_home_manual
state: "on"
sequence:
- service: script.none
This will use group to see if 1 person or 2 persons went home… and Alexa will greet us in person or both
# _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____
# | _ | __| __ | __| | | | | _ | __ | __ | | | | __|
# | __| __| -|__ | | | | | | | | -| -|- -| | | __|
# |__| |_____|__|__|_____|_____|_|___| |__|__|__|__|__|__|_____|\___/|_____|
###########################################################################################
# NOTIFY and GREETS PERSON WHO WENT HOME
###########################################################################################
- id: "notify_me_when_person_arrived"
alias: "Notification - Greets People Home"
trigger:
- platform: state
entity_id:
- input_boolean.peter_home_manual
- input_boolean.kay_home_manual
from: "off"
to: "on"
action:
- wait_template: "{{ is_state('binary_sensor.fibaro_door_window_sensor_2_access_control_window_door_is_open_2', 'on') }}" # Frontdoor Sensor
# wait 10 seconds when the frontdoor went open
- delay: "00:00:10"
###########################################################################################
# GROUP.ARRIVING is created in create_arrive_group.yaml
###########################################################################################
- service: "{{ 'script.engine_say' if states.media_player.peter_s_2nd_echo_dot.state is defined else 'script.none' }}"
data:
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) -%}
{{ [
"Welcome back home " ~ person,
"You had me at hello " ~ person,
"Guess who is home? " ~ person ~ is_are ,
"The wifi just got a little more crowded. Welcome Home " ~ person,
"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, you’re back where you belong. Welcome home " ~ person,
"Hey there " ~ person + " Welcome Home!",
"Knock Knock. Who is There? " ~ person ~ is_are ,
"The front door just told me that " ~ person ~ is_are +" 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_are +" home.",
"I am sensing a disturbance in the force. " ~ person +" must be home!",
"And the house becomes a home. Welcome back " ~ person,
"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!",
"It looks like "~person ~ is_are + " finally home! I will get the house ready for you. ",
person ~ is_are + " now in the house.",
person + " can not hide from the system. Welcome home.",
person ~ "! You are 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."
] | random }}
{%- endmacro -%}
{{greeting_sentence(person, is_are)}}
- service: group.set
data:
object_id: "arriving"
entities: []