Automating Home Notifications with Google Travel Time

I recently took on a fun challenge to automate the process of notifying my partner when I’m on my way home. This has been a fantastic way to streamline our daily routine and eliminate the need for constant messaging. Here’s how I set it up and how it’s working out so far!

The Setup

I started by setting up travel time sensors for both myself and my partner. Since we use different modes of transportation—public transit, car, and bicycle—I configured separate sensors for each method. This allowed me to get accurate travel times regardless of how we’re getting home.

yaml
platform: google_travel_time
api_key: !secret google_travel_time_api_key
origin: person.peter
destination: zone.home
name: travel_peter_bus
scan_interval: 900
options:
language: nl
mode: transit
transit_mode: bus

I repeated this configuration for car, bicycle, and another car sensor for my partner. To avoid unnecessary costs, I set a higher scan interval since I only need the data when sending notifications.

Automating Notifications

Next, I created a script to update the travel times and send notifications. I added a small delay to ensure the data is up-to-date before sending the message.

yaml
travel_peter_bus:
sequence:
- service: homeassistant.update_entity
entity_id: sensor.travel_peter_bus
- delay: ‘00:00:30’
- service: notify.telegram_marieke
data:
title: Peter is on the way home!
message: He’ll be home in {{ states.sensor.travel_peter_bus.attributes.duration }}!

I set up similar sequences for my partner’s sensors, ensuring notifications go to the right person.

User-Friendly Interface

To make everything easily accessible, I used the Button Card to create a horizontal stack of buttons. Each button corresponds to a different mode of transportation, making it simple to send notifications with just a tap.

yaml

  • type: horizontal-stack
    cards:
    • type: “custom:button-card”
      entity: script.travel_peter_bus
      icon: mdi:bus
      show_name: false
    • type: “custom:button-card”
      entity: script.travel_peter_car
      icon: mdi:car
      show_name: false
    • type: “custom:button-card”
      entity: script.travel_marieke_bicycle
      icon: mdi:bike
      show_name: false
    • type: “custom:button-card”
      entity: script.travel_marieke_car
      icon: mdi:car
      show_name: false

Why This Works

This setup has been a game-changer for us. Instead of constantly messaging each other, we simply press a button when we’re on our way home. It’s efficient, reliable, and has eliminated a lot of daily friction.

While I considered adding automations based on location, I found that manual notifications work better for our lifestyle. Sometimes we run errands or stop by a friend’s place, so having control over when the notification goes out makes sense.

Final Thoughts

I’m really happy with how this project turned out. It was a great way to dive into Home Assistant’s automation capabilities and customize something that directly improves our daily lives. If you’re looking to streamline your routine, I highly recommend giving this a try!

Hope this inspires someone else to tackle a similar project. Happy automating! :rocket: