Help with a time condition

I want to trigger a cover action when a person entity has been away from my home zone for at least 5 minutes.

Here is how it’s supposed to work: Leave the Home zone for more than 5 mins. Upon entering the Gate zone, send a notification to my phone, wait 2 minutes, open a cover.

Using the Web UI results in the YAML below. I thought this would work, but I can see in the history that “me” (the person entity) enters the zone called Gate after I’ve been away for much longer than 5 minutes, and none of the actions are triggered. I guess I have 1 or 2 simple questions. 1: Is the time parameter in the condition discrete or is it anything equal/greater? If its discrete, any tips on making it equal or greater?

trigger:
  - platform: zone
    entity_id: person.me
    zone: zone.gate
    event: enter
  condition:
  - condition: state
    entity_id: person.me
    state: away
    for:
      hours: 0
      minutes: 5
      seconds: 0
  action:
  - device_id: it's a device ID (I've removed it)
    domain: mobile_app
    type: notify
    message: Gate is Opening
  - delay:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
  - service: cover.open_cover
    target:
      entity_id: cover.gate

Thanks all.

Depending on how the zone is setup, your state might not be “away” but is instead the name of the zone, in which case the condition will not be satisfied. The zone has to be passive for it to not replace “away”.

1 Like

The states for a person can only ever be “home”, “not_home” or the name a defined zone that’s not the Home zone (if it is in the Home zone then the state is “home”). It won’t be “away”.

try changing the condition state to “not_home”.

and “for:” times are always >=.

1 Like

Thank you! That must be it.