Commit Graph

86 Commits (fe010289b4687b4b45dd51ffe43b045a85dca3c1)

Author SHA1 Message Date
Erik Montnemery ecb3bf79f3
Revert "Add support for subentries to config entries" (#133470)
Revert "Add support for subentries to config entries (#117355)"

This reverts commit ad15786115.
2024-12-18 13:51:05 +01:00
Erik Montnemery ad15786115
Add support for subentries to config entries (#117355)
* Add support for subentries to config entries

* Improve error handling and test coverage

* Include subentry_id in subentry containers

* Auto-generate subentry_id and add optional unique_id

* Tweak

* Update tests

* Fix stale docstring

* Address review comments

* Typing tweaks

* Add methods to ConfigEntries to add and remove subentry

* Improve ConfigSubentryData typed dict

* Update test snapshots

* Adjust tests

* Fix unique_id logic

* Allow multiple subentries with None unique_id

* Add number of subentries to config entry JSON representation

* Add subentry translation support

* Allow integrations to implement multiple subentry flows

* Update translations schema

* Adjust exception text

* Change subentry flow init step to user

* Prevent creating a subentry with colliding unique_id

* Update tests

* Address review comments

* Remove duplicaetd unique_id collision check

* Remove change from the future

* Improve test coverage

* Add default value for unique_id
2024-12-12 20:16:18 +01:00
Erik Montnemery d6ee10a543
Make FlowHandler.context a typed dict (#126291)
* Make FlowHandler.context a typed dict

* Adjust typing

* Adjust typing

* Avoid calling ConfigFlowContext constructor in hot path
2024-10-08 12:18:45 +02:00
Erik Montnemery b2982c18bb
Reinitialize zeroconf discovery flow on unignore (#125753)
* Reinitialize zeroconf discovery flow on unignore

* Adjust tests

* Improve comments

* Fix logic for updating discovery keys

* Add tests

* Use mock_config_flow helper in new config_entries test

* Add discovery_keys attribute to ConfigEntry

* Update zeroconf rediscovery

* Change type of ConfigEntry.discovery_keys

* Update tests

* Fix DiscoveryKey.from_json_dict and add tests

* Fix test

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2024-09-23 16:49:21 +02:00
epenet 960d1289ef
Avoid references to websocket_api.const in core and other components (#119285) 2024-06-10 13:49:44 +02:00
Marc Mueller ff3a801936
Add empty line after module docstring [a-d] (#112697) 2024-03-08 14:51:32 +01:00
Marc Mueller f3594c543d
Use KEY_HASS [a-g] (#112609) 2024-03-07 18:09:20 +01: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
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
J. Nick Koston aab21105da
Convert config entry subscriptions to callback (#110900) 2024-02-18 19:36:53 -06:00
J. Nick Koston 0a01161cdd
Cache JSON representation of ConfigEntry objects (#110823)
* Cache JSON representation of ConfigEntry objects

* fix recursive set

* tweak

* adjust

* order
2024-02-17 20:52:39 -05:00
J. Nick Koston 0bf95df4d6
Avoid creating tasks to setup ignored and disabled config entries (#110756)
* Avoid creating tasks to setup ignored and disabled config entries

* lint
2024-02-17 10:34:03 +01:00
J. Nick Koston 50770ce436
Refactor config integration to use normal functions for setup (#110750)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-02-16 18:12:33 -06:00
G Johansson cb776593cf
Make context in data entry flow possible to modify for subclasses (#110561)
* Make context in data entry flow possible to modify for subclasses

* mypy

* Make get_context

* base view

* Review comments

* Remove context from options flow
2024-02-16 15:51:51 +01:00
J. Nick Koston dff5e45761
Small speed up to listing config entries in the websocket api (#108892) 2024-01-25 20:20:19 -10:00
Marc Mueller afcb7a26cd
Enable strict typing for config (#108023) 2024-01-18 09:20:19 +01:00
Ville Skyttä 3b4774d9ed
Remove unnnecessary pylint configs from components/[a-d]* (#98911) 2023-08-24 00:54:02 +02:00
Robert Resch b0f68f1ef3
Use @require_admin decorator (#98061)
Co-authored-by: Robert Resch <robert@resch.dev>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2023-08-14 15:07:20 +02:00
Marvin Wichmann 795ef075da
Restore original websocket commands for config entries (#93707)
Restore original websocket commands and add "config_entries/get_single"
2023-05-28 21:40:35 -04:00
Erik Montnemery b754f03eb1
Add WS command for getting a config entry (#93387)
* Add WS command for getting a config entry

* Update tests
2023-05-23 10:44:02 +02:00
J. Nick Koston cf69da40f3
Only check support_entry_unload/support_remove_from_device once (#92041) 2023-04-26 10:23:18 +02:00
J. Nick Koston e38836b6e1
Update async_matching_config_entries to use async_get_integrations (#88527)
* Update async_matching_config_entries to use async_get_integrations

* Update homeassistant/components/config/config_entries.py

* Update homeassistant/components/config/config_entries.py
2023-02-21 21:17:18 -05:00
epenet 2c43606922
Add websocket type hints in components (#80654)
* Add websocket type hints in components

* Adjust

* Apply suggestion

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2022-10-20 13:41:14 +02: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
epenet 971ac015e7
Add websocket type hints in config (#80532) 2022-10-18 22:15:55 -04:00
J. Nick Koston 016a59ac94
Add support for subscribing to config entry changes (#77803) 2022-09-04 22:57:43 -05:00
Paulus Schoutsen 14f68ec1a9
Store redirect URI in context instead of asking each time (#77380)
* Store redirect URI in context instead of asking each time

* Fix tests
2022-08-29 19:28:42 -04:00
J. Nick Koston adf0f62963
Add websocket api to fetch config entries (#73570)
* Add websocket api to fetch config entries

* add coverage for failure case
2022-06-21 20:09:22 +02:00
epenet f91aa33c5f
Add FlowResultType enum to data entry flow (#72955) 2022-06-07 22:02:44 -07:00
Marc Mueller 9b9b553521
Disable no-self-use [pylint] (#70641)
* Disable no-self-use

* Remove disable comments
2022-04-25 07:41:01 -07:00
Bram Kragten 89daf4f96b
Handle config entries of integrations that are removed (#68928) 2022-03-30 14:35:12 -07:00
Paulus Schoutsen 3213091b8d
Add integration type (#68349) 2022-03-20 20:38:13 -07:00
J. Nick Koston 9a5eec561a
Only set require_restart on config entry reload if its not recoverable (#66994) 2022-02-21 10:27:23 -08:00
Erik Montnemery c496748125
Add WS API for removing a config entry from a device (#66188)
* Add WS API for removing a config entry from a device

* Address review comments

* Address review comments

* Remove entity cleanup from ConfigEntries

* Update + add tests

* Improve comments in test

* Add negative test

* Refactor according to review comments

* Add back async_remove_config_entry_device

* Remove unnecessary error handling

* Simplify error handling
2022-02-21 10:11:18 +01:00
Marc Mueller 45d8d04c40
Use assignment expressions [other] (#66882) 2022-02-19 17:22:51 +01:00
Erik Montnemery 83a10cca53
Enable basic type checking for config (#66197) 2022-02-09 19:09:55 +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
Erik Montnemery 9c9dc4cb8c
Import websocket_api (part 1) (#63905) 2022-01-11 18:24:08 +01:00
Michael a721927b9a
Use ConfigEntryDisabler enum (#62816) 2021-12-27 10:08:29 +01:00
Ville Skyttä 7db3246de4
Make config entry disabled_by an enum (#60445)
* Make config entry disabled_by an enum

* Update homeassistant/config_entries.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-12-15 20:53:21 +01:00
Marcel van der Veldt 7c7df5bb51
Change check for existence of options flow (#61147)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-12-07 12:50:34 -08:00
Marc Mueller 1ce889be60
Use assignment expressions 36 (#58825) 2021-10-31 18:35:27 +01:00
Ville Skyttä d8d34fdd3b
Prefer HTTPStatus over int in HA view JSON functions (#56504)
* Prefer HTTPStatus over int in HA view JSON functions

* Update zwave tests to not expect a fixed typo
2021-09-22 21:59:52 +03:00
Marc Mueller 48bada5a18
Update pylint to 2.11.1 (#56364) 2021-09-18 13:52:59 +02: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
Ville Skyttä 19d25cd901
Change config entry state to an enum (#49654)
* Change config entry state to an enum

* Allow but deprecate EntryState str equality comparison

* Test fixes

* Rename to ConfigEntryState

* Remove str comparability backcompat

* Update new occurrences of strs cropped up during review
2021-05-20 19:19:20 +02:00
Franck Nijhof c68b259bd3
Cleanup of unused connection_class logic (#49865)
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
2021-04-29 23:12:58 +02:00
Ville Skyttä a396619251
Use disabled_by constants (#49584)
Co-authored-by: J. Nick Koston <nick@koston.org>
2021-04-23 09:56:42 +02:00
Paulus Schoutsen 265fdea83b
Allow config entries to store a reason (#49581) 2021-04-23 09:23:43 +02:00