Commit Graph

60 Commits (d4e72c49faa6f7ac6d3b2c0d1fd4550041f4afe5)

Author SHA1 Message Date
Erik Montnemery c47983621c
Teach CoordinatorWeatherEntity about multiple coordinators (#98830) 2023-08-24 11:28:20 +02:00
J. Nick Koston 13349e76ed
Avoid firing update coordinator callbacks when nothing has changed (#97268) 2023-07-28 12:19:20 -05:00
Marc Mueller 6033f39a0d
Partial revert "Add TypeVar defaults for DataUpdateCoordinator (#95026)" (#95101)
* Revert "Add TypeVar defaults for DataUpdateCoordinator and EntityComponent (#95026)"

This reverts commit 90f5b1c323.

* Don't revert everything
2023-06-23 14:42:34 +02:00
Marc Mueller 90f5b1c323
Add TypeVar defaults for DataUpdateCoordinator and EntityComponent (#95026) 2023-06-22 03:33:23 +02:00
epenet 70bfbde8aa
Add ability to shutdown a coordinator on STOP (#92611) 2023-05-05 16:05:03 +02:00
epenet 79ad9a3646
Shutdown coordinator on entry unload (#91748)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-04-21 10:07:31 +02:00
epenet ae0cbffdd8
Add ability to shutdown update coordinator (#91456)
* Add ability to shutdown update coordinator

* Adjust nibe_heatpump

* Add tests

* Use async

* Remove duplicate code in update coordinator

* Adjust

* Revert nibe changes - it can now be done in a follow-up PR

* Adjust

* Fix incorrect merge

* async_fire_time_changed
2023-04-18 18:56:43 +02:00
epenet 28652345bd
Remove duplicate code in update coordinator (#91573) 2023-04-17 13:07:58 -10:00
epenet 48fca3bb27
Fix missing debouncer cancel in update coordinator (#89383)
* Fix missing debouncer cancel in update coordinator

* Improve

* Adjust with comment

* Adjust again

* Simplify PR

* Adjust tests to avoid lingering timer

* Improve
2023-03-09 15:16:52 -05:00
J. Nick Koston 11681f3f31
Pass a helpful name when creating common asyncio tasks in core (#89171) 2023-03-05 12:46:02 +01:00
Franck Nijhof 06a35fb7db
Code styling tweaks to core helpers (#85441) 2023-01-08 13:44:09 -10:00
Marc Mueller 516cb31635
Fix multi inheritance with CoordinatorEntity (#85053) 2023-01-03 23:07:59 +01:00
Marc Mueller 972eb34ed9
Improve `bluetooth` generic typing (#84891)
Co-authored-by: J. Nick Koston <nick@koston.org>
2023-01-02 21:19:53 -10:00
Franck Nijhof c715035016
Add support for raising ConfigEntryError (#82689) 2022-11-25 11:33:03 +01:00
J. Nick Koston d0efdd750f
Fix high latency from thundering heard at 0 microseconds (#82233)
* Fix high latency at 0 microseconds

fixes #82231

* fix async_track_utc_time_change alignment

* use replace to preserve fold

* naming

* tweak

* make async_fire_time_changed aware of the thundering heard issue
2022-11-17 14:22:06 -05:00
epenet 9f691ab359
Revert "Fix coordinator TypeVar definition (#81298)" (#81834) 2022-11-09 09:03:59 +01:00
epenet 318122fe53
Fix coordinator TypeVar definition (#81298)
* Adjust coordinator TypeVar definition

* Adjust again
2022-11-08 10:38:29 +01:00
Marc Mueller 5ae5ae5392
Improve debouncer typing (#75436) 2022-07-19 18:35:04 +02:00
Allen Porter f4e61eff18
Add update coordinator for google calendar (#74690)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-07-10 21:24:52 -07:00
Marc Mueller 983a76a91c
Update pylint to 2.14.0 (#73119) 2022-06-06 21:43:47 +02:00
Joakim Plate 8910d265d6
Keep track of a context for each listener (#72702)
* Remove async_remove_listener

This avoids the ambuigity as to what happens if same callback is added multiple times.

* Keep track of a context for each listener

This allow a update coordinator to adapt what data to request on update from the backing service based on which entities are enabled.

* Clone list before calling callbacks

The callbacks can end up unregistering and modifying the dict while iterating.

* Only yield actual values

* Add a test for update context

* Factor out iteration of _listeners to helper

* Verify context is passed to coordinator

* Switch to Any as type instead of object

* Remove function which use was dropped earliers

The use was removed in 8bee25c938
2022-06-03 13:55:57 +02:00
J. Nick Koston c393622b64
Avoid calling time.monotonic on coordinator refresh unless we are debugging (#70209) 2022-04-17 22:40:44 -07:00
Marc Mueller 830cc278d3
Improve `CoordinatorEntity` typing (#68441) 2022-03-21 10:22:30 +01:00
Marc Mueller eae0c75620
Make TypeVars private (2) (#68206) 2022-03-17 19:09:55 +01:00
Ruslan Sayfutdinov 55f4962c06
Fix pylint plugin which checks relative imports (#62693) 2021-12-23 11:14:47 -08:00
Marc Mueller 77ee72cbb9
Import Callable from collections.abc (1) (#56775) 2021-09-29 16:32:11 +02:00
Paulus Schoutsen f1a4ba8bb0
Add Rainforest Eagle tests and price (#54887) 2021-08-19 13:19:31 -07:00
Paulus Schoutsen 4ae2a26aa3
Add config flow to Rainforest EAGLE-200 (#54846)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-08-19 09:22:30 -07:00
Paulus Schoutsen ee2c950716
Merge system options into pref properties (#51347)
* Make system options future proof

* Update tests

* Add types
2021-06-01 22:34:31 +02:00
Paulus Schoutsen 4821484d2c
Add system option to disable polling (#51299) 2021-05-31 15:36:40 -07:00
Ruslan Sayfutdinov 391b2f8ccd
Add missing return type in Core constructors (#50884) 2021-05-20 18:53:29 +03:00
Ruslan Sayfutdinov f53284b200
Make CoordinatorEntity generic (#49854) 2021-04-30 13:24:27 -07:00
Ruslan Sayfutdinov 5008c27e7a
Relax type annotation for DataUpdateCoordinator data (#49827) 2021-04-28 18:31:08 -10:00
J. Nick Koston 3fa8ffa731
Enable mccabe complexity checks in flake8 (#49616)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-04-25 12:38:40 +02:00
Marc Mueller c07646db5d
Update typing syntax (#49480)
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
J. Nick Koston 8bee25c938
Fix stop listener memory leak in DataUpdateCoordinator on retry (#49186)
* Fix stop listener leak in DataUpdateCoordinator

When an integration retries setup it will add a new stop listener

* Skip scheduled refreshes when hass is stopping

* Update homeassistant/helpers/update_coordinator.py

* ensure manual refresh after stop
2021-04-14 12:16:59 -10:00
J. Nick Koston 4cd7f9bd8b
Raise ConfigEntryAuthFailed during setup or coordinator update to start reauth (#48962) 2021-04-09 19:41:29 -10:00
J. Nick Koston a851bff95a
Create async_config_entry_first_refresh to reduce coordinator boilerplate (#48451) 2021-03-29 12:51:39 -10:00
Marc Mueller 6fb2e63e49
Update typing 02 (#48014) 2021-03-17 18:34:19 +01:00
tkdrob c2302784c2
Use core constants for helpers (#46240) 2021-02-08 22:53:17 +01:00
Ville Skyttä 82607977ef
Various type hint improvements (#46144) 2021-02-08 11:59:46 +01:00
Shay Levy f117ddc6fa
Stop update_coordinator schedule refresh when HA is stopping (#45338)
* Stop update_coordinator schedule refresh when HA is stopping

* Add unittests

* Fix event type
2021-01-22 00:23:50 +01:00
Paulus Schoutsen 1844e30858
Add support for manual updating a data coordinator (#42746) 2020-11-02 09:54:08 +01:00
J. Nick Koston 9e1461da62
Determine how to run listeners at setup time instead of execution time (#41304) 2020-10-07 16:51:50 +02:00
Paulus Schoutsen 22b4ad6308
Allow processing data in CoordinatorEntity before writing state (#40926) 2020-10-02 09:16:37 +02:00
J. Nick Koston 8b893173fd
Prevent CoordinatorEntity from requesting updates on disabled entities (#39452) 2020-08-30 12:10:22 -05:00
Paulus Schoutsen 5a7f1d62c1
CoordinatorEntity to call super added_to_hass (#39416) 2020-08-30 08:42:33 -05:00
J. Nick Koston f8712b0e00
Create a CoordinatorEntity class to avoid repating code in integrations (#39388) 2020-08-30 12:02:37 +02:00
Ville Skyttä c2a21fa496
Update coordinator improvements (#38366)
* Make generic

* Add type info to bunch of uses

* Recognize requests exceptions

* Recognize urllib exceptions
2020-07-30 18:04:00 +03:00
Rohan Kapoor 0db8140c13
Add support for the DataUpdateCoordinator to not automatically update (#37734) 2020-07-10 15:48:20 -07:00