1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-23 04:19:34 +00:00
Commit Graph

3274 Commits

Author SHA1 Message Date
J. Nick Koston
b7d9f26cee Cache the job type for entity service calls (#112793) 2024-03-08 22:49:08 -10:00
J. Nick Koston
9ca9d7f48f Use eager_start for tasks to register integration platforms (#112800) 2024-03-08 22:10:57 -10:00
J. Nick Koston
a50883d975 Run service call tasks eagerly (#112791) 2024-03-08 20:37:21 -10:00
J. Nick Koston
6a7c255b93 Improve entity translation typing (#112788)
* Improve entity translation typing

* Improve entity translation typing
2024-03-08 22:30:13 -05:00
J. Nick Koston
65358c129a Replace periodic tasks with background tasks (#112726)
* 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

* one more
2024-03-08 21:45:10 -05:00
J. Nick Koston
08416974c9 Avoid trying to load translations for integrations that have none (#112683) 2024-03-08 14:21:44 -10:00
Marc Mueller
de886d8c49 Update EventBus listen type signatures (#112760) 2024-03-08 21:57:23 +01:00
Marc Mueller
cef20506dc Replace EventType with Event [missing] (#112753) 2024-03-08 21:56:42 +01:00
Marc Mueller
b026b5d589 Replace EventType with Event [helpers] (#112743) 2024-03-08 19:41:50 +01:00
Marc Mueller
a6b842f818 Add empty line after module docstring (2) [other] (#112738) 2024-03-08 19:16:38 +01:00
Marc Mueller
cb8c14496c Use more f-strings [ruff] (#112695) 2024-03-08 18:44:42 +01:00
Franck Nijhof
aa7acb89c5 Remove Python 3.11 from CI (#112626) 2024-03-08 17:42:18 +01:00
Marc Mueller
19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
Marc Mueller
d7e7dc96cc Make Event data generic (#111955) 2024-03-08 13:46:16 +01:00
Marc Mueller
2d701d5a7d Use aiohttp.AppKey for http cors keys (#112658) 2024-03-08 11:51:59 +01:00
Marc Mueller
4893087a7e Add TypeVar defaults for DataUpdateCoordinator (#111949) 2024-03-08 11:14:16 +01:00
J. Nick Koston
caefdc6192 Avoid writing registries to disk during startup (#112662) 2024-03-07 19:14:42 -10:00
J. Nick Koston
a6b17dbe68 Schedule polling as periodic tasks (#112640)
* Schedule periodic coordinator updates as background tasks.

Currently, the coordinator's periodic refreshes delay startup because they are not scheduled as background tasks. We will wait if the startup takes long enough for the first planned refresh. Another coordinator's scheduled refresh will be fired on busy systems, further delaying the startup. This chain of events results in the startup taking a long time and hitting the safety timeout because too many coordinators are refreshing.

This case can also happen with scheduled entity refreshes, but it's less common. A future PR will address that case.

* periodic_tasks

* periodic_tasks

* periodic_tasks

* merge

* merge

* merge

* merge

* merge

* fix test that call the sync api from async

* one more place

* cannot chain

* async_run_periodic_hass_job

* sun and pattern time changes from automations also block startup

* Revert "sun and pattern time changes from automations also block startup"

This reverts commit 6de2defa05.

* make sure polling is cancelled when config entry is unloaded

* Revert "Revert "sun and pattern time changes from automations also block startup""

This reverts commit e8f12aad55.

* remove DisabledError from homewizard test as it relies on a race

* fix race

* direct coverage
2024-03-07 23:32:26 -05:00
Erik Montnemery
49d20eedd4 Remove local imports of hass-nabucasa (#112634) 2024-03-07 20:37:35 +01:00
Marc Mueller
8ca127df2a Use KEY_HASS [h-z] (#112610) 2024-03-07 18:03:44 +01:00
Marc Mueller
531e25cbc6 Change KEY_HASS to be an aiohttp AppKey (#111954) 2024-03-07 13:37:48 +01:00
Erik Montnemery
82efb3d35b Make FlowResult a generic type (#111952) 2024-03-07 12:41:14 +01:00
J. Nick Koston
1fb9cfe37e Speed up the frame helper (#112562) 2024-03-06 20:54:09 -10:00
J. Nick Koston
a7b4cd3512 Pass job type to event listeners when creating entities (#112551) 2024-03-06 16:10:07 -10:00
J. Nick Koston
84455dbe1d Avoid having to work out the job type for each entity service at startup (#112557) 2024-03-06 16:09:55 -10:00
Erik Montnemery
8c2c3e0839 Improve integration_entities template function (#111943) 2024-03-06 11:05:06 +01:00
Jan-Philipp Benecke
995d93dd33 Remove deprecated hass.components usage in config entry flow (#111880)
* Remove deprecated `hass.components` usage in config entry flow

* Do local import

* Also use local import for webhook
2024-03-06 09:07:09 +01:00
J. Nick Koston
f3a9756f81 Avoid waiting for integration platforms in the parent integration (#112467) 2024-03-05 21:16:42 -10:00
J. Nick Koston
8fe80a4766 Migrate remaining get_platform in check_config to async_get_platform (#112470)
These were very likely to be cached so they were low on the
list to migrate, but since they are called in the event loop
its best to be sure we do no blocking I/O
2024-03-05 23:47:41 -05:00
J. Nick Koston
982c8f8f4a Fix incorrect scope on checking files to load in translations (#112457)
discovered in https://github.com/home-assistant/core/pull/112295#discussion_r1513505710

We only checked if the last language had files to load
instead of all of them. The checks for each language
are the same because the only reason we would skip
a language is a missing/broken integration or the integration
is a single file. Both of these loop conditions are always
the same reguardless of the language so the check worked
2024-03-05 23:46:24 -05:00
J. Nick Koston
e568f867d2 Adjust MAX_LOAD_CONCURRENTLY constant to allow 6 storage loaders (#112468) 2024-03-05 16:31:10 -10:00
J. Nick Koston
fbabbc8f92 Limit legacy state translations to custom components (#112295)
* Limit legacy state translations to custom components

We were trying to load **thousands** of `*.light.json`, `*.switch.json` files at run time that did not exist.

There have been replaced with entity translations: https://github.com/home-assistant/developers.home-assistant/pull/1557 https://github.com/home-assistant/core/pull/82701

https://github.com/home-assistant/core/pull/112023 will completely remove them, but
for now we will only load them for custom components to reduce the number
of files having to be examined

* reduce

* reduce

* reduce

* reduce

* comment

* coverage

* try to remove empty dict in loaded_translations fallback when missing
2024-03-05 17:27:45 -05:00
Erik Montnemery
3d3e9900c3 Add TypeVar default for FlowResult (#112345)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2024-03-05 22:52:11 +01:00
J. Nick Koston
390f5822fe Initialize triggers eagerly (#112294)
Most of these will never suspend and do not need
to be scheduled as tasks on the event loop
2024-03-05 09:58:43 -05:00
J. Nick Koston
f3eb292c2d Remove async_entity_ids and get_entity_ids from entity registry (#112311)
added in #112277 but not used yet.
2024-03-05 14:50:41 +01:00
J. Nick Koston
8b017016b0 Refactor integration platforms to import in the executor (#112168)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-03-04 19:21:18 -10:00
J. Nick Koston
1e173e82d0 Add support for preloading platforms in the loader (#112282)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-03-04 16:33:12 -10:00
J. Nick Koston
2c179dc5fb Reduce some linear searches to cleanup the device registry (#112277)
Some of the data we had to search for was already available
in a dict or underlying data structure. Make it available
instead of having to build it every time.

There are more places these can be used, but I only did
the device registry cleanup for now
2024-03-04 20:59:12 -05:00
RoboMagus
b381922a20 Issues template function (#95206)
* Add 'issues' template function for listing active issues.

* Add issue template function test

* Add 'issue' template function for getting specific issue by domain and issue_id

* Remove comment

* Fix function description

* Remove reduntant function,
Fix tests

* remove pass_context

* remove issues filter

Co-authored-by: Erik Montnemery <erik@montnemery.com>

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2024-03-04 14:22:14 +01:00
J. Nick Koston
331989de4c Migrate condition/state/trigger helper to use async_get_platform (#112144)
Currently these would always load the platform in the loop
if it was not already loaded
2024-03-03 21:20:47 -05:00
J. Nick Koston
da6eca7b68 Avoid compiling entity service schema when passed defaults (#112099)
* Avoid compiling entity service schema when passed defaults

* dry
2024-03-03 12:50:04 -05:00
J. Nick Koston
a37c82e34c Add comment to integration platform helper about blocking I/O (#112103) 2024-03-03 07:00:35 -10:00
J. Nick Koston
c8cb0ff61d Avoid trying to import platforms that do not exist (#112028)
* Avoid trying to import platforms that do not exist

* adjust

* fixes

* cleanup

* cleanup

* cleanup

* Apply suggestions from code review

* docs

* fixes

* fixes

* comment

* coverage

* coverage

* coverage

* Switch config to use async_get_component

This was another path where integrations that were marked to load in the executor
would be loaded in the loop

* Switch config to use async_get_component/async_get_platform

This was another path where integrations that were marked to load in the executor
would be loaded in the loop

* merge

* refactor

* refactor

* coverage

* preen

* preen
2024-03-02 22:14:28 -05:00
J. Nick Koston
6421a08ba8 Avoid expensive inspect calls in config validators (#112085)
* Avoid expensive inspect calls in config validators

inspect has a performance problem https://github.com/python/cpython/issues/92041

We now avoid calling inspect unless we are going to log

* remove unused

* reduce

* get_integration_logger
2024-03-02 21:50:35 -05:00
Jan-Philipp Benecke
196089e8b7 Remove deprecated hass.components.hassio usage (#111878) 2024-03-02 15:38:31 +01:00
Marc Mueller
daf8d1939b Fix generic HassJob typing (#111973) 2024-03-01 20:51:45 +01:00
G Johansson
9989a63cdf Add reconfigure step to config flow (#108794)
* Initial commit reconfigure

* test config config_entries

* Fix reconfigure

* test_config_entries

* review comment

* No reconfigure if reauth ongoing

* Fix tests

* Fix tests

* handle source creating flows

* combine

* No black

* Also check reconfigure in reauth flow

* Fix support

* Add entry id

* reset data entry flow

* Mods

* context data

* reset formatting

* Fix config flow platforms

* Fix tests

* Fix step message

* Handling reconfigure step

* Fix more tests

* Config entries tests

* entry_id always means reconfigure

* Mods

* Remove no longer valid exception

* Fixes

* reset silabs test

* dev reg

* resets

* assist pipeline

* Adjust config_entries

* Fix

* Fixes

* docstrings

* Review comment

* docstring
2024-03-01 12:29:35 +01:00
Michael Hansen
0d0b64d351 Move HassSetPosition to homeassistant domain (#111867)
* Move HassSetPosition to homeassistant domain

* Add test for unsupported domain with HassSetPosition

* Split service intent handler

* cleanup

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-02-29 21:53:52 -05:00
J. Nick Koston
c1750f7c3a Fix circular imports in core integrations (#111875)
* Fix circular imports in core integrations

* fix circular import

* fix more circular imports

* fix more circular imports

* fix more circular imports

* fix more circular imports

* fix more circular imports

* fix more circular imports

* fix more circular imports

* adjust

* fix

* increase timeout

* remove unused logger

* keep up to date

* make sure its reprod
2024-02-29 21:04:41 -05:00
Erik Montnemery
a0e558c457 Add generic classes BaseFlowHandler and BaseFlowManager (#111814)
* Add generic classes BaseFlowHandler and BaseFlowManager

* Migrate zwave_js

* Update tests

* Update tests

* Address review comments
2024-02-29 16:52:39 +01:00