A little background first… I created some presence detection automations using info from Phil Hawthorne. I also created some variables to hold status info for people like (‘Just Arrived’, ‘Home’, ‘Away’, etc) using rogro82.
it holds the values after a restart, but sometimes it doesn’t change the status from let’s say ‘Just Arrived’ to ‘Home’. I have the trigger set for 10 min, but i guess the restart throws off the time somehow and it never changes the status. Any ideas how i can modify the automations below so it will change the status from ‘Just Arrived’ to ‘Home’ if they have been home for at least 10 minutes?
JUST ARRIVED AUTOMATION
alias: Mark person as just arrived
hide_entity: True
initial_state: True
trigger:
- platform: state
entity_id: group.vince
from: 'not_home'
to: 'home'
- platform: state
entity_id: group.stac
from: 'not_home'
to: 'home'
action:
- service: variable.set_variable
data_template:
variable: >
{% if trigger.entity_id == 'group.vince' %}
vince_status
{% else %}
stac_status
{% endif %}
value: >
{% if trigger.entity_id == 'group.vince' %}
{% if states.vince_status.state == 'Just Left' %}
Home
{% else %}
Just Arrived
{% endif %}
{% else %}
{% if states.stac_status.state == 'Just Left' %}
Home
{% else %}
Just Arrived
{% endif %}
{% endif %}
MARK HOME AUTOMATION
alias: Mark person as home
hide_entity: True
initial_state: True
trigger:
- platform: state
entity_id: variable.vince_status
to: 'Just Arrived'
for:
minutes: 10
- platform: state
entity_id: variable.stac_status
to: 'Just Arrived'
for:
minutes: 10
- platform: state
entity_id: variable.vince_status
from: 'Just Left'
to: 'Just Arrived'
- platform: state
entity_id: variable.stac_status
from: 'Just Left'
to: 'Just Arrived'
action:
- service: variable.set_variable
data_template:
variable: >
{% if trigger.entity_id == 'variable.vince_status' %}
vince_status
{% else %}
stac_status
{% endif %}
value: 'Home'
thanks in advance!