Smart Travel Time Notifications in Home Assistant

Send arrival time notifications with Google Travel Time, updating only while you’re on the road to keep API calls low.

Tablet dashboard showing the expected arrival time from Google Travel Time

Knowing when someone will arrive home can be surprisingly useful in a smart home. With a commute of over an hour, I like to keep my wife up to date about my expected arrival time. It definitely helps with timing dinner. 😉

I use Home Assistant together with the Google Travel Time integration to calculate the travel time from my current location to home. If you’re also tracking where you parked on the way back, I’ve got a separate guide on tracking your car’s parking location in Home Assistant.

The Google API has usage limits though. Updating the travel time sensor every minute burns through those limits fast. So instead I built a small system that only updates while someone is actually on the way home.

The Goal

My requirements were simple:

  • Automatic: Send a notification with the expected arrival time as soon as someone leaves work.
  • Accurate: Keep the estimate up to date during the trip.
  • Cheap: Only call the Google API while someone is travelling.
  • For both of us: Work for my wife and me, each with our own work location.

What You’ll Need

  • The Google Travel Time integration, with a sensor per person from their location to home. Mine are sensor.travel_time_peter and sensor.travel_time_partner.
  • Zones in Home Assistant: zone.home and a work zone per person
  • An input_boolean helper per person, like input_boolean.travelling_peter

How It Works

  1. When someone leaves their work zone, a script updates their travel time sensor.
  2. A notification is sent with the expected arrival time.
  3. The person’s travelling boolean is turned on.
  4. While the boolean is on, the travel time refreshes regularly.
  5. When the person arrives home, the boolean turns off and the updates stop.
  6. The dashboard shows the expected arrival time and the current location.

Step 1: Send the Notification with a Script

Because the same steps are needed for every person, they live in a script with the person as a parameter. It updates the travel time, waits a moment, sends the notification and turns on the travelling boolean:

send_travel_time_notification:
  alias: "Send travel time notification"
  mode: single
  fields:
    person_id:
      description: "The person who is travelling, e.g. peter"
      example: "peter"
  sequence:
    - variables:
        name: "{{ person_id | title }}"
        sensor: "sensor.travel_time_{{ person_id }}"
        input_bool: "input_boolean.travelling_{{ person_id }}"
    - action: homeassistant.update_entity
      target:
        entity_id: "{{ sensor }}"
    - delay:
        seconds: 10
    - action: notify.all_devices
      data:
        title: "{{ name }} is on the way home!"
        message: >
          {{ name }} has a travel time of {{ states(sensor) }} minutes
          and will arrive around
          {{ (as_timestamp(now()) + 60 * states(sensor) | float(0)) | timestamp_custom('%H:%M') }}.
    - action: input_boolean.turn_on
      target:
        entity_id: "{{ input_bool }}"

The 10-second delay gives the sensor time to update before the notification goes out, so the message always shows a fresh travel time instead of an old one.

Step 2: Detect When Someone Leaves Work

This automation calls the script when someone leaves their work zone. With for:, the zone.left trigger only fires once someone has been out of the zone for a few minutes:

- id: travel_to_home
  alias: "Travel: On the way home"
  mode: queued
  initial_state: 'on'
  triggers:
    - trigger: zone.left
      id: peter
      target:
        entity_id:
          - person.peter
      options:
        zone: zone.work_peter
        behavior: each
        for: "00:05:00"
    - trigger: zone.left
      id: partner
      target:
        entity_id:
          - person.partner
      options:
        zone: zone.work_partner
        behavior: each
        for: "00:02:00"
  conditions:
    - condition: time
      after: "14:00:00"
      before: "19:00:00"
  actions:
    - action: script.send_travel_time_notification
      data:
        person_id: "{{ trigger.id }}"

The id of each trigger is the name of the person, and that’s what’s passed to the script. The time condition makes sure this only happens on the way home in the afternoon. mode: queued makes sure that if we both leave at the same time, both notifications are sent.

Step 3: Update the Travel Time During the Trip

Traffic can change a lot during an hour-long commute. This automation refreshes the sensor regularly, but only while the travelling boolean is on, so nothing runs in the background when nobody is on the road:

