Can for
be included as an automation condition?
What I’m looking to do is turn on a light if a person entity is showing home
for a minimum of 20 seconds.
The reason for this is I have just noticed whilst viewing a person
state, which uses the HA companion app as the tracker, that the status changed momentarily (about 5 seconds) from their current zone to home, then back to their current zone. I’m guessing 5 seconds is the standard polling interval for the app?
So to avoid false positives like this I want to add a time constraint to the automation.
Current automation:
- alias: Front Door Light Activate Arrival
id: front_door_light_activate_arrival
mode: single
trigger:
platform: state
entity_id:
- device_tracker.iphone_l
- person.m
- person.r
to: 'home'
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: -0.4
- condition: time
after: '15:00:00'
before: '22:00:00'
action:
- service: script.front_door_illuminate