How to create automation based device entering a zone

Hi, my first post here, I’m just getting started with home assistant and loving it so far.

I’m looking to create an automation that fires when a device iPhone enters a predetermined zone.

My partner often travels 300 miles every weekend to visit her family, when she arrives I’d like a notification via “pushover” and also flash my Philips Hue bulb. My problem is over the weekend if she was to go out every time she gets back the automation will trigger and I only want it to trigger when she arrives after doing the 300 miles from home.

Is this possible?

Thanks :slight_smile:

How long is this travel time?
I’m thinking you could perhaps set a boolean to on when she leaves home and it turns off with an automation after x hours.
If she enters this zone while this boolean is on flash bulb.

1 Like

Yes this is a good idea… I just read about input Boolean’s but it didn’t occur to me to use like this…

The travel time is roughly 5-6 hours

Will give it a try and see how it works at the weekend.

Cheers

In that case I would have the boolean on for 7 or 8 hours. Depending on how large this area is.
If the zone is the whole city then I would go to say 6-7 hours.
If the zone is the house plus a few hundred feet/meters then I would go for 7-8 just because she could stop at a restaurant, traffic jam, and they might say meet us at…

But you could also have a zone midway or 3/4.
Or just outside of town.
That way it’s less likely she will trigger this again even if she goes to the store and back within your “boolean” time.

Or you get a bit fancier and use the “proximity” integration along with the input_boolean.

The way I would do it is to have an automation that does the announcement that she has arrived in the zone that also sets a boolean that tells you the announcement has already been made.

Then set a condition to only make the announcement if that boolean is off.

Since I don’t have any of your specifics the psuedo-code would look like this:

trigger:
  - platform: zone
    entity_id: person.your_partner
    zone: zone.her_parents
    event: enter
condition:
  - condition: state
    entity_id: input_boolean.announcement_already_made
    state: 'off'
action:
  - however you do the announcement
  - service: input_boolean.turn_on
    entity_id: input_boolean.announcement_already_made

then to turn the boolean basck off ready to give another announcement you can use the proximity entity to check if she is less than (for example) 100 miles from your home zone then turn the boolean off again.

like this:

trigger:
  - platform: template
    value_template: "{{ states('proximity.your_partner') | int < 100 }}"
action:
  - service: input_boolean.turn_off
    entity_id: input_boolean.announcement_already_made

Then you wouldn’t have to guess on the time it takes to travel or have to account for potential travel delays. And for her to be closer than 100 (or whatever you decide) miles from home it will be a good assumption that she is on the way back home.

Or if the proximity sensor is too much then you could just make it explicitly clear that she has already returned home and just use her entering the home zone as the trigger to reset the boolean.