From c5965d1877e4879b6358a15cf6ad276927f5c673 Mon Sep 17 00:00:00 2001 From: Kevin Stillhammer Date: Sun, 16 Mar 2025 20:35:25 +0100 Subject: [PATCH 1/2] Use google-maps-routing --- source/_integrations/google_travel_time.markdown | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/source/_integrations/google_travel_time.markdown b/source/_integrations/google_travel_time.markdown index e7b798ca2b94..9dc5a4c406da 100644 --- a/source/_integrations/google_travel_time.markdown +++ b/source/_integrations/google_travel_time.markdown @@ -14,17 +14,15 @@ ha_codeowners: ha_integration_type: integration --- -The `google_travel_time` sensor provides travel time from the [Google Distance Matrix API](https://developers.google.com/maps/documentation/distance-matrix/). +The `google_travel_time` sensor provides travel time from the [Google Maps Routes API](https://developers.google.com/maps/documentation/routes/overview). ## Setup -You need to register for an API key by following the instructions [here](https://github.com/googlemaps/google-maps-services-python#api-keys). You only need to turn on the Distance Matrix API. +You need to register for an API key by following the instructions [here](https://developers.google.com/maps/documentation/routes/get-api-key-v2). You only need to turn on the Routes API. -[Google now requires billing](https://mapsplatform.googleblog.com/2018/05/introducing-google-maps-platform.html) to be enabled (and a valid credit card loaded) to access Google Maps APIs. The Distance Matrix API is billed at US$10 per 1000 requests, however, a US$200 per month credit is applied (20,000 requests). The sensor will update the travel time every 5 minutes, making approximately 288 calls per day. Note that at this rate, more than 2 sensors will likely exceed the free credit amount. While this call frequency can not be decreased, you may have a use case which requires the data to be updated more often, to do this you may update on-demand (see automation example below). +Google requires billing to be enabled (and a valid credit card loaded) to access Google Maps APIs. The Routes API currently provides 10,000 free requests. The sensor will update the travel time every 5 minutes, making approximately 288 calls per day. Note that at this rate, using more than 2 sensors may exceed the free credit limit. As the update frequency cannot be decreased, if you require more frequent data updates, consider triggering on-demand updates (see the automation example below). -A quota can be set against the API to avoid exceeding the free credit amount. Set the 'Elements per day' to a limit of 645 or less. Details on how to configure a quota can be found [here](https://developers.google.com/maps/documentation/distance-matrix/usage-and-billing#set-caps) - -**Starting March 2025** Google will change the pricing scheme from the US$200 per month credit to 10,000 free requests. You should adjust your limit to 322 or less. You can find more information on the pricing changes in the [Google developer documentation](https://developers.google.com/maps/billing-and-pricing/faq#pricing-sheet). +A quota can be set against the API to avoid exceeding the free credit amount. Set the 'Elements per day' to a limit of 322 or less. Details on how to configure a quota can be found [here](https://developers.google.com/maps/documentation/routes/report-monitor#quotas). {% include integrations/config_flow.md %} @@ -32,7 +30,6 @@ Notes: - Origin and Destination can be the address or the GPS coordinates of the location (GPS coordinates have to be separated by a comma). You can also enter an entity ID that provides this information in its state, an entity ID with latitude and longitude attributes, or zone friendly name (case sensitive). - ## Dynamic Configuration Tracking can be setup to track entities of type `device_tracker`, `zone`, `sensor` and `person`. If an entity is placed in the Origin or Destination then every 5 minutes when the platform updates it will use the latest location of that entity. From b52420ac25dab4f69e97a0cde1f814511701fad7 Mon Sep 17 00:00:00 2001 From: Kevin Stillhammer Date: Tue, 1 Apr 2025 12:55:59 +0200 Subject: [PATCH 2/2] Set free requests to 5k when traffic is enabled With the new routing API only 5k free requests are included if traffic aware routing is enabled. The current implementation enables this mode if travel mode car is chosen. --- source/_integrations/google_travel_time.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/_integrations/google_travel_time.markdown b/source/_integrations/google_travel_time.markdown index 9dc5a4c406da..dc33f644534c 100644 --- a/source/_integrations/google_travel_time.markdown +++ b/source/_integrations/google_travel_time.markdown @@ -20,9 +20,9 @@ The `google_travel_time` sensor provides travel time from the [Google Maps Route You need to register for an API key by following the instructions [here](https://developers.google.com/maps/documentation/routes/get-api-key-v2). You only need to turn on the Routes API. -Google requires billing to be enabled (and a valid credit card loaded) to access Google Maps APIs. The Routes API currently provides 10,000 free requests. The sensor will update the travel time every 5 minutes, making approximately 288 calls per day. Note that at this rate, using more than 2 sensors may exceed the free credit limit. As the update frequency cannot be decreased, if you require more frequent data updates, consider triggering on-demand updates (see the automation example below). +Google requires billing to be enabled (and a valid credit card loaded) to access Google Maps APIs. The Routes API currently provides 5,000 free requests that take the current traffic into account. The sensor will update the travel time every 10 minutes, making approximately 144 calls per day. Note that at this rate, using more than 1 sensor may exceed the free credit limit. As the update frequency cannot be decreased, if you require more frequent data updates, consider triggering on-demand updates (see the automation example below). -A quota can be set against the API to avoid exceeding the free credit amount. Set the 'Elements per day' to a limit of 322 or less. Details on how to configure a quota can be found [here](https://developers.google.com/maps/documentation/routes/report-monitor#quotas). +A quota can be set against the API to avoid exceeding the free credit amount. Set the 'Elements per day' to a limit of 161 or less. Details on how to configure a quota can be found [here](https://developers.google.com/maps/documentation/routes/report-monitor#quotas). {% include integrations/config_flow.md %}