- id: travel_update_peter
  alias: "Travel: Update travel time Peter"
  mode: single
  initial_state: 'on'
  triggers:
    - trigger: time_pattern
      minutes: "/15"
  conditions:
    - condition: state
      entity_id: input_boolean.travelling_peter
      state: "on"
  actions:
    - action: homeassistant.update_entity
      target:
        entity_id: sensor.travel_time_peter

I use one of these per person, each with its own interval. The interval is a trade-off between accuracy and API calls.

Step 4: Stop When Someone Arrives Home

Once someone enters the home zone, the travelling boolean turns off and the updates stop:

- id: travel_arrived_home
  alias: "Travel: Arrived home"
  mode: queued
  initial_state: 'on'
  triggers:
    - trigger: zone.entered
      id: peter
      target:
        entity_id:
          - person.peter
      options:
        zone: zone.home
        behavior: each
    - trigger: zone.entered
      id: partner
      target:
        entity_id:
          - person.partner
      options:
        zone: zone.home
        behavior: each
  actions:
    - action: input_boolean.turn_off
      target:
        entity_id: "input_boolean.travelling_{{ trigger.id }}"

Step 5: Show the Arrival Time on the Dashboard

On my dashboard, a Markdown card shows the expected arrival time, but only while someone is travelling, so it stays out of the way the rest of the time:

type: markdown
content: |
  ## Hello {{ user }}

  {% if is_state('input_boolean.travelling_peter', 'on') %}
    <ha-icon icon="mdi:car-sports"></ha-icon> Peter will be home around **{{ (as_timestamp(states.sensor.travel_time_peter.last_updated) + 60 * states('sensor.travel_time_peter') | float(0)) | timestamp_custom('%H:%M') }}**
  {% endif %}

Because the travel time sensor refreshes during the trip, the card automatically shows the latest estimate.

A map card shows the current location compared to home. Like the arrival time, it only appears while someone is travelling:

type: conditional
conditions:
  - condition: state
    entity: input_boolean.travelling_peter
    state: "on"
card:
  type: map
  auto_fit: true
  entities:
    - person.peter
    - zone.home

Step 6: Send a Notification Manually

Sometimes I’m travelling from somewhere other than work, or I just want to send an update myself. Because the notification lives in a script, a dashboard button can call it directly:

type: conditional
conditions:
  - condition: state
    entity: person.peter
    state_not: "home"
card:
  type: button
  name: Send travel time notification
  show_icon: false
  tap_action:
    action: perform-action
    perform_action: script.send_travel_time_notification
    data:
      person_id: peter

I’ve also been thinking about adding an NFC tag in the car to do this without even opening the dashboard.

Final Thoughts

This has turned out to be one of the more practical automations in my setup. The API usage stays low, the arrival time is accurate enough to actually plan around, and the whole thing runs by itself: it starts when one of us leaves work and stops when we get home.

It’s also easy to extend. Because the travel time is available as a sensor, you can build other automations on top of it: turn on the lights when someone is 10 minutes away, start the coffee machine or adjust the heating. Distance-based automations work too, but basing them on travel time tends to be more reliable in practice.

4 comments

  1. Anonymous

    Thanks for making this post! I really want to try out something similar. But what about the costs of this Google Travel Time service? Because I read before that people got surprised because of it.

    1. Hi! See https://www.home-assistant.io/integrations/google_travel_time/

      There are about 10.000 free requests a month, so thats a bit more than 300 requests a day. If you manually update the travel time, you can kinda figure out if you will be reaching that limit.

      For me personally, I dont travel more than 2 hours a day in which my travel need to be updated. So with a 5 minute gap, that’s only 24 requests a day 🙂

  2. Jayceqa

    Winners don’t overthink. They play. Your chance is here! Play Now Here -> is.gd/27Vfed

  3. Payment systems are crucial for modern financial ecosystems.
    They enable money to move swiftly and securely across borders.
    Popular examples are credit cards, e-wallets, and bank transfers.
    Each method offers a unique balance between convenience, cost, and security.
    https://beauty.whitesneaker.ru/GGWALPfJ1zOb/
    Choosing the best payment option relies on the customer’s needs and location.
    Good payment systems safeguard sensitive data and prevent fraud.
    Ultimately, reliable transaction processing is the backbone of online business and fintech.

Leave a Reply

Your email address will not be published. Required fields are marked *