๐Ÿ“ฆ eifinger / open_route_service

Custom Component for Homeassistant Providing Travel Time Information using openrouteservice.org

โ˜… 14 stars โ‘‚ 4 forks ๐Ÿ‘ 14 watching โš–๏ธ MIT License
homeassistantopen-route-servicepythonpython3
๐Ÿ“ฅ Clone https://github.com/eifinger/open_route_service.git
HTTPS git clone https://github.com/eifinger/open_route_service.git
SSH git clone git@github.com:eifinger/open_route_service.git
CLI gh repo clone eifinger/open_route_service
Kevin Eifinger Kevin Eifinger docs: Add installs badge bd5ad0a 3 years ago ๐Ÿ“ History
๐Ÿ“‚ bd5ad0a107d7e6308e544be63efe0d03dd1cc8e8 View all commits โ†’
๐Ÿ“ .devcontainer
๐Ÿ“ .github
๐Ÿ“ .vscode
๐Ÿ“ custom_components
๐Ÿ“ tests
๐Ÿ“„ .gitignore
๐Ÿ“„ .pylintrc
๐Ÿ“„ .releaserc
๐Ÿ“„ CONTRIBUTING.md
๐Ÿ“„ example.png
๐Ÿ“„ hacs.json
๐Ÿ“„ info.md
๐Ÿ“„ LICENSE
๐Ÿ“„ pyproject.toml
๐Ÿ“„ README.md
๐Ÿ“„ requirements.txt
๐Ÿ“„ README.md

openrouteservice

GitHub Release GitHub Activity hacs HACS Installs License Project Maintenance BuyMeCoffee Community Forum Homeassistant Custom Component sensor provides travel time from https://maps.openrouteservice.org/. This component will set up the following platforms. Platform | Description -- | -- sensor | Show travel time between two places. example

Installation

HACS

The easiest way to add this to your Homeassistant installation is using HACS. And then follow the instructions under Configuration below.

Manual

  • Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  • If you do not have a custom_components directory (folder) there, you need to create it.
  • In the custom_components directory (folder) create a new folder called open_route_service.
  • Download all the files from the custom_components/open_route_service/ directory (folder) in this repository.
  • Place the files you downloaded in the new directory (folder) you created.
Using your HA configuration directory (folder) as a starting point you should now also have this: ``text custom_components/open_route_service/__init__.py custom_components/open_route_service/manifest.json custom_components/open_route_service/sensor.py ` ## Setup You need to register for an API key [here](https://openrouteservice.org/dev). Openroute Services offers a Free Plan which includes 1.000 free requests (For reverse geocoding) per day. More information can be found [here](https://openrouteservice.org/plans/) ## Configuration To enable the sensor, add the following lines to your configuration.yaml file: `yaml # Example entry for configuration.yaml 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" ` ## Configuration options Key | Type | Required | Description -- | -- | -- | -- apikey | string | true | Your application's API key (get one by following the instructions above). originlatitude | string | true | The starting latitude for calculating travel distance and time. Must be used in combination with origin_longitude. Cannot be used in combination with origin_entity_id originlongitude | string | true | The starting longitude for calculating travel distance and time. Must be used in combination with origin_latitude. Cannot be used in combination with origin_entity_id destinationlatitude | string | true | The finishing latitude for calculating travel distance and time. Must be used in combination with destination_longitude. Cannot be used in combination with destination_entity_id destinationlongitude | string | true | The finishing longitude for calculating travel distance and time. Must be used in combination with destination_latitude. Cannot be used in combination with destination_entity_id originentityid | string | true | The entity_id holding the starting point for calculating travel distance and time. Cannot be used in combination with origin_latitude / origin_longitude destinationentityid | string | true | The entity_id holding the finishing point for calculating travel distance and time. Cannot be used in combination with destination_latitude / destination_longitude name | string | false | A name to display on the sensor. The default is "HERE Travel Time". mode | string | false | You can choose between: cycling-regular, driving-car or foot-walking. The default is driving-car. routemode | string | false | You can choose between: fastest, or shortest. The default is fastest unitsystem | string | false | You can choose between metric or imperial. Defaults to metric or imperial based on the Home Assistant configuration. scaninterval | integer | false | "Defines the update interval of the sensor in seconds. Defaults to 300 (5 minutes)." originreversegeocodeenabled | boolean | false | "Whether to resolve the origin coordinates to a geolocation(address). Defaults to true." destinationreversegeocodeenabled | boolean | false | "Whether to resolve the destination coordinates to a geolocation(address). Defaults to true." ## Dynamic Configuration Tracking can be set up to track entities of type devicetracker, 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. `yaml # Example entry for configuration.yaml sensor: # Tracking entity to entity - platform: open_route_service api_key: "YOUR_API_KEY" name: Phone To Home origin_entity_id: device_tracker.mobile_phone destination_entity_id: zone.home ` ## Entity Tracking - **device_tracker** - If the state is a zone, then the zone location will be used - If the state is not a zone, it will look for the longitude and latitude attributes - **zone** - Uses the longitude and latitude attributes - **sensor** - If the state is a zone, then will use the zone location - All other states will be passed directly into the HERE API - This includes all valid locations listed in the _Configuration Variables_ ## Updating sensors on-demand using Automation You can also use the homeassistant.updateentity service to update the sensor on-demand. For example, if you want to update sensor.morning_commute every 2 minutes on weekday mornings, you can use the following automation: `yaml automation: - id: update_morning_commute_sensor alias: "Commute - Update morning commute sensor" initial_state: 'on' trigger: - platform: time_pattern minutes: '/2' condition: - condition: time after: '08:00:00' before: '11:00:00' - condition: time weekday: - mon - tue - wed - thu - fri action: - service: homeassistant.update_entity entity_id: sensor.morning_commute `` Buy Me A Coffee