Home Home Automation Google Home - Location Sharing: ETA & distance

Google Home – Location Sharing: ETA & distance

If the human-readable address isn't enough for you, here is the info about the distance and ETA

Google Home – Location sharing tutorial sparked a discussion about what other functions could be added to that system. The immediate response was to add the distance and ETA for each contact and this is the follow-up tutorial which will focus on just that. I would strongly recommend you to read the previous article or watch at least the showcase part of the video below.

Google Home – Location Sharing: ETA & distance

The formula is pretty simple. I’m asking Google Home to get me the location of my friend:

Hey Google, Where is Matt?
***Matt is at James st London, UK
Hey Google, Send directions to my phone!
***OK, check your Google Maps
Hey Google, what’s the distance and ETA?
***Matt is currently 200km away, with ETA of 2h and 6 min

In this part, I’m going to take care of the last question. Please bear in mind, that to keep things simple, I’m going to assume, that you are using a Google Home device, not the assistant on your phone. Trying to query the distances on the go, while it’s possible is not within the scope of this tutorial.

To enable the functionality, we will need the help of the IFTTT and Google Maps API. If you followed the previous tutorial, you have almost everything sorted.

IFTTT – ETA and Directions

To keep things simple, I’m not going to split the information about the distance and the ETA. It’s simple enough to do, I’m sure you will be able to figure it out yourself.  I just need a Google Assistant IFTTT applet liked to the Webhook and configured in the following way:


Commands: What's the distance and ETA
Answer: I'm checking it now for you


Url: https://NODERED_IP:1880/location/ETA
Method: POST
Content type: application/JSON

The HTTP POST request needs no data, as we only want to trigger the correct flow. You could ask directly about the distance and ETA without asking for the address, but you have to modify the flow accordingly. I’m trying to introduce as little changes as possible to the previous write-up.

NodeRED – Google Home – Location Sharing: ETA & distance

The Google Home notification node is no longer working, but you can use the cast node for the same effect. See theĀ node-red-contrib-cast for details.

The flow itself is very similar to what I have covered before. We have another Google Maps API link to compose and pass an HTTP GET request. To pass the URL, I’m configuring the function node:

var lat = global.get("locationLat");
var long = global.get("locationLong");
var locationHome = "HomeCoordsLAT,HomeCoordsLONG";

var GoogleKey = "Google Maps API"

msg.url = "https://maps.googleapis.com/maps/api/distancematrix/json?origins="+lat+","+long+"&destinations="+locationHome+"&key="+GoogleKey;
return msg;

Replace the red fields with appropriate values. I’m using stationary coordinates for the Google Home location, you can find them via Google Maps and searching for your location.

The URL is saved as msg.url – and passed to the HTTP GET node. I have reversed the destination/origin order, as I believe in most cases I would be interested in the ETA of my friend. If I want ETA to their location, I already have “Send direction to my phone” command. By default, the ETA and distance are calculated as a metric, driving directions. If you want to change it, please check the Google Maps API for the correct variables.

The HTTP GET request returns a string. This string is formatted as  JSON object, and to use it as such, we have to use the JSON node.

Lastly, I have to format the info stored in that JSON object and pass it as the Google Home response:

msg.name = global.get("locationName");
msg.payload.time = msg.payload.rows[0].elements[0].duration.text;
msg.payload.distance =msg.payload.rows[0].elements[0].distance.text;

return msg;

and use the template node

{{name}} is {{payload.distance}} away. The current ETA is {{payload.time}}

And pass it over to the Google Home node! There you have it!


You can see how to obtain information about the distance and ETA. You can modify the entire set up to give you that information independently, but in this tutorial, you have to query the address first to have the access to the distance and the ETA. I hope you find this helpful!

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.


Nothing says "Thank you" better than keeping my coffee jar topped up!


Support me on Patreon and get an early access to tutorial files and videos.


Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

Smart Ideas with

Automate your space in with these ecosystems and integrate it with other automation services

Learn NodeRED

NodeRED for beginners: 1. Why do you need a NodeRED server?

To server or not to server? That's a very silly question!

Best Automation Projects

Sonoff R3 DIY mode & why it sucks

Long awaited Sonoff R3 DIY mode is even worse than I expected.

NEST your old thermostat under $5

Nest-ing up your older thermostat under $5

IKEA TRADFRI Wireless dimmer in NodeRED

Thanks to NodeRED you can use IKEA TRADFRI Wireless Dimmer to interact with everything

Alexa and NodeRED integration

Hey Alexa, turn the lights on!

Smart Home

M5Paper – the “Kindle” of development and automation

M5Paper combines a brilliant multitouch e-ink display with power of ESP32 to create the most unique programming board

A seriously connected relay! Netio 4PZ

Netio 4PZ could be called a jack of all trades, as it brings multiple functions to a single device. I'm sure some of you will be quick to point out that it doesn't have PoE or it doesn't make your morning toasts. You might...

Strip time! Sonoff L1 Lite RGB LED

New product from ITEAD - Sonoff L1 Lite - budget friendly connected RGB LED strip with a microphone

DIY Smart Heating v3.0

Anyone looking for Smart Heating in 2021 is spoiled for choice, providing money isn't an issue. My home has 30-year-old heating installed, but that didn't stop me from adding "smart" component to it for less than $5. In 3 years time, I had a...

A comprehensive guide to Grafana & InfluxDB

How to use Grafana and InfluxDB on Raspberry Pi for IoT sensors in home automation