Custom Component: open_route_service travel_time

I released v1.5.0. There was an update to the underlying library regarding that error. The error should be caught and properly logged now.

Iā€™ll update shortly.

Just saw this in the log.

openrouteservice.exceptions.ApiError: 500 ({'error': 'There has been an unexpected error, please make sure your request is formatted correctly and you have provided your API token.'})

No errors, since updating 20mins ago. :+1: +1:

1 Like

Seems to be exceeding the daily limit.

openrouteservice.exceptions.ApiError: 403 ({'error': 'Daily quota reached or API key unauthorized'})

Interesting. I believe the reverse genocide calls are the culprit. Both the origin and destination coordinates are resolved go an address. The docs say these are limited to 1.000 requests per day so 500 sensor updates.

If you have 2 sensors that will leave you with a maximum resolution of about 10 per hour.

I will add an option that will allow to disable the reverse geocoding per sensor.

An additional question:

Seems you are the most active (only?) user of this component. Would like it to be configurable via ui and if yes would an automatic import of your existing configuration.yaml config a ā€œmust haveā€ for an upgrade?

:frowning_face: Disappointing to know/believe Iā€™m the only active user, as I find it very useful.

If I understand your question correctly, youā€™re looking to integrate the configuration as part of the onboarding process?, if so, no, importing the configuration from yaml isnā€™t necessarily required, itā€™s easy enough to reconfigure.

Thank you for your feedback!

Seeing the same with just 1 sensor

Is this one sensor updating faster than every 6 minutes?

Seems to be updating every 5 mins.

> |entity_id|state|created|
> |---|---|---|
> |sensor.phone_time_to_home|0|10/27/2020 9:04|
> |sensor.phone_time_to_home|0|10/27/2020 8:59|
> |sensor.phone_time_to_home|0|10/27/2020 8:54|
> |sensor.phone_time_to_home|0|10/27/2020 8:44|
> |sensor.phone_time_to_home|unknown|10/27/2020 8:44|
> |sensor.phone_time_to_home|0|10/27/2020 8:14|
> |sensor.phone_time_to_home|0|10/27/2020 8:09|
> |sensor.phone_time_to_home|0|10/27/2020 7:59|
> |sensor.phone_time_to_home|0|10/27/2020 7:34|
> |sensor.phone_time_to_home|0|10/27/2020 5:49|
> |sensor.phone_time_to_home|0|10/27/2020 5:24|
> |sensor.phone_time_to_home|0|10/27/2020 5:14|
> |sensor.phone_time_to_home|0|10/27/2020 5:04|
> |sensor.phone_time_to_home|0|10/27/2020 4:59|
> |sensor.phone_time_to_home|0|10/27/2020 4:54|
> |sensor.phone_time_to_home|0|10/27/2020 4:49|
> |sensor.phone_time_to_home|0|10/27/2020 4:44|
> |sensor.phone_time_to_home|0|10/27/2020 4:39|
> |sensor.phone_time_to_home|0|10/27/2020 2:49|
> |sensor.phone_time_to_home|0|10/27/2020 1:04|
> |sensor.phone_time_to_home|0|10/27/2020 0:59|
> |sensor.phone_time_to_home|0|10/27/2020 0:49|
> |sensor.phone_time_to_home|unknown|10/26/2020 22:44|
> |sensor.phone_time_to_home|0|10/26/2020 20:45|
> |sensor.phone_time_to_home|0|10/26/2020 20:30|

Yep that is too fast.
You can increase the scan interval or wait until I release the possibility to disable Reverse Geocode lookups.

sensor:
  - platform: open_route_service
    api_key: "YOUR_API_KEY"
    origin_latitude: "51.222975"
    origin_longitude: "9.267577"
    destination_latitude: "51.257430"
    destination_longitude: "9.335892"
    scan_interval: 3600 # 1h

:+1: Applied the scan interval for the time being.

I just added released https://github.com/eifinger/open_route_service/releases/tag/v1.1.0 with the new option to disable reverse geocode lookups.

Stumbled across this, itā€™s going to be super useful! Thanks for creating this!

Iā€™ve been using the iCloud3 integration for people tracking and trying to fire some automations based on location of my wife and myself. This added to the mix will help as it makes it simpler to then track the distance between us.

So at minimum, Iā€™m going to create one sensor for distance between person.me and person.wife. Now iā€™m thinking of:

  1. Do i need another sensor for each of us to zone.home?
  2. When should I be enable reverse geocoding?
  1. That depends if you want to know how long it will take you home.
  2. A usecase might be, that you have a destination in coordinates but want to use the actual address in a voice announcement when its time to leave. Or you want to quickly see where a person is in the form of an address rather than coordinates.
1 Like

Iā€™m finding the sensor value confusingā€¦ I wouldā€™ve expected it to resolve to a single address based on the lat + long, but here Iā€™m getting output that has semi colon delimited list of locations, most are not addresses just street names.

E,.g. Iā€™ll see this:

East Shelby Street; Montlake Boulevard East, WA 513; East Montlake Place East

Ah you are referring to the route attribute.
This is a semicolon separated list of major road names that make up the route between origin and destination.
Someone had the usecase that he wanted to be alerted in the morning when his route to work would not start with a certain road name. This indicates that there is a major road block or incident.

ah yes, I see. Thanks, I wasnā€™t looking at the other ā€œorigin nameā€ and ā€œdestination nameā€. Very handy.

Thanks a lot for sharing your custom integration.
Sadly, Iā€™m struggling with a strange behaviour:

Origin and destination are set right but the calculated route is in the wrong direction.
As you can see, the route is starting at the destination and the finish is at the origin.
image

Any ideas on how to fix this?