Google Calendar and Travel Time

Hey there,

I’m trying to create an automated setup that looks at my calendar and destination and tells me what time I need to wake up to arrive on time.
I thought of two ways but both didn’t pan out:

  1. I also added the Google Travel Time component, which does work. I made a template sensor that converts the start_time of the next Google Calendar event into a timestamp which I tried to feed to the Travel Time component. The configuration looks like this:
- platform: google_travel_time
  api_key: HIDDEN
  destination: sensor.destination
    arrival_time: sensor.startevent

It correctly understands sensor.destination, which is retrieved from the next event’s location into a template, but it doesn’t seem to understand sensor.startevent, which is a timestamp to the start time of the next event.

  1. I tried a different approach where an app creates calendar entries for travel time. This solves the waking up part, but I would like to retrieve the location to the event after the travel time appointment. Home Assistant only shows me the next calendar entry, though I read about it being able to show 5 entries by default. How do you view those next entries?

Does anyone have experience on the matter?

Thanks in advance :slight_smile:

That’s not correct. This field does not accept a sensor. It accepts timestamps only. So if you want to arrive at the place at 8 am, you’d place ‘08:00:00’.

If you want a dynamic time. You need to calculate everything yourself on the fly. Meaning:

You need to make a template sensor that takes the sesnor.startevent time, subtract the current drive time duration. Then compare that result to the current time.

Thank you for helping me! I’m going to try that approach.
Do you happen to know how you can view the 5 default entries per calendar and use them as inputs as well? I noticed the Lovelace Calendar Card can see the events, but I have no idea how to do it manually.

Take a screenshot of the attributes inside devtools/states page of the calendar entity.

Hmm, no idea. Maybe the card accesses the calendar itself. There are no attributes in there that would point to the missing data.

The card uses the calendar.default information to show 5 entries. The card requests 7 but gets the default 5 from the optional max_entries setting. Makes me think it’s hiding somewhere.

it would be on the entity itself. Whats the entity_id that you use?

I’ve only used the calendar.default everywhere, including the lovelace card.

Hey, did you ever get this to work? My day starts with a ride to a different destination every day and I would love to get your idea to work!

It’s possible but calendars only show the next event. You can make a template and perform the calculation.

I did manage to get it to work just like Petra mentioned. I have an automation that checks if my travel time is more than 3 minutes and if so it adds another 15 minutes so I can get to my car and have some time left for parking as well. If I’m at home I use TTS and my Sonos speakers to announce that I have to leave. It also sends a notification to my phone with a clickable URL so Apple Maps opens up with the address I need to go too.

A separate wake-up automation looks at the first appointment + travel time + 15 minutes as well. 25 minutes before the wake up time lights turn from a dark red color with brightness 1 to the Adaptive Light (HACS integration) configuration that matches that time of day in a slow transition.

The Google Maps Travel Time and Waze Travel Time integration is currently broken. It won’t pass addresses, but a fix is in the works.

1 Like

Super cool I am looking to do the same could you post your working config please for how you calculate the time you need to leave… thanks

Hoping that traffic doesn’t increase before you leave.

{{ (as_timestamp(states.calendar.agenda.attributes.start_time) - (states("sensor.googletraveltime")|float * 60) - 900)| timestamp_local | replace(" ", "T") }}

I have an automation calculating Time To Leave every time my calendar or googletraveltime updates and have the result saved in a input_datetime helper that I can also check in the UI. Another automation checks if that date/time passed and sends out a notification with the address to my next destination. It’s a bit messy still, so that’s why I haven’t posted the whole thing.

1 Like

Travel time gets updated every 5 minutes and the automation picks up on that. Traffic can build anytime but I haven’t ran into any problems yet with this approach.


thank you so much got it going…