Hi all, I am using the following automation and experiencing issues.
alias: Security - Family Arrival
description: Announces arrivals and disarms alarm.
trigger:
- platform: state
entity_id:
- device_tracker.ashleys_iphone
for:
hours: 0
minutes: 0
seconds: 15
to: home
id: ashley_tracker
- platform: state
entity_id:
- device_tracker.sm_g998b
for:
hours: 0
minutes: 0
seconds: 15
to: home
id: andrew_tracker
- platform: state
entity_id:
- group.family_all
id: Family_Arrived
from: not_home
to: home
for:
hours: 0
minutes: 0
seconds: 15
condition:
- condition: state
entity_id: input_boolean.vacation_mode
state: "off"
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
action:
- choose:
- conditions:
- condition: template
value_template: >-
{{
(as_timestamp(now())-as_timestamp(states.device_tracker.sm_g998b.last_changed))
< 300 }}
- condition: trigger
id:
- andrew_tracker
- condition: state
entity_id: binary_sensor.sm_g998b_android_auto
state: "on"
- condition: not
conditions:
- condition: state
entity_id: group.family_all
state: home
for:
hours: 0
minutes: 10
seconds: 0
sequence:
- service: alarmo.disarm
data:
entity_id: alarm_control_panel.alarmo
code: "0000"
- service: script.family_arrival_tv_notification
data: {}
- if:
- condition: template
value_template: " {{ (as_timestamp(now()) - as_timestamp(states('sensor.uptime'))) // 60| round (0) < 5 }}"
then:
- stop: Home Assistant started/re-started too recently.
else:
- service: cover.open_cover
data: {}
enabled: true
target:
entity_id: cover.garage_door_2
enabled: true
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.garage_entry_door_iaszone
from: "off"
to: "on"
continue_on_timeout: true
timeout:
hours: 0
minutes: 3
seconds: 0
milliseconds: 0
- service: tts.google_cloud
data:
cache: false
entity_id: media_player.family_speakers
message: "Welcome home, Andrew. "
- stop: ""
- conditions:
- condition: template
value_template: >-
{{
(as_timestamp(now())-as_timestamp(states.device_tracker.ashleys_iphone.last_changed))
< 300 }}
- condition: trigger
id:
- ashley_tracker
- condition: not
conditions:
- condition: state
entity_id: group.family_all
state: home
for:
hours: 0
minutes: 10
seconds: 0
- condition: state
entity_id: device_tracker.ashley_iphone_trk
state: home
sequence:
- service: alarmo.disarm
data:
entity_id: alarm_control_panel.alarmo
code: "0000"
- service: script.family_arrival_tv_notification
data: {}
- if:
- condition: template
value_template: " {{ (as_timestamp(now()) - as_timestamp(states('sensor.uptime'))) // 60| round (0) < 5 }}"
then:
- stop: Home Assistant started/re-started too recently.
else:
- service: cover.open_cover
data: {}
enabled: true
target:
entity_id: cover.garage_door_2
enabled: true
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.garage_entry_door_iaszone
from: "off"
to: "on"
continue_on_timeout: true
timeout:
hours: 0
minutes: 3
seconds: 0
milliseconds: 0
- service: tts.google_cloud
data:
cache: false
entity_id: media_player.family_speakers
message: Welcome home, Ashley.
- stop: ""
- conditions:
- condition: template
value_template: >-
{{
(as_timestamp(now())-as_timestamp(states.group.family_all.last_changed))
< 300 }}
- condition: trigger
id:
- Family_Arrived
- condition: not
conditions:
- condition: state
entity_id: group.family
for:
hours: 0
minutes: 10
seconds: 0
state: home
sequence:
- service: alarmo.disarm
data:
entity_id: alarm_control_panel.alarmo
code: "0000"
- if:
- condition: template
value_template: " {{ (as_timestamp(now()) - as_timestamp(states('sensor.uptime'))) // 60| round (0) < 5 }}"
then:
- stop: Home Assistant started/re-started too recently.
else:
- service: cover.open_cover
data: {}
enabled: true
target:
entity_id: cover.garage_door_2
enabled: true
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.garage_entry_door_iaszone
from: "off"
to: "on"
continue_on_timeout: true
timeout:
hours: 0
minutes: 3
seconds: 0
milliseconds: 0
- service: tts.google_cloud
data:
cache: false
entity_id: media_player.unispeak
message: Welcome home Ashley and Andrew.
- stop: ""
default:
- stop: No one home.
mode: single
I don’t know if this is the correct or most efficient way to run such an automation but basically the automation is meant to determine when me or my partner come home and disarm the alarm, open the garage door and make an announcement when we trigger a door sensor. Importantly, if we both arrive at the same time, we want this to announce both of our arrival together rather than individually or only one of us.
The issue can be either:
A) The wrong “choose” option is run.
B) The automation doesn’t choose an option at all.
C) The automation runs at unexpected times. IE: If my partners iphone wigs out and the GPS puts her in another location, it can sometimes cause the automation to think she just arrived home when she never left at all. For me, an android user, thats never happened but her iphone has caused this twice.
I setup the iphonedetect tracker because I was told this should help iphones have better tracking reliability but I dont know if this is working.
Is there a better and more reliable way to run such an automation? The biggest issue of all is the false positives when HA thinks her iphone has come home when she has been home all along.
Please help, this is driving me mad.