-
-
Notifications
You must be signed in to change notification settings - Fork 35k
Add here_travel_time #24603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add here_travel_time #24603
Conversation
Hi, thanks for taking the time and for giving me feedback. I'm on vacation this week and will get back to you next Monday. |
I implemented the requested changes. While doing so I looked at the architecture discussion you linked and the other travel_time integrations and I too see a need/benefit for a travel time component. Lots of duplicate code and different naming conventions for the same stuff. I tried to follow the Waze implementation in order to have a common code base which can be refactored in the future. I would prefer to do this refactoring (creating a travel_time component) in a follow up PR as this will need more discussions and will impact more than one integration. |
You'll probably need to add tests to get this merged. |
How would these tests look like / what should be tested? |
Tests are not required, although appreciated, for integrations that communicates with devices or services. |
I am happy to provide them. Could you point me to a component test which you think might be a good starting point on how to do it properly? And thank you for the code, reviews and comments. I am really learning a lot here! |
The manual alarm control panel has test that set up the component, via I/O, api calls, should be patched as needed. |
I added the requested changes. Will work on tests after the weekend |
445f849
to
b74eb07
Compare
I released the component as a custom_component under https://github.com/eifinger/here_travel_time to gather some user feedback and did indeed find some bugs and missing features. Until I implement them and the tests I will close this PR and later reopen it again. |
if you add too many features and try to merge later on you might make it harder for yourself. It's always easier to merge something simple first just to get it in. Once the integration is there, it's easier to get updates merged to it in my experience.
…On Thu, Jul 18, 2019 at 8:50 AM Kevin Eifinger ***@***.***> wrote:
I released the component as a custom_component under
https://github.com/eifinger/here_travel_time to gather some user feedback
and did indeed find some bugs and missing features. Until I implement them
and the tests I will close this PR and later reopen it again.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#24603>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA7FQBMPSBBW22ETZEY5G4TQABRKXANCNFSM4HZCM2CQ>
.
|
I got to the tests faster than I thought. Let me know what I can improve, thank you! |
Reopen after following https://gist.github.com/robertpainsi/2c42c15f1ce6dab03a0675348edd4e2c |
f079541
to
af8025c
Compare
Switch route_mode and travel_mode in api request.
apply requested changes
123b69f
to
b0cae59
Compare
Just the final comment left to resolve. Then we can merge! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Thanks for the dedicated work! Can be merged when build passes. |
Thank you for all the time and explanations! I learned a lot! |
@MartinHjelmare I thought the frontend would somehow parse/clean up the attribution message but it does not. The frontend shows the message as is with html tags. Is there anything I can do on the component side? |
I found another attribution source in Ottawa, CA. "sourceAttribution": {
"attribution": "With the support of <span class=\"company\"><a href=\"https://transit.api.here.com/r?appId=Mt1bOYh3m9uxE7r3wuUx&u=http://ottawa.ca/en/mobile-apps-and-open-data/open-data-terms-use\">OC Transpo</a></span>. All information is provided without warranty of any kind.",
"supplier": [
{
"title": "OC Transpo",
"href": "https://transit.api.here.com/r?appId=Mt1bOYh3m9uxE7r3wuUx&u=http://ottawa.ca/en/mobile-apps-and-open-data/open-data-terms-use",
"note": [
{
"type": "disclaimer",
"text": "<a href=\"https://transit.api.here.com/r?appId=Mt1bOYh3m9uxE7r3wuUx&u=http://ottawa.ca/en/mobile-apps-and-open-data/open-data-terms-use\">Includes content from OC Transpo: http://ottawa.ca/en/mobile-apps-and-open-data/open-data-terms-use</a>",
"href": "https://transit.api.here.com/r?appId=Mt1bOYh3m9uxE7r3wuUx&u=http://ottawa.ca/en/mobile-apps-and-open-data/open-data-terms-use",
"hrefText": "Includes content from OC Transpo: http://ottawa.ca/en/mobile-apps-and-open-data/open-data-terms-use"
}
]
}
]
} Following the link provided under I will add another commit which builds the attribution (if present) according to the |
* Add here_travel_time * Bump herepy version to 0.6.2 * Update requirements_all.txt * Disable pylint and catch errors * Add herepy to requirements_test_all * Correctly place test req for herepy * use homeassistant.const.LENGTH_METERS * Implemented Requested Changes * Better error message for cryptic error code * add requested changes * add_entities instead of async * Add route attr and distance in km instead of m * fix linting errors * attribute duration in minutes instead of seconds * Correct pattern for longitude * dont split attribute but rather local var * move strings to const and use travelTime * Add tests * Add route for pedestrian and public * fix public transport route generation * remove print statement * Standalone pytest * Use hass fixture and increase test cov _resolve_zone is redundant * Clean up redundant code * Add type annotations * Readd _resolve_zone and add a test for it * Full test cov * use caplog * Add origin/destination attributes According to home-assistant#24956 * Add mode: bicycle * black * Add mode: publicTransportTimeTable * Fix error for publicTransportTimeTable Switch route_mode and travel_mode in api request. * split up config options * More type hints * implement *_entity_id * align attributes with google_travel_time * route in lib apply requested changes * Update requirements_all.txt * remove DATA_KEY * Use ATTR_MODE * add attribution * Only add attribution if not none * Add debug log for raw response * Add _build_hass_attribution * clearer var names in credentials check * async _are_valid_client_credentials
Description:
This PR adds here_travel_time as a new component. It is based on the code of google_travel_time but uses the here api.
Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#9648
Example entry for
configuration.yaml
(if applicable):Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
python3 -m script.hassfest
.requirements_all.txt
by runningpython3 -m script.gen_requirements_all
..coveragerc
.