Custom Component: here_travel_time

Hi,
I am a user of the Google and Waze travel time components but not quite happy with them.
The Waze API is flaky and the values returned are not quite accurate and the Google API has to few free requests.

On a Hackathon I met HERE and got to know their API I created a component which does exactly the same as google_travel_time or waze_travel_time but using the here api.

As the workflow to be an official integration seems to take a very long time I decided to release it as a custom component so you guys can start using it and maybe even give me some feedback :upside_down_face:

To make things easier you can install it as a custom repo using HACS

You can find all the information and the code itself here:

20 Likes

This is great!
I have used Here Maps since the days of Windows Phone and always found it very good.

One of it’s unique(?) features for those on Android Phone is that you can download whole countries to use mapping off line. Very useful when travelling…

Now to try the custom component…

EDIT: After a first look it seems to work perfectly! Thanks.

1 Like

Looks promising. Gonna try to incorporate this to my configuration.

Thx!

This is good stuff, and thanks for sharing. Never knew such services existed, and I will definitely try it out. If not for anything, tired of doing many of my stuffs via Google. Though won’t be surprised they also linked to Google :roll_eyes:.

Anyway I do use Google Travel sensor, and though the request is limited, I was able to manage it to achieve my aim. Which also helps me with some flexibility.

My Google API is used by myself and wife, coupled with the fact I have sensors for all modes for both of us, so that is driving, transit and walking (none of us knows how to ride a bic :wink:).

How I do it, is that the sensors are setup to update every hour, then using automation (AD), I then have it update more frequently when it’s time for me to say leave the house to somewhere. And it will default to a particular mode, depending on what I set it to.

Even if I am out of the home, and my calendar needs me to get to another location, the app reads the location from there, sends it to the sensor and depending on the travel mode I specified in my calendar, updates the required sensor and then it and sends me notifications.

I think managing it became easier, once HA introduced the sensor.google_travel_sensor_update service.

Regards

2 Likes

Best to add instructions on how to do that I guess?

I am gonna try it out, looking good so far :slight_smile:

The AD app for updating Google is still on my to-do list. Could you share your implementation?

Please click on the link to HACS. Everything is explained there in detail and with videos. You need to understand how HACS works.

I think i did something wrong but i don’t know what. I downloaded all files in the custom components and added the configuration to my sensor.yaml but when i added it and validate my config. It keeps on hanging in the validating configuration. Which in my opinion is not good.

What am i doing wrong?

  - platform: here_travel_time
    app_id: "YOUR_APP_ID"
    app_code: "YOUR_APP_CODE" 
    origin: "51.222975,9.267577"
    destination: "51.257430,9.335892"

Does the “YOUR_APP_CODE” needs to be with the quotes?. for example “DASdEjkrk” or is this DASdEjkrk?. Does the same apply to the rest of the codes?

You said sensor.yaml
Docs say:

To enable the sensor, add the following lines to your configuration.yaml file:

Could that be it?

It doesn’t need to be in quotes.

Did you split up your configuration in packages / yaml files?

i tried it all without the quotes and it didn’t help either. :frowning:

Yes i splitted my config in multiple files. in my configuration.yaml i have the following lines

sensor: !include sensor.yaml

and then in my sensor.yaml i got the following lines as explained in the installation file.

  - platform: here_travel_time
    app_id: "YOUR_APP_ID"
    app_code: "YOUR_APP_CODE" 
    origin: "51.222975,9.267577"
    destination: "51.257430,9.335892"

I think i forget something small like always haahah. But what…

I just tested it exactly as that in my production configuration and it worked.
If you want you can send me a PM with your actual configuration so we can get into it in detail

1 Like

just wanted to say thanks! I had no issue getting it setup up in HACS or actual sensors up and running. it’s great when i can rely on google for one less thing.

1 Like

Can I just clarify about how often this makes an api call?

Am I right in thinking that every sensor creates one api call every five minutes? I know it says that in the docs but as they are written there is some room for ambiguity, not much, but enough that I wanted to be sure :wink:

And presumably setting a scan_interval will change that as is normal?

Thanks again for this. It seems to be so much more reliable than the Waze sensor. No more errors in the logs and no more waiting for it to update every time I do an HA restart.

You are right, every sensor makes an own API call.
Actually its more often than every 5 minutes. I removed that limit in the code when I figured out I have far more calls available than with google.

I will find out what the default intervall of hass is and get back to you.

scan_interval should work normally, but I have not tested it yet.

1 Like

Can’t seem to switch to use public transport.

  • platform: here_travel_time
    app_id:
    app_code:
    name: Renata reistijd huis
    origin: device_tracker.google_maps_115985639183127825809
    destination: zone.home
    travel_mode: publicTransport

Gives an error;

Invalid config for [sensor.here_travel_time]: [travel_mode] is an invalid option for [sensor.here_travel_time]. Check: sensor.here_travel_time->travel_mode. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.here_travel_time/

Any thoughts?

The documentation was showing travel_mode instead of the correct mode.

- platform: here_travel_time
  app_id: 
  app_code: 
  name: Renata reistijd huis
  origin: device_tracker.google_maps_115985639183127825809
  destination: zone.home
  mode: publicTransport

Should work for you

I already published a new release with the new documentation

Nice, that fixed it! Works like a charm now.

1 Like

I got it working now thanks to your help. I re-downloaded the files as RAW format and that did the trick.

image

There is still a small error, seems that the publicTransport mode is not working. see below

“Your configuration contains extra keys that the platform does not support.
Please remove [travel_mode]. (See /config/sensor.yaml, line 18).”

    name: Thuis - Werk OV
    traffic_mode: true
    travel_mode: publicTransport

Yeah that was an error in the documentation.
@j1nx above your post had the same problem. Sorry :wink: