Commit Graph

51 Commits (a9381d259040d4a02881cc9e203bc8e3946b2146)

Author SHA1 Message Date
Erik Montnemery 75743ed947
Use freezegun in here_travel_time tests (#99032) 2023-08-25 09:02:25 -05:00
Franck Nijhof ed79265843
Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
epenet 03710e58b5
Add type hints to integration tests (part 9) (#87983) 2023-02-13 12:06:51 +01:00
epenet 37a2040d7b
Add type hints to integration tests (h-i) (#87703) 2023-02-08 18:12:56 +01:00
Kevin Stillhammer 781a4267cf
Calculate data using all sections for here_travel_time (#86576)
Calculate data using all sections
2023-01-25 10:33:43 +01:00
Michael e35ab75c0b
Replace the usage of unit constants by enumerations in Tests [h-l] (#85934) 2023-01-15 14:52:55 +01:00
Kevin Stillhammer 588211223b
Bump here_transit/here_routing and Implement backoff mechanism for here_travel_time (#83976)
* Add failing test

* Add backoff mechanism for too many requests

* Increase async_fire_time_changed

* Minimize try/except block
2022-12-21 07:00:15 -08:00
Kevin Stillhammer ba94485ca1
Handle not existing arrival/departure keys for here_travel_time (#83754)
* handle not existing arrival/departure keys

* Use more concise code

* Add test

* Add testcase for empty arrival/departure
2022-12-20 16:47:43 -08:00
Kevin Stillhammer ab3f0fc63b
Handle special transit errors for here_travel_time (#83649)
Handle special transit errors
2022-12-09 21:09:55 -05:00
Kevin Stillhammer f88d22b833
Raise UpdateFailed when here_travel_time cannot find_location (#83157)
Fixes https://github.com/home-assistant/core/issues/83100
fixes undefined
2022-12-03 13:06:10 -05:00
Kevin Stillhammer e158546425
Add missing @callback decorator in here_travel_time sensor (#83009) 2022-11-30 22:40:17 +01:00
Kevin Stillhammer dffdc78915
Make HERETravelTimeSensor extend RestoreSensor (#82400) 2022-11-30 16:13:11 +01:00
Kevin Stillhammer 5257875ac6
Use SensorDeviceClass.DISTANCE for here_travel_time (#79159)
* Use SensorDeviceClass.DISTANCE in here_travel_time

* Removed unused import

* Use explicit units and conversion
2022-11-25 12:30:33 +01:00
Kevin Stillhammer aedbfdabee
Use HERE API v8 (#80892)
* Use HERE API v8

Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>

* Add migration

Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>

* Catch correct voluptuous error

Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>

* Use list comprehension for transit values

* Add migration alternative

Signed-off-by: Kevin Stillhammer <kevin.stillhammer@gmail.com>
2022-11-15 19:04:41 -08:00
epenet e84e5f134e
Use US_CUSTOMARY_SYSTEM in tests (#80658)
* Use US_CUSTOMARY_SYSTEM in tests

* Don't update test_unit_system
2022-10-20 15:42:23 +02:00
epenet 4c3097a157
Use local UNIT constants in here_travel_time (#80324)
* Use local UNIT constants in here_travel_time

* Fix test
2022-10-14 15:16:03 +02:00
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