Commit Graph

35 Commits (3840cbd012485e7cdae16421930b906f7e673791)

Author SHA1 Message Date
epenet 4c8f8c2e61
Adjust distance unit check in here travel time (#80243)
* Adjust distance unit check in here travel time

* Add tests

* Use system compare

* Use is not ==
2022-10-14 12:22:48 +02:00
Kevin Stillhammer 45ecddb9aa
Remove route sensor of here_travel_time (#79211) 2022-09-28 21:50:30 -04:00
Kevin Stillhammer de3be96bdb
Remove deprecated YAML import for here_travel_time (#77959) 2022-09-26 08:10:16 -07:00
Kevin Stillhammer f59c8d985d
Correct unit for here_travel_time distance sensor (#78303)
Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>

Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
2022-09-16 21:03:18 -07:00
epenet 9490771a87
Refactor distance, speed and volume utils (#77952)
* Refactor distance util

* Fix bmw connected drive tests

* Adjust here travel time tests

* Adjust waze travel time tests

* Adjust test_distance

* Adjust rounding values

* Adjust more tests

* Adjust volume conversions

* Add tests
2022-09-07 16:18:00 +02:00
Franck Nijhof a6244eea28
Search/replace RESULT_TYPE_* by FlowResultType enum (#74656) 2022-07-07 21:28:18 +02:00
Franck Nijhof 7cd68381f1
Search/replace RESULT_TYPE_* by FlowResultType enum (#74642) 2022-07-07 19:57:36 +03:00
Kevin Stillhammer bef512c425
Split attributes into sensors for here_travel_time (#72405) 2022-06-29 22:09:52 -07:00
Kevin Stillhammer e4cd04f936
Use length_util for here_travel_time (#72458) 2022-05-24 20:42:37 -07:00
Kevin Stillhammer 967f4efc56
Cleanup config flow and tests for here_travel_time (#72364) 2022-05-23 16:50:05 +02:00
Kevin Stillhammer 9763b44357
Remove uneeded patch statements in here_travel_time (#72361) 2022-05-23 14:38:40 +02:00
Kevin Stillhammer 7649adde5f
Fix here_travel_time config_flow import (#72313)
* Handle import of entity_namespace

* Update homeassistant/components/here_travel_time/config_flow.py

Co-authored-by: Allen Porter <allen.porter@gmail.com>

* Fix mypy

Co-authored-by: Allen Porter <allen.porter@gmail.com>
2022-05-22 18:41:54 -07:00
Kevin Stillhammer f1ac9f8cca
Add ConfigFlow for here_travel_time (#69212)
* Add ConfigFlow for here_travel_time

* Use Selectors and Menu

* Use separate config flow steps for menus

* Move time options together

* Update homeassistant/components/here_travel_time/config_flow.py

Co-authored-by: Allen Porter <allen.porter@gmail.com>

* Blacken config_flow

* Initialize _config

* Only catch HERE errors

* Fix unknown error test

* Implement async_step_import

* Only catch errors for validate_api_key

* Split lat/lon

* Add additional test coverage

* Use TimeSelector in option flow

* Assert config entry data/option

Co-authored-by: Allen Porter <allen.porter@gmail.com>
2022-05-21 07:36:02 -07:00
Kevin Stillhammer 6106f07820
Catch malformed coordinates in here_travel_time (#69023)
* Catch malformed coordinates in here_travel_time

* Add testcase for malformed entity_id state

* Replace type ignore with None check

* Directly raise InvalidCoordinatesException
2022-04-03 10:21:55 -07:00
Kevin Stillhammer 259b069dd9
Ensure API is called correctly in here_travel_time (#68840) 2022-03-30 13:49:21 +02:00
epenet 053c4428a9
Prettify json (component test fixtures) (#68892) 2022-03-30 11:37:17 +02:00
Kevin Stillhammer adbacdd5c2
Use DataUpdateCoordinator in here_travel_time (#61398)
* Add DataUpdateCoordinator

* Use TypedDict for extra_state_attributes

* Extend DataUpdateCoordinator

* Use platform enum

* Use attribution property

* Use relative imports

* Revert native_value logic

* Directly return result in build_hass_attribution

* Correctly declare traffic_mode as bool

* Use self._attr_*

* Fix mypy issues

* Update homeassistant/components/here_travel_time/__init__.py

Co-authored-by: Allen Porter <allen.porter@gmail.com>

* Update homeassistant/components/here_travel_time/__init__.py

Co-authored-by: Allen Porter <allen.porter@gmail.com>

* Update homeassistant/components/here_travel_time/sensor.py

Co-authored-by: Allen Porter <allen.porter@gmail.com>

* blacken

* from datetime import time

* remove none check

* Move dataclasses to models.py

* Set destination to now if None

* Add mypy error code

Co-authored-by: Allen Porter <allen.porter@gmail.com>
2022-03-23 20:53:31 -07:00
Kevin Stillhammer d1962f6e51
Cleanup here_travel_time tests (#60529) 2021-12-01 21:52:44 +01:00
Kevin Stillhammer 6167e4178b
Use find_coordinates in here_travel_time (#59938) 2021-11-29 16:54:03 +01:00
Paulus Schoutsen 31153ac155
Move fixtures part 1 (#58902) 2021-11-01 20:47:05 -07:00
Paulus Schoutsen a4d9019ffc
Refactor persistent notification to no longer route all data via a service (#57157)
* Convert persistent notification tests to async

* Create/dismiss persistent notifications in exposed functions, not service calls

* Fix notify persistent_notification

* Remove setting up persistent_notification

* Drop more setups

* Empty methods

* Undeprecate sync methods because too big task

* Fix setup clearing notifications

* Fix a bunch of tests

* Fix more tests

* Uno mas

* Test persistent notification events

* Clean up stale comment

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-10-07 12:58:00 +02:00
Ville Skyttä 7d03b02192
Spelling fixes (#51642) 2021-06-11 13:35:03 +02:00
Franck Nijhof c5383219f1
Remove stale debug statements from tests (#51059) 2021-05-25 11:52:20 +02:00
Franck Nijhof 65cf2fcb6f
Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
J. Nick Koston 89a9634d35
Use eventloop for scheduling (#37184)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-06-29 09:39:24 -07:00
Paulus Schoutsen 276f3afb00
Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-05-31 22:18:30 -07:00
Paulus Schoutsen 2af984917e
Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Kevin Eifinger c18a6d5ea3
Fix #33995 Use "now" if departure is None (#34017) 2020-04-11 16:47:07 +02:00
Kevin Eifinger 2cda7bf1e7
Add Here travel time arrival departure (#29909)
* here_travel_time: Add modes arrival and departure

* convert arrival/departure from datetime to time

* Default departure is set by external lib on None

* Use cv.key_value_schemas
2020-03-16 21:16:49 -07:00
springstan a85808e325
Add and use time related constants (#32065)
* Add and use time related constants

* Sort time constants and reuse them in data rate constants

* Fix greeneyemonitor import

* Fix greeneyemonitor import V2

* Fix failing here_travel_time test

* Add TIME_MONTHS and TIME_YEARS

* Use TIME_MINUTES in opentherm_gw and isy994

* Add and use TIME_MILLISECONDS

* Change inconsistent ones

* Add TIME_MICROSECONDS and TIME_WEEKS

* Use constants in apcupsd and travisci

* Fix import error in upnp sensor.py

* Fix isy994 sensor.py using TIME_YEARS

* Fix dyson tests

* Use TIME_SECONDS in more places

* Use TIME_DAYS in google wifi
2020-02-23 22:09:24 +02:00
Ville Skyttä e6388e186c
Remove unnecessary string literal concatenations (#30360) 2020-01-02 21:17:10 +02:00
Kevin Eifinger fc01da8933 Migrate to api_key (#29966) 2019-12-16 08:20:41 +01:00
Kevin Eifinger 9f181ac92e bump herepy to 0.6.3.3 (#28907)
* bump herepy to 0.6.3.3

* run gen_requirements_all
2019-11-20 22:37:59 +01:00
Kevin Eifinger 48fd95c7db Fix Here Travel Time unable to find entity on startup (#27237)
* add support for entity_id as state of entity

* add circular reference detection

* voluptuous instead of regex

* wait for EVENT_HOMEASSISTANT_START

* move delayed_sensor_update to async_added_to_hass

* add @callback decorator

* remove nested entity resolving
2019-11-12 15:04:17 +01:00
Kevin Eifinger 5c0fa35d4a Add here_travel_time (#24603)
* 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 https://github.com/home-assistant/home-assistant/pull/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
2019-09-23 11:50:18 +02:00