Commit Graph

205 Commits (14b737e9b893194baf8ab6a5d6a2f2ba4eb39732)

Author SHA1 Message Date
Jan-Philipp Benecke 914abcec32
Change `hass.components` removal version in log to 2024.9 (#111903) 2024-02-29 21:05:33 -05:00
J. Nick Koston 25510fc13c
Limit executor imports to a single thread (#111898)
* Limit executor imports to a single thread

* test for import executor

* test for import executor

* test for import executor

* fixes

* better fix
2024-02-29 21:02:13 -05:00
J. Nick Koston ba4120d779
Fallback to event loop import on deadlock (#111868) 2024-02-29 09:01:03 -10:00
Jan-Philipp Benecke bc6b4d01c8
Deprecate `hass.components` and log warning if used inside custom component (#111508)
* Deprecate @bind_hass and log error if used inside custom component

* Log also when accessing `hass.components`

* Log warning only when `hass.components` is used

* Change version

* Process code review
2024-02-29 12:25:46 +01:00
J. Nick Koston c38e0d22b8
Fix text in docstrings and debug logging for loader (#111560) 2024-02-26 15:14:15 -10:00
J. Nick Koston 4ea1c5cc3c
Add support for importing integrations in the executor (#111336)
* Add support for pre-imports at setup time

alternative solution to #111331

* refactor

* refactor

* refactor

* mark >1.0s integrations

* no point in executor if already loaded

* no point in executor if already loaded

* cleanup

* cleanup

* two more

* one more

* analytics loads a lot more integrations

* cloud

* debug

* psutil, hardwre

* try zha

* Update homeassistant/setup.py

* await

* comments

* coverage

* coverage

* coverage

* move logic to loader

* move logic to loader

* preserve comments
2024-02-26 14:49:43 -05:00
Jan-Philipp Benecke baf84b6fba
Add `single_config_entry` manifest option (#109505)
* Allow setting if we support multiple config entries in config flow

* Move property to config flow instead of flow handler

* Move marking an integration as single instance only to manifest

* Revert line remove

* Avoid init a config flow or adding a new entry on a single instance with an entry

* Revert changes in test

* Process code review comments

* Apply code review suggestion
2024-02-26 19:00:33 +01:00
J. Nick Koston 3aecec5082
Avoid rechecking for missing platforms in the loader (#111204) 2024-02-23 10:48:47 -10:00
J. Nick Koston 1260c5a909
Speed up bootstrap by preloading manifests for base platforms (#110130) 2024-02-16 09:35:46 -06:00
J. Nick Koston 95015fbb40
Small performance improvement to async_get_config_flows (#110666)
- Migrates to using a future instead of Event like we have done
  everywhere else
2024-02-16 14:32:26 +01:00
J. Nick Koston f7b9b0da0e
Migrate dependencies loader to use async_get_integrations (#110690) 2024-02-16 08:07:39 +01:00
J. Nick Koston 37897ee384
Move late import of config flows in loader to load time (#110688)
* Move late import of config flows in loader to load time

There does not seem to be any reason to import the
generated flows late. Import them at load time
with the rest of the generated files

* tests
2024-02-16 07:55:12 +01:00
J. Nick Koston 01c3205635
Small performance improvements to config entry setup retry (#110448)
* Small performance improvements to config entry setup retry

- cache some properties that never change
- avoid loader.async_get_integration when we already have it
- avoid multiple integration.domain checks

* tweaks
2024-02-13 13:28:52 +01:00
J. Nick Koston 6173bfe873
Cache commonly called Integration manifest properties (#108141) 2024-01-16 21:05:44 +01:00
Joakim Plate 523352c97e
Avoid keeping config dir in path (#107760) 2024-01-16 13:38:47 +01:00
J. Nick Koston bb30bfa225
Reduce zeroconf matcher complexity (#105880) 2023-12-23 11:04:05 +01:00
Aarni Koskela 706add4a57
Switch formatting from black to ruff-format (#102893)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-11-27 14:38:59 +01:00
Erik Montnemery 50e11a7a37
Tweak loader.resolve_dependencies (#103851) 2023-11-12 17:27:32 +01:00
Erik Montnemery 97cc05d0b4
Make it possible to restart core in safe mode (#102606) 2023-10-24 14:47:58 +02:00
Erik Montnemery c481fdb7d0
Rename safe mode to recovery mode (#102580) 2023-10-23 20:33:08 +02:00
Erik Montnemery 17779c5f0c
Add loader.async_suggest_report_issue and loader.async_get_issue_tracker (#101336)
* Add loader.async_suggest_report_issue and loader.async_get_issue_tracker

* Update tests

* Add tests

* Address review comments

* Address review comments
2023-10-04 13:40:33 +02:00
Artur Pragacz e1771ae01e
Fix circular dependancy detection (#100458)
* Fix _async_component_dependencies

Fix bug with circular dependency detection
Fix bug with circular after_dependency detection
Simplify interface and make the code more readable

* Implement review feedback

* Pass all conflicting deps to Exception

* Change inner docstring

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

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-09-28 08:05:00 +02:00
J. Nick Koston e5ebba0753
Fix module check in _async_get_flow_handler (#99509)
We should have been checking for the module in hass.data[DATA_COMPONENTS]
and not hass.config.components as the check was ineffective if there were
no existing integrations instances for the domain which is the case for
discovery or when the integration is ignored
2023-09-04 14:19:10 -04:00
Erik Montnemery 7643820e59
Add loader.async_get_loaded_integration (#99440)
* Add loader.async_get_loaded_integration

* Decorate async_get_loaded_integration with @callback
2023-09-04 14:12:33 +02:00
Ville Skyttä 6399d74c15
Remove unnnecessary pylint configs from core (#98704) 2023-08-22 23:12:12 +02:00
Erik Montnemery 91faa53843
Don't allow hass.config.config_dir to be None (#98442) 2023-08-16 13:00:14 +02:00
Erik Montnemery 3b9d6f2dde
Add setup function to the component loader (#98148)
* Add setup function to the component loader

* Update test

* Setup the loader in safe mode and in check_config script
2023-08-15 10:59:42 +02:00
Erik Montnemery f809ce9033
Update bind_hass docstring to discourage its use (#96933) 2023-07-20 13:34:24 +02:00
J. Nick Koston 53fe74e055
Reduce overhead to fetch integrations (#93767)
We call this path over and over during startup and most
of the time the integration is already loaded. We want
that case to be the short path
2023-05-29 20:58:51 -04:00
J. Nick Koston d5a0824924
Use futures instead of asyncio.Event for async_get_integrations (#93060)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-05-14 14:42:04 -05:00
rlippmann 3a72054f93
Make dataclasses in HA core slotted (#91208) 2023-04-11 07:58:28 -10:00
epenet 611d4135fd
Add ComponentProtocol to improve type checking (#90586) 2023-03-31 14:19:58 -04:00
epenet ba23816a0c
Inverse json import logic (#88099)
* Fix helpers and util

* Adjust components

* Move back errors

* Add report

* mypy

* mypy

* Assert deprecation messages

* Move test_json_loads_object

* Adjust tests

* Fix rebase

* Adjust pylint plugin

* Fix plugin

* Adjust references

* Adjust backup tests
2023-02-16 11:37:57 +01:00
J. Nick Koston c83ea297b5
Refactor zeroconf task handling (#88204)
* Refactor zeroconf task handling

- Avoid the need to create tasks for most callbacks
- Fixes the untracked task that could get unexpectedly GCed

* be consistant

* be consistant

* fix zeroconf tests

* runtime

* Revert "runtime"

This reverts commit 19e6b61837.

* precalc

* refactor

* tweak

* update tests
2023-02-15 21:44:11 -05:00
epenet a202588fd2
Add return type to json_loads (#85672)
* Add JSON type definitions

* Sample use

* Keep mutable for a follo-up PR (avoid dead code)

* Use list/dict

* Remove JsonObjectType

* Remove reference to Union

* Cleanup

* Improve rest

* Rename json_dict => json_data

* Add docstring

* Add type hint to json_loads

* Add cast

* Move type alias to json helpers

* Cleanup

* Create and use json_loads_object

* Make error more explicit and add tests

* Use JsonObjectType in conversation

* Remove quotes
2023-02-07 17:21:55 +01:00
Franck Nijhof ca1a12898c
Enable Ruff D212 (#87347) 2023-02-03 23:08:48 +01:00
Franck Nijhof 79b52a2b41
Stricter pylint message control (#86154) 2023-01-20 13:47:55 +01:00
Franck Nijhof 64c2340fab
Core code styling improvements (#85963) 2023-01-15 23:00:51 +01:00
Franck Nijhof b0cee0bc46
String formatting and max line length - Part 1 (#84390)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-12-22 10:12:50 +01:00
Bram Kragten 9ed31bb8df
fix integration descriptions (#81008) 2022-10-26 12:39:23 +02:00
Franck Nijhof bb287dd0ed
Integrations v2.1: Virtual integrations (#80613) 2022-10-20 23:09:06 -04:00
Paulus Schoutsen 5cb8749ae3
Fix custom components not working with integration descriptions (#80686) 2022-10-20 13:25:24 -04:00
Franck Nijhof c4bbc439a5
Integrations v2.1: Differentiating hubs, devices and services (#80524)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-10-19 12:41:43 +02:00
Erik Montnemery b173ae7f44
Add support for integrations v2 (#78801)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-09-28 11:31:48 -04:00
Erik Montnemery cce23683f1
Add additional integration_type options for integration manifests (#79193)
* Add additional integration_type options for integration manifests

* Rename integration_type internal to system
2022-09-28 14:17:39 +02:00
Erik Montnemery 27599ea0ee
Minor tweaks of hassfest and loader.py (#78929) 2022-09-22 21:54:22 -04:00
Joakim Sørensen 0caf998547
Bump awesomeversion from 22.6.0 to 22.8.0 (#77436) 2022-08-28 14:52:23 -04:00
J. Nick Koston c76dec138a
Discover new bluetooth adapters when they are plugged in (#77006) 2022-08-22 15:45:08 -10:00
J. Nick Koston 3938015c93
Add support for scanners that do not provide connectable devices (#77132) 2022-08-22 14:02:26 -04:00
J. Nick Koston bbb9443b00
Fix bluetooth integration matching with service_data_uuids and service_uuids (#75687)
* Fix bluetooth integration with service_data and service_uuids

We would only dispatch a new flow when the address was seen for
the first time or the manufacturer_data appeared in a followup
advertisement. Its also possible for the service_data and
service_uuids to appear in a followup advertisement so we
need to track these as well

* improve logging to avoid overly large messages

* improve logging to avoid overly large messages

* adjust

* adjsut

* split

* coverage

* coverage

* coverage

* coverage

* fix matcher

* more coverage

* more coverage

* more coverage

* revert switchbot changes and move to seperate PR
2022-07-24 16:39:53 -05:00