Commit Graph

28 Commits (ef7c7f1c054b4ef5004c13af8bccd10141863bf5)

Author SHA1 Message Date
Marc Mueller 0293315b23
Use PEP 695 for covariant class annotations (#117780) 2024-05-20 10:55:44 +02:00
Sid 2cc916db6d
Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
J. Nick Koston 120525e94f
Add the ability to create Debouncer tasks as background tasks (#113128)
* Add the ability to Debouncer tasks in the background

This is a more general solution as a followup to
https://github.com/home-assistant/core/pull/112652#discussion_r1517159607

* Add the ability to Debouncer tasks in the background

This is a more general solution as a followup to
https://github.com/home-assistant/core/pull/112652#discussion_r1517159607

* fix
2024-03-12 08:41:12 -04:00
J. Nick Koston 620433a79d
Run coroutines as eager tasks in async_run_hass_job (#111683)
* Run coroutines as eager tasks in async_run_hass_job

Note that this does not change async_add_hass_job

Do not merge this. For test run only

* Phase out periodic tasks

* false by default or some tests will block forever, will need to fix each one manually

* kwarg works

* kwarg works

* kwarg works

* fixes

* fix more tests

* fix more tests

* fix lifx

* opensky

* pvpc_hourly_pricing

* adjust more

* adjust more

* smarttub

* adjust more

* adjust more

* adjust more

* adjust more

* adjust

* no eager executor

* zha

* qnap_qsw

* fix more

* fix fix

* docs

* its a wrapper now

* add more coverage

* coverage

* cover all combos

* more fixes

* more fixes

* more fixes

* remaining issues are legit bugs in tests

* make tplink test more predictable

* more fixes

* feedreader

* grind out some more

* make test race safe

* limit first scope to triggers

* one more

* Start tasks eagerly in for async_at_start(ed)

A few of these can avoid being scheduled on the loop
during startup

* fix cloud

* Revert "fix cloud"

This reverts commit 5eb3ce695d.

* fix test to do what start does

* flip flag

* flip flag

* Fix here_travel_time creating many refresh requests at startup

- Each entity would try to refresh the coordinator which
  created many tasks. Move the refresh to a single
  async_at_started

- The tests fired the EVENT_HOMEASSISTANT_START event
  but the code used async_at_started which only worked
  because the tests did not set CoreState to not_running

* fix azure

* remove kw

* remove kw

* rip

* cover

* more rips

* more rips

* more rips
2024-03-11 20:05:08 -04:00
J. Nick Koston a2318c26c9
Run debouncer tasks eagerly to avoid scheduling on the event loop (#112789) 2024-03-10 08:37:10 -10:00
Marc Mueller 19ab3d6daf
Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
J. Nick Koston fb4e8a4f3b
Start the debouncer task eagerly (#111569) 2024-02-26 16:29:46 -10:00
J. Nick Koston ff0e0b3e77
Convert debouncer async_shutdown to be a normal function (#111257)
* Convert debouncer async_shutdown to be a normal function

nothing was being awaited here and the shutdown call was only used
in integrations marked internal and other internals. Its possible
that a custom component might have been using the method but it
seemed uncommon enough that it did not warrent marking as a breaking
change. The update coordinator is no longer awaiting anything in
async_shutdown either now but it seemed likely that this use
would get subclassed.

* fix
2024-02-24 08:37:33 +01:00
J. Nick Koston 490c03d248
Add async_schedule_call to the Debouncer (#111051) 2024-02-21 00:09:45 -06:00
Shay Levy 0d55718117
Downgrade Debouncer call ignored log message (#98840) 2023-08-22 14:42:33 -05:00
J. Nick Koston 26be0fab78
Fix debouncer not scheduling timer when wrapped function raises (#94689)
* Fix debouncer not scheduling timer when callback function raises

* test coro as well

* preen
2023-06-15 22:15:49 -04: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 81f018b7e5
Make Debouncer shutdown async (#91542)
* Make shutdown async in Debouncer

* Adjust test
2023-04-17 23:31:30 +02:00
epenet 19a6530c3c
Add ability to shutdown a Debouncer (#91439)
* Add ability to shutdown a Debouncer

* Use async_create_task
2023-04-14 21:01:21 -04:00
epenet dbebe57d51
Avoid unnecessary Task in debouncer (#89370) 2023-03-09 11:41:59 +01: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
Marc Mueller 5ae5ae5392
Improve debouncer typing (#75436) 2022-07-19 18:35:04 +02:00
Marc Mueller bfb1abd3a2
Add type ignore error codes [helpers] (#66776) 2022-02-18 11:31:37 +01:00
Marc Mueller 77ee72cbb9
Import Callable from collections.abc (1) (#56775) 2021-09-29 16:32:11 +02:00
Ruslan Sayfutdinov 391b2f8ccd
Add missing return type in Core constructors (#50884) 2021-05-20 18:53:29 +03: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
Marc Mueller 6fb2e63e49
Update typing 02 (#48014) 2021-03-17 18:34:19 +01:00
Paulus Schoutsen 5b6d9abe2a
Await callbacks to keep cleaner stacktraces (#43693) 2020-11-27 17:48:43 +01:00
J. Nick Koston 0b3bea0282
Use async_add_hass_job for debouncer (#41449) 2020-10-09 08:40:36 +02:00
Paulus Schoutsen 4ae31bc938
Clean up device registry if entity registry updates (#35106) 2020-05-05 10:53:46 -07:00
Paulus Schoutsen 2a88ae559e
Improve debounce cooldown (#32161) 2020-02-26 11:27:37 -08:00
Paulus Schoutsen 0d474e1183
Update the update coordinator API to make it easier to use (#31471)
* Update the update coordinator API to make it easier to use

* failed_last_update -> last_update_success
2020-02-06 09:29:29 -08:00
Paulus Schoutsen 166d770ddd
Update Hue data fetching (#31338)
* Refactor Hue Lights to use DataCoordinator

* Redo how Hue updates data

* Address comments

* Inherit from Entity and remove pylint disable

* Add tests for debounce
2020-01-31 14:47:40 -08:00