How to use Device Zone Assignment (iOS App)

I am using the iOS app and the app is tracking my movement, it alerts me when i enter or exit a zone. I would like to use this device zone assignment in an automation for my commute time using the google maps component however i dont know how to target that particular information.

In the big picture what are you trying to do?

Currently i have two sensors for my commute time:

  1. from home to work
  2. from work to home

I have two automation’s that run at certain times to notify me of the commute time. This all works perfectly fine however i am generating double the amount of API requests to google to get this information.

My thoughts are that i can use a single sensor for the commute time which is dynamically set based on the location i am in.

for example:

If i am at Home show/send me notifications based on my commute from home to work
If i am at work show/send me notifications based on my commute from work to home

My phone sends me a notification to say i have entered or exited a zone but i cant figure out how to get interact with that information.

Edit: it is working if i use the friendly name “Home” rather than “zone.home” in the template sensor.

sensor:
    - platform: google_travel_time
      name: test
      api_key: !secret google_api
      origin: device_tracker.ryaniphone
      destination: sensor.my_destination

Then a template sensor.

my_destination:
  value_template: '{%-if is_state("device_tracker.ryaniphone","work")-%}Home{%- else -%}Work{%- endif %}'
  friendly_name: 'My Destination'

this idea was borrowed from

1 Like

And I can’t take all the credit either. Borrowed lots of ideas from the community :wink:

1 Like

Thank you - some good info there. I remember seeing that post which got me thinking of this actually. :smile:

Side question - are you actually using all your api request? I have about 3 google travel time sensors and only use 700 requests a day.

No using around 850 - i also have 3 but one is a test one at the moment. Maybe im trying to over engineer this :slight_smile: