Commit Graph

60 Commits (b35fbd8d20312d33a9599ec691ccd359fab0016f)

Author SHA1 Message Date
Sid 0d66d298ec
Enable Ruff RET504 (#114528)
* Enable Ruff RET504

* fix test

* Use noqa instead of cast

* fix sonos RET504

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-04-06 11:07:37 +02:00
Joost Lekkerkerker b9281327c4
Use FlowResultType enum in config flow tests A-M (#114681) 2024-04-03 09:21:17 +02:00
Joost Lekkerkerker 906d3198e3
Use is in enum comparison in config flow tests F-J (#114670)
* Use right enum expression F-J

* Fix
2024-04-02 23:01:37 +02:00
Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Sid 00ec7f11f0
Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
J. Nick Koston d939c48b4a
Fix here_travel_time creating many refresh requests at startup (#113041) 2024-03-11 15:11:33 +01:00
Marc Mueller 32f3f46542
Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
Marc Mueller c88b337600
Add empty line after module docstring [tests f-k] (#112709) 2024-03-08 14:50:04 +01:00
J. Nick Koston c399cab427
Small speed up to checking core state (#107845) 2024-01-18 08:41:32 -10:00
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