Custom Component: here_travel_time

I am trying HERE for the first time and have setup this first sensor. Does anyone know how I can setup the mode with input_select entity just like destination_entity_id?

I have tried adding like this, but it gives error saying expecting:
bicycle, car, pedestrian, publicTransport, publicTransportTimeTable or truck

  - platform: here_travel_time
    api_key: "!secret rest_here_api_key"
    name: Duc Destination Here
    origin_entity_id: device_tracker.id
    destination_entity_id: input_select.duc_destination_here
    mode: "{{ states('input_select.duc_mode_here') }}"

Hi @duceduc this is not possible. You have to create a separate sensor for every mode you want to track.

hello, how can I create a sensor that counts me the sensor calls so that I know when I get close to 250000

So since its not possible to dynamically update the scan_interval, I am also going to assume you cant dynamically update the destination_entity_id or the origin_entity_id either?

- platform: template
  sensors:
    work_select_person:
      friendly_name: "Work Select Person"
      value_template: >-
        {%- if is_state("input_select.work_select_person", "Colton")  -%}
          person.colton
        {%- elif is_state("input_select.work_select_person", "Vanessa")  -%}
          person.vanessa
        {%- else -%}
          Unknown
        {%- endif %}

    work_select_address:
      friendly_name: "Work Select Address"
      value_template: >-
        {%- if is_state("input_select.work_select", "Colton's Work")  -%}
          zone.colton_work
        {%- elif is_state("input_select.work_select", "Vanessa's Work")  -%}
          zone.vanessa_work
        {%- else -%}
          Unknown
        {%- endif %}

- platform: here_travel_time
  api_key: !secret here_travel_time_api
  name: Vanessa Commute To Work
  origin_entity_id: sensor.work_select_person
  destination_entity_id: sensor.work_select_address
  traffic_mode: true

It is possible.
Your specific usecase (dynamically search in the provided entity names until a location is found) will only work with the newest release. It got added by this PR: Use find_coordinates in here_travel_time by eifinger · Pull Request #59938 · home-assistant/core · GitHub

Know why I might be getting this error in the logs?

In which version of HA are you?

Getting same error.

HAOS 7.0
Hass 2021.12.1

Thanks

Edit:
The api key had expired within 60 mins of making it because i had to confirm my email.
All works now.
Thanks.

Edit:
Well it has gone past the 60mins and the api key has expired again which it shouldn’t.
so not sure how to use this if its keeps expiring the api key.

Edit: Well I created a new api key after I confirmed my email and it’s still working after 2 hours.

I got error saying…

HERE could not find a route based on the input
1:34:55 PM – (ERROR) here_travel_time - message first occurred at 1:30:18 PM and shows up 2 times

destination_entity_id is a zone I create in HA. It’s a HERE server issue?

  - platform: here_travel_time
    api_key: !secret here_api_key
    name: Duc Destinations
    origin_entity_id: device_tracker.id
    destination_entity_id: sensor.duc_destination_here
    mode: pedestrian

Does this happen a lot? If not it could be that your device_tracker is unavailable or something like this.
You can also enable debug logging to see which exact location the integration is trying to get a route for:

logger:
  default: error
  logs:
    homeassistant.components.here_travel_time: debug

I’ve never got a sensor to work from the start. Always with this error. I have tried to created 3 different sensors with 3 different device_tracker devices. All same error. I am thinking my location isn’t supported (Japan)? The same device_tracker I am using with Waze and that works, but it’s flakey at times.

Looking at the API docs, Japan isn’t listed:

1 Like

ok. Bummer.

Hi there, total newbie to HA here, but for the life of me i can’t figure out how to get this to work. I’ve tried installing this as a custom repository thru hacs with the URL https://github.com/eifinger/here_travel_time but nothing happens. i took the manual route as well and copied all the docs into custom components directory but still cant get the sensor to turn up. Error logs from restarting:

Logger: homeassistant.components.sensor
Source: components/here_travel_time/sensor.py:202
Integration: Sensor (documentation, issues)
First occurred: 3:13:44 AM (1 occurrences)
Last logged: 3:13:44 AM

Error while setting up here_travel_time platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/here_travel_time/sensor.py", line 154, in async_setup_platform
    if not await hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/here_travel_time/sensor.py", line 202, in _are_valid_client_credentials
    here_client.public_transport_timetable(
  File "/usr/local/lib/python3.9/site-packages/herepy/routing_api.py", line 241, in public_transport_timetable
    return self._route(waypoint_a, waypoint_b, modes, departure, arrival)
  File "/usr/local/lib/python3.9/site-packages/herepy/routing_api.py", line 67, in _route
    response = self.__get(self.URL_CALCULATE_ROUTE, data, RoutingResponse)
  File "/usr/local/lib/python3.9/site-packages/herepy/routing_api.py", line 40, in __get
    raise error_from_routing_service_error(json_data)
herepy.error.HEREError: Error occured on __get

can some kind soul please help point me in the right direction?

Hi @ANGELUS728 here_travel_time is a standard integration. You shouldn’t use the deprecated custom_component. That being said the error you are encountering seems to occur a lot during the last days. I am on it

Can someone please help me!!! I have entered into config.yaml as stated on here page of ha.

My config is as

sensor:
  - platform: here_travel_time
    api_key: "My Api"
    origin_latitude: "51.222975"
    origin_longitude: "9.267577"
    destination_latitude: "51.257430"
    destination_longitude: "9.335892"

I keep getting this error. Not even a single time HA managed to load here sensor.

2022-04-19 23:07:06 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up here_travel_time platform for sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 249, in _async_setup_platform
await asyncio.shield(task)
File “/usr/src/homeassistant/homeassistant/components/here_travel_time/sensor.py”, line 156, in async_setup_platform
if not await hass.async_add_executor_job(
File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/components/here_travel_time/sensor.py”, line 211, in _are_valid_client_credentials
here_client.public_transport_timetable(
File “/usr/local/lib/python3.9/site-packages/herepy/routing_api.py”, line 241, in public_transport_timetable
return self._route(waypoint_a, waypoint_b, modes, departure, arrival)
File “/usr/local/lib/python3.9/site-packages/herepy/routing_api.py”, line 67, in _route
response = self.__get(self.URL_CALCULATE_ROUTE, data, RoutingResponse)
File “/usr/local/lib/python3.9/site-packages/herepy/routing_api.py”, line 40, in __get
raise error_from_routing_service_error(json_data)
herepy.error.HEREError: Error occured on __get

You are doing nothing wrong. This error is occurring for a lot of people. The only thing you can currently do is to try again after some time.

I am working on a fix

2 Likes

Thank you very much.

Are there any progress ? Still nothing is loaded.

You can track my progress in this issue I hope the change to the V8 api will make the errors go away.