Zone inside a Zone Automation (Knowing which direction)

I have my home zone and an “almost home” zone. The zone configuration seems correct.
Leaving the house, the person.x would be “home”, “almost home”, and then “away”. Coming home would be reversed “away”, “almost home”, and then “home”. So the automation for “almost home” would be watching for the “away” then goto “almost home”. Right now all the automation does is send a notification, but once I have confidence, then I might get brave enough to open the garage door. :slight_smile:
I
So leaving the house this morning I did not expect the notification that I did receive.
Does this look right for the automation?

 - alias: 'Paul Almost Home'
    trigger:
      - platform: state
        entity_id: person.paul
        from: 'away'
      - platform: state
        entity_id: person.paul
        to: 'Almost Home'
        for:
          seconds: 10
    action:
      service: notify.family
      data:
        message: "Paul is almost home. Time: {{now().strftime('%I:%M:%S %p')}}"

Arriving last night worked.

2 Likes

In node red there is a very handy tool.

That way you don’t need to overlap two zones.

I have not messed with node red, it is on the todo list someday.

You need to put from and to in the same trigger, as you have it now it triggers when the value changes from away to anything else or when it changes to almost homr for 10 seconds, no matter the previous state.

trigger:
  - platform: state
    entity_id: person.paul
    from: 'away'
    to: 'Almost Home'
    for:
      seconds: 10
1 Like

@Burningstone That makes sense and explains my issue before I split them.

My first try was …

 - alias: 'Paul Almost Home'
    trigger:
      - platform: state
        entity_id: person.paul
        from: 'away'
        entity_id: person.paul
        to: 'Almost Home'
        for:
          seconds: 10
    action:
      service: notify.family
      data:
        message: "Paul is almost home. Time: {{now().strftime('%I:%M:%S %p')}}"

And I was getting a config error. That is because of the same entity_id. So I thought let’s see if adding the - platform between the would remove the error. Yep, it did, just not what I wanted. :slight_smile:

I almost left the trigger for “almost home” and added a condition for the other, but that was going to get tricky. We will find out in the morning if I did your fix right. :slight_smile:
Thanks

I assume since you are using zones you have device_trackers that give a location attribute…

If you do then you could create a proximity sensor from those and then use the info from that sensor to trigger on being within a certain radius (I use < 1000ft) and the direction of travel is towards.

1 Like