Commit graph

164 commits

Author SHA1 Message Date
Franck Nijhof 6db1fbf480
Fix repair issue about no yaml for config entries (#94271) 2023-06-08 18:22:34 +02:00
Erik Montnemery c1c319d4d1
Rename cv.no_yaml_config_schema to cv.config_entry_only_config_schema (#93908)
* Rename cv.no_yaml_config_schema to cv.config_entry_only_config_schema

* ✏️
2023-06-01 13:15:48 +02:00
Erik Montnemery ef4dea07cd
Improve no-yaml warning (#93851) 2023-05-31 10:11:02 +02:00
G Johansson 3f3b833034
Add issue when integration key YAML not supported (#93807)
* Add issue when integration key YAML not supported

* Fix feedback

* Fix review

* Update homeassistant/components/homeassistant/strings.json

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

---------

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
2023-05-31 09:56:33 +02:00
Erik Montnemery 8b662dc94f
Detect attempt to setup config entry integration via YAML (#93589) 2023-05-29 21:01:47 +02:00
Jan Bouwhuis da26b0a930
Ensure dependencies are awaited correctly when setting up integrations (#91454)
* Do not wait

* Correct tests

* Manage after dependencies stage 1

* test bootstrap dependencies

* Assert log the dependenciy is waited for

* Improve docstrings

* Assert outside callback

* Patch async_get_integrations

* Revert changes made to snips integration

* Undo changes to mqtt_statestream
2023-04-21 08:33:50 +02:00
epenet 611d4135fd
Add ComponentProtocol to improve type checking (#90586) 2023-03-31 14:19:58 -04:00
J. Nick Koston 4ce36366c3
Add names to the config entry setup and shutdown tasks (#89309)
* name the entry setup tasks

* name a few more tasks

* Update homeassistant/config_entries.py

* Update homeassistant/setup.py
2023-03-08 10:19:36 -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
Erik Montnemery 2c2489284b
Catch CancelledError when setting up components (#88635)
* Catch CancelledError when setting up components

* Catch CancelledError when setting up components

* Also catch SystemExit
2023-02-27 09:29:14 -05:00
Erik Montnemery f17a829bd8
Only wait for import flows to initialize at setup (#86106)
* Only wait for import flows to initialize at setup

* Update hassio tests

* Update hassio tests

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-01-18 10:44:18 +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
Erik Montnemery 1a274adc28
Add config_entries.async_wait_component (#76980)
Co-authored-by: thecode <levyshay1@gmail.com>
2022-11-17 21:52:57 +01:00
Aarni Koskela 8038485ca4
Use partition instead of split where possible in core (#81806) 2022-11-15 21:45:48 +01:00
Erik Montnemery 408069cb0c
Always install requirements of after_dependencies (#79094) 2022-09-26 09:59:01 -04:00
J. Nick Koston cd03c49fc2
Wait for config entry platform forwards (#73806) 2022-07-09 17:27:42 +02:00
Paulus Schoutsen e7ca6b6e38
Highlight in logs it is a custom component when setup fails (#67559)
Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev>
2022-03-03 15:03:03 -08:00
Marc Mueller 30e2411761
Add type ignore error codes [last ones] (#66816) 2022-02-18 18:15:57 +01:00
Marc Mueller b2ee7cebc9
Improve setup_time typing (#66509) 2022-02-14 14:24:58 +01:00
Erik Montnemery 0eb2caabcf
Report unmet dependencies for failing config flows (#65061)
* Report unmet dependencies for failing config flows

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/setup.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Modify error message

* Add test

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-02-02 15:06:27 +01:00
Paulus Schoutsen 24546dfdf9
Catch all exceptions on import component/platform (#64930) 2022-01-25 20:39:32 -08:00
Marc Mueller 240c9979c7
Move disallow-any-generics to mypy.ini (#63917) 2022-01-11 13:33:25 -08:00
Marc Mueller 54cb1e7556
Add strict typing to core.py (5) - Task (#63243) 2022-01-07 16:48:34 +01:00
Tobias Sauerwein 2c904c0974
Bump mypy to 0.930 (#62642)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2021-12-27 17:55:17 +01:00
Ruslan Sayfutdinov 55f4962c06
Fix pylint plugin which checks relative imports (#62693) 2021-12-23 11:14:47 -08:00
Marvin Wichmann 707fe67c00
Move StrEnum to homeassistant.backports and move Platform to homeassistant.const (#60880)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-12-03 09:31:17 +01:00
Franck Nijhof c8b0a3b667
Revert "Move Platform StrEnum to const" (#60875) 2021-12-02 14:19:08 -08:00
Franck Nijhof 6e220d5d17
Move Platform StrEnum to const (#60857) 2021-12-02 22:30:52 +01:00
Joakim Sørensen 28ebd13d75
Mark calendar as a base platform (#60660) 2021-11-30 21:28:33 +01:00
Marc Mueller 77ee72cbb9
Import Callable from collections.abc (1) (#56775) 2021-09-29 16:32:11 +02:00
Marc Mueller 7af67d34cf
Use assignment expressions 01 (#56394) 2021-09-18 13:31:35 -10:00
Ville Skyttä 848c0be58a
Avoid some implicit generic Anys (#54577) 2021-08-16 23:12:06 +02:00
Raman Gupta d0cebe911c
Add siren, number, and weather to base platform list (#54665) 2021-08-15 22:06:05 +02:00
Ville Skyttä 470f2dd73f
Upgrade pyupgrade to 2.21.2, apply its changes (#52987) 2021-07-19 10:46:09 +02:00
Franck Nijhof 655f797f67
Add Select entity support to Google Assistant (#51997) 2021-06-18 23:30:46 +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
Joakim Sørensen c98788edae
Mark camera as a base platform (#49297) 2021-04-16 15:00:21 +02:00
J. Nick Koston 81e6ad0744
Replace http startup logic with async_when_setup_or_start (#48784) 2021-04-13 14:10:58 -07:00
Joakim Sørensen eef7faa1e4
Add TTS engines in config.components (#48939)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-04-09 16:13:07 -07:00
J. Nick Koston 12e3bc8101
Provide api to see which integrations are being loaded (#48274)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-04 22:11:44 -10:00
Franck Nijhof 52475c108f
Make integration setup optional (#48381) 2021-03-29 13:53:47 -07:00
J. Nick Koston 1fb9008488
Include platform only integrations in the manifest list api (#48269) 2021-03-29 12:51:48 +02:00
Franck Nijhof 45f77ccccf
Merge of nested IF-IF cases - Core (#48364) 2021-03-27 09:23:32 +01:00
Marc Mueller e55702d635
Update typing 01 (#48013) 2021-03-17 17:34:55 +01:00
Paulus Schoutsen 4d5948b4d0
Use dict syntax (#41325) 2020-10-06 15:02:23 +02:00
J. Nick Koston 4d637e5f30
Skip setup of dependencies if they are already setup (#39482)
after_dependencies were checking hass.config.components
to see if something was already setup.  We did not do
the same for dependencies which resulted in trying
to set them up more then once.

Noticed when `homeassistant.setup` was set to debug
logging and many integrations were announcing
waiting on http when it was already setup.
2020-08-31 07:54:15 -04:00
Franck Nijhof 1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Paulus Schoutsen 2a9da208d4
Allow disabling integrations in manifest, block uuid package being installed and disable ezviz (#38444) 2020-08-26 10:20:14 +02:00
Pascal Vizeli c291d4aa7d
Intelligent timeout handler for setup/bootstrap (#38329)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-08-05 14:58:19 +02:00
Franck Nijhof 53545c984b
Log lines do not end with a full stop (#37527) 2020-07-05 23:04:19 +02:00
J. Nick Koston a798b508bc
Raise slow startup timeout to 3h for large db migrations. (#37061) 2020-06-24 09:58:01 -07:00
Paulus Schoutsen 5642027ffb
Improve after_dependencies handling (#36898) 2020-06-19 17:24:33 -07:00
Paulus Schoutsen 8f3c84b349
Mark config dependency of frontend (#36587) 2020-06-09 23:27:47 -07:00
J. Nick Koston 5183c40b23
Periodically log when integrations are taking a while to setup (#36208)
* Periodicly log when intergrations are taking a while to setup

When one or more intergrations are taking a while to setup
it is hard to determine which one is the cause.  We can
help narrow this down for the user with a periodic log
message about which domains are still waiting to be setup
every 30s.

* 30 -> 60 per discussion

* only log when the integration is actually doing setup

* reduce, fix race in test
2020-05-28 18:48:42 -05:00
J. Nick Koston f626129e2b
Proceed with startup if an integration setup blocks for more than 30m (#36082)
* Proceed with startup if an integration setup blocks for more than 30m

* Fix test location

* Fix log call

* naming

* revert

* do not shield from cancelation

* Adjust test since we now cancel when we hit the timeout
2020-05-27 13:43:05 -05:00
Paulus Schoutsen ed925f9ef5
Set up config entries in parallel (#34755) 2020-04-27 10:05:02 -07:00
Paulus Schoutsen 0b90ebf91e
Allow async_setup changes to config entry data be taken into a… (#34166)
* Allow async_setup changes to config entry data be taken into account

* Fix tests

* Limit scope try…finally

* Update tests/test_config_entries.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

* Fix import

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2020-04-14 18:46:41 -07:00
Paulus Schoutsen 82c8f18bc7
Fix hassio panel load (#32922)
* Fix loading hassio panel

* Remove blacklist
2020-03-17 17:54:57 -07:00
Paulus Schoutsen 7bbffa6e6d
Blacklist auto_backup (#32912)
* Blacklist auto_backup

* Mock with a set
2020-03-17 12:14:17 -07:00
Ville Skyttä e86919a997
Type hint improvements (#32793) 2020-03-14 11:39:28 +01:00
zhumuht 5f31b48f1d print component import error to logfile (#30346) 2020-01-19 22:05:10 -08:00
Paulus Schoutsen 5fdc60e067
Add Safe Mode (#30723)
* Store last working HTTP settings

* Add safe mode

* Fix tests

* Add cloud to safe mode

* Update logging text

* Fix camera tests leaving files behind

* Make emulated_hue tests not leave files behind

* Make logbook tests not leave files behind

* Make tts tests not leave files behind

* Make image_processing tests not leave files behind

* Make manual_mqtt tests not leave files behind
2020-01-14 13:03:02 -08:00
Ville Skyttä fa4fa30461 Various string cleanups (#30435)
* Remove some unnecessary string concatenations

* Replace some simple str.formats with f-strings

* Replace some string concatenations with f-strings
2020-01-03 14:47:06 +01:00
Ville Skyttä e6388e186c
Remove unnecessary string literal concatenations (#30360) 2020-01-02 21:17:10 +02:00
Franck Nijhof 0439d6964c Fix persistent setup error notification content (#29995)
* Fix persistent setup error notification content

* Use documentation from manifest, enriched error messages

* Fix issue caught by mypy
2019-12-16 20:16:23 +01:00
Bas Nijholt 67c56c860d Sort imports according to PEP8 for 'homeassistant' folder (#29789)
Components are already done
2019-12-09 16:42:10 +01:00
Paulus Schoutsen e99184bf68 Install requirements of after_dependencies when loading integrations (#29491)
* Install requirements of after_dependencies when loading integrations

* Fix smartthings test
2019-12-05 09:28:56 +01:00
Paulus Schoutsen 70c4b4a4f0
Check for import errors before validating config (#28395) 2019-10-31 11:38:06 -07:00
Pascal Vizeli c1851a2d94
Cleanup coroutine threadsafe (#27080)
* Cleanup coroutine threadsafe

* fix lint

* Fix typing

* Fix tests

* Fix black
2019-10-01 16:59:06 +02:00
Franck Nijhof decf13b948 Use literal string interpolation in core (f-strings) (#26166) 2019-08-23 09:53:33 -07:00
Joakim Plate d1b9ebc7b2 Integration requirement check refactor (#25626)
* Factor out code getting requirements for integration

* Have process requirements raise an exception

* One more lint fix

* Blackify

* Catch new exception

* Let RequirementsNotFound be a HomeAssistantError

* Correct another test

* Split catching of exceptions and avoid complete log
2019-08-07 15:35:50 -07:00
Paulus Schoutsen 620cb74050 Type 2019-07-31 13:08:31 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Franck Nijhof 31f569ada9 Batch of Component(s) -> Integration(s) (#24972) 2019-07-05 15:24:26 -07:00
Joakim Plate e9f561e7ab Adjust logging (#24082)
* Make sure we log full path to debug log

* Make sure we log the exception to debug log
2019-05-24 15:54:04 -07:00
Paulus Schoutsen f995ab9d54
Don't pass in loop (#23984)
* Don't pass in loop

* Revert some changes

* Lint + Axis revert

* reinstate loop

* Fix a test

* Set loop

* Update camera.py

* Lint
2019-05-22 21:09:59 -07:00
Paulus Schoutsen d6f6273ac2 Make setup more robust (#23414)
* Make setup more robust

* Fix typing
2019-04-26 21:41:29 +02:00
Paulus Schoutsen 6a2da9f9a5
load cleanups (#23112)
* load cleanups

* Remove unused methods

* Allow importing requirements at the top of a file

* Fix test

* Lint

* Install reqs ASAP when loading platforms
2019-04-15 16:45:46 -07:00
Paulus Schoutsen d722f4d64a
Further integration load cleanups (#23104)
* Further integration load cleanups

* Fix tests

* Unflake MQTT vacuum command test
2019-04-14 19:07:05 -07:00
Paulus Schoutsen 6b0180f753
Fix demo (#23087)
* Fix demo

* Fix types

* Fix all the things

* Fix type

* Fix test

* Lint
2019-04-14 16:59:06 -07:00
Paulus Schoutsen 3368e30279
Migrate packages and check config (#23082)
* Migrate packages and check config

* Fix typing

* Fix check config script
2019-04-14 07:23:01 -07:00
Rohan Kapoor 6ba9ccf052 Load requirements and dependencies from manifests. Fallback to current REQUIREMENTS and DEPENDENCIES (#22717)
* Load dependencies from manifests. Fallback to current DEPENDENCIES

* Fix typing

* Ignore typing correctly

* Split out dependency processing to a new method

* Fix tests

* Only pull from manifest if dependencies is non empty

* Inline temporary function

* Fix light tests [skip ci]

* Fix tests/common

* Fix some mqtt tests [skip ci]

* Fix tests and component manifests which have only one platform

* Fix rflink tests

* Fix more tests and manifests

* Readability over shorthand format

* Fix demo/notify tests

* Load dependencies from manifests. Fallback to current DEPENDENCIES

* Load requirements from manifests. Fallback to current REQUIREMENTS

* Fix typing

* Ignore typing correctly

* Split out dependency processing to a new method

* Only pull from manifest if dependencies is non empty

* Inline temporary function

* Fix tests and component manifests which have only one platform

* Fix rflink tests

* Readability over shorthand format

* Clean up requirements

* Use integration to resolve deps/reqs

* Lint

* Lint

* revert a change

* Revert a test change

* Fix types

* Fix types

* Add back cache for load component

* Fix test_component_not_found

* Move light.test and device_tracker.test into test package instead with manifest to fix tests

* Fix broken device_tracker tests

* Add docstrings to __init__

* Fix all of the light tests that I broke earlier

* Embed the test.switch platform to fix other tests

* Embed and fix the test.imagimage_processing platform

* Fix tests for nx584

* Add dependencies from platform file's DEPENDENCIES

* Try to setup component when entity_platform is setting up

Fix tests in helpers folder

* Rewrite test_setup

* Simplify

* Lint

* Disable demo component if running in test

Temp workaround to unblock CI tests

* Skip demo tests

* Fix config entry test

* Fix repeat test

* Clarify doc

* One extra guard

* Fix import

* Lint

* Workaround google tts
2019-04-11 01:26:36 -07:00
Paulus Schoutsen cac00f5b26 Test for circular dependencies using manifests (#22908)
* Integration dependencies

* Lint

* Lint

* Fix one test

* Lint

* Fix load custom component integration

Fix async issue
Add circular dependency detection in manifest validation

* Fix test

* Address review comment

* Apply suggestions from code review

Co-Authored-By: balloob <paulus@home-assistant.io>
2019-04-09 09:30:32 -07:00
Paulus Schoutsen e59240fa00
Add default_config component (#20799)
* Add default config component

* Add default_config to default config

* Fix comments
2019-02-07 20:07:15 -08:00
Paulus Schoutsen a9672b0d52 Load as many components in parallel as possible (#20806)
* Load as many components in parallel as possible

* Lint
2019-02-07 22:56:40 +01:00
Paulus Schoutsen a8f22287ca
Allow embedded platforms (#19948)
* Allow embedded platforms

* Fix test
2019-01-11 11:30:22 -08:00
Paulus Schoutsen 48e28843e6
OwnTracks Config Entry (#18759)
* OwnTracks Config Entry

* Fix test

* Fix headers

* Lint

* Username for android only

* Update translations

* Tweak translation

* Create config entry if not there

* Update reqs

* Types

* Lint
2018-11-28 22:20:13 +01:00
Matthias Urlichs 4581a741bd Report *which* component didn't return a bool (#18258)
* Report *which* component didn't return a bool

* break over-long line
2018-11-06 12:41:39 +01:00
Ville Skyttä dbd0763f83 Grammar and spelling fixes (#16065) 2018-08-19 22:29:08 +02:00
Andrey 140a874917 Add typing to homeassistant/*.py and homeassistant/util/ (#15569)
* Add typing to homeassistant/*.py and homeassistant/util/

* Fix wrong merge

* Restore iterable in OrderedSet

* Fix tests
2018-07-23 10:24:39 +02:00
Ville Skyttä b7c336a687 Pylint cleanups (#15626)
* Pylint 2 no-else-return fixes

* Remove unneeded abstract-class-not-used pylint disable
2018-07-23 10:16:05 +02:00
Andrey 24d2261060 Add check_untyped_defs (#15510)
* Add check_untyped_defs

* Change to regular if-else
2018-07-18 00:28:44 +02:00
Andrey e60f9ca392
More typing (#15449)
## Description:

More typing improvements.

Switch to using `mypy.ini` for flexibility

Add `warn_return_any` check except in `homeassistant.util.yaml` that does typing hacks. Fix some type annotations as resulting from this check and ignore others were fixing is hard.

## Checklist:
  - [x] The code change is tested and works locally.
  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
2018-07-13 20:14:45 +03:00
Andrey c2fe0d0120
Make typing checks more strict (#14429)
## Description:

Make typing checks more strict: add `--strict-optional` flag that forbids implicit None return type. This flag will become default in the next version of mypy (0.600)

Add `homeassistant/util/` to checked dirs.

## Checklist:
  - [x] The code change is tested and works locally.
  - [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
2018-07-13 13:24:51 +03:00
Andrey 7aec098a05 Bring back typing check. Meanwhile just for homeassistant/*.py (#14410)
* Bring back typing check. Meanwhile just for homeassistant/.py

* Change follow-imports to silent. Add a few more checks.
2018-05-12 17:44:53 -04:00
Paulus Schoutsen 83d300fd11 Custom component loading cleanup (#14211)
* Clean up custom component loading

* Fix some tests

* Fix some stuff

* Make imports work again

* Fix tests

* Remove debug print

* Lint
2018-05-01 20:57:30 +02:00
Matthias Urlichs f5cc40024d Rename homeassistant.util.async to .async_ (#13088)
"async" is (going to be) a reserved word.
2018-03-11 10:01:12 -07:00
Julius Mittenzwei 16cb7388ee Removing asyncio.coroutine syntax from HASS core (#12509)
* changed asyncio.coroutine syntax to new async def/await

* removed py34 from tox environment

* reverted some changes within entity.py

* -

* reverted changes within bootstrap.py

* reverted changes within discovery.py

* switched decorators

* Reverted change within aiohttp_client.py

* reverted change within logging.py

* switched decorators

* Await lock properly

* removed asyncio.coroutine from test
2018-02-25 03:38:46 -08:00
Paulus Schoutsen b3a47722f0
Initial support for Config Entries (#12079)
* Introduce Config Entries

* Rebase fail

* Address comments

* Address more comments

* RequestDataValidator moved
2018-02-16 14:07:38 -08:00