Commit Graph

42 Commits (d7960859239440efefa021bbf40b107761b3693a)

Author SHA1 Message Date
Erik Montnemery e90b42d3d0
Fix FlowHandler show progress (#108586) 2024-01-21 22:40:48 +01:00
Erik Montnemery fb24e086b2
Hide FlowResultType.SHOW_PROGRESS_DONE from frontend (#107799)
* Hide FlowResultType.SHOW_PROGRESS_DONE from frontend

* Update tests
2024-01-16 09:04:27 +01:00
Erik Montnemery 00165fef5b
Improve the test class used for testing FlowManager.async_show_progress (#107786)
* Improve the test class used for testing FlowManager.async_show_progress

* Address review comments
2024-01-14 18:39:45 +01:00
Erik Montnemery 24c23d7323
Warn if integrations call async_show_progress without passing a task (#107796) 2024-01-13 11:56:05 +01:00
Erik Montnemery 44a6882c39
Make step_id parameter to FlowHandler.async_show_progress optional (#107802)
Drop step_id parameter from FlowHandler.async_show_progress
2024-01-11 21:05:20 +01:00
Erik Montnemery 24cd6a8a52
Improve ergonomics of FlowManager.async_show_progress (#107668)
* Improve ergonomics of FlowManager.async_show_progress

* Don't include progress coroutine in web response

* Unconditionally reset progress task when show_progress finished

* Fix race

* Tweak, add tests

* Address review comments

* Improve error handling

* Allow progress jobs to return anything

* Add comment

* Remove unneeded check

* Change API according to discussion

* Adjust typing
2024-01-11 12:00:12 +01:00
J. Nick Koston 7d18ad6fe7
Reduce discovery flow matching overhead (#107709) 2024-01-10 07:14:18 -10:00
Erik Montnemery c805ea7b4f
Include deprecated constants in wildcard imports (#107114) 2024-01-05 11:46:45 +01:00
Robert Resch 060172fc24
Deprecate deprecated data entry flow constants (#106229) 2023-12-23 11:25:39 +01:00
Erik Montnemery 4498c2e8c4
Validate steps in Flowhandler (#102152)
* Validate steps in Flowhandler

* Move validation to FlowManager._async_handle_step

* Fix _raise_if_not_has_step

* Fix config_entries tests

* Fix tests

* Rename

* Add test
2023-10-19 13:34:10 +02:00
Simon Lamon a618e8d1cf
Fix loop in progress config flow (#97229)
* Fix data entry flow with multiple steps

* Update a test

* Update description and add a show progress change test

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-10-02 14:15:54 +02:00
J. Nick Koston 9e666ae0c0
Reduce in progress flow matching overhead (#94403)
* Reduce config flow matching overhead

Much of the config flow matching is happening on the context data
after converting via a series of functions. Avoid the conversions
by passing the context matcher deeper into the stack so only
relvant entries need to be processed.

The goal is to reduce the overhead and reduce the chance
the event loop falls behind at the started event when
all the discoveries are processed

* Reduce config flow matching overhead

Much of the config flow matching is happening on the context data
after converting via a series of functions. Avoid the conversions
by passing the context matcher deeper into the stack so only
relvant entries need to be processed.

The goal is to reduce the overhead and reduce the chance
the event loop falls behind at the started event when
all the discoveries are processed

* Reduce config flow matching overhead

Much of the config flow matching is happening on the context data
after converting via a series of functions. Avoid the conversions
by passing the context matcher deeper into the stack so only
relvant entries need to be processed.

The goal is to reduce the overhead and reduce the chance
the event loop falls behind at the started event when
all the discoveries are processed

* augment cover
2023-06-11 10:41:38 +02:00
epenet a51cc75f03
Add type hints to core tests (part 2) (#88492) 2023-02-21 09:27:13 +01:00
J. Nick Koston 331102e592
Dismiss discoveries when the underlying device disappears (#88340)
* Implement discovery removals

Bluetooth, HomeKit, SSDP, and Zeroconf now implement
dismissing discoveries when the underlying discovered
device disappears

* cover

* add zeroconf test

* cover

* cover bluetooth

* fix rediscover
2023-02-17 15:51:19 -05:00
epenet c98b4e3204
Add typing to tests with single hass argument (2) (#87675)
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
Franck Nijhof bfbf9b9751
Adjusts imports in tests to match our relative import rules (#86788) 2023-01-27 12:51:58 +01:00
Erik Montnemery 3cd6bd87a7
Remove config entry specifics from FlowManager (#85565) 2023-01-17 15:26:17 +01:00
Marc Mueller 63d519c1a8
Spelling updates (#82867) 2022-11-28 16:51:43 +01:00
puddly 2224d0f43a
Add a callback for data flow handler removal (#77394)
* Add a callback for when data flows are removed

* Call `async_remove` at the very end

* Handle and log exceptions caught during flow removal

* Log the error as an exception, with a traceback

* Adjust test's expected logging output to match updated format specifier
2022-08-29 16:25:34 -04:00
Franck Nijhof a6244eea28
Search/replace RESULT_TYPE_* by FlowResultType enum (#74656) 2022-07-07 21:28:18 +02:00
Franck Nijhof 7cd68381f1
Search/replace RESULT_TYPE_* by FlowResultType enum (#74642) 2022-07-07 19:57:36 +03:00
Paulus Schoutsen f6af93ae35
Add support for menu step (#68203) 2022-03-16 14:14:50 -07:00
J. Nick Koston 3b7dce8b95
Index in-progress flows to avoid linear search (#58146)
Co-authored-by: Steven Looman <steven.looman@gmail.com>
2021-10-22 07:19:49 -10:00
J. Nick Koston b86e19143d
Prevent event loop delay / instability from discovery (#57463) 2021-10-13 08:37:14 -07:00
Ville Skyttä c2f5dcefa5
Use flow result type constants more (#51122) 2021-05-29 14:09:13 +02:00
Ville Skyttä 153d6e891e
Use config_entries.SOURCE_* constants (#49631) 2021-04-25 11:27:40 +02:00
J. Nick Koston dafc7a072c
Cancel discovery flows that are initializing at shutdown (#49241) 2021-04-15 07:13:42 -10:00
Martin Hjelmare 1338c4a425
Add data entry flow show progress step (#42419) 2020-11-09 18:39:28 +01:00
Paulus Schoutsen 1c5b4dbd97
Add current step that is in progress (#35272) 2020-05-05 21:34:51 -07:00
Paulus Schoutsen 6404882ec4
Allow flows to know if user is in advanced mode (#34629) 2020-04-24 09:31:56 -07:00
Jc2k fdfedd086b Rework FlowManager to use inheritance (#30133)
* Pull async_finish_flow/async_create_flow out of ConfigEntries

* Towards refactoring

* mypy fixes

* Mark Flow manager with abc.* annotations

* Flake8 fixes

* Mypy fixes

* Blacken data_entry_flow

* Blacken longer signatures caused by mypy changes

* test fixes

* Test fixes

* Fix typo

* Avoid protected member lint (W0212) in config_entries

* More protected member fixes

* Missing await
2020-01-03 11:52:01 +01:00
Paulus Schoutsen d851cb6f9e
Add unique ID to config entries (#29806)
* Add unique ID to config entries

* Unload existing entries with same unique ID if flow with unique ID is
finished

* Remove unused exception

* Fix typing

* silence pylint

* Fix tests

* Add unique ID to Hue

* Address typing comment

* Tweaks to comments

* lint
2019-12-16 12:27:43 +01:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Paulus Schoutsen 9debbfb1a8
Add SSDP integration (#24090)
* Add SSDP integration

* Fix tests

* Sort all the things

* Add netdisco to test requirements
2019-05-26 19:48:27 -07:00
Paulus Schoutsen 5888e32360 Add support for an external step in config flow (#23782)
* Add support for an external step in config flow

* Types

* Lint
2019-05-10 14:33:49 +02:00
Jason Hu 00c6f56cc8
Allow finish_flow callback to change data entry result type (#16100)
* Allow finish_flow callback to change data entry result type

* Add unit test
2018-08-21 10:48:24 -07:00
Jason Hu 50daef9a52 Add context to login flow (#15914)
* Add context to login flow

* source -> context

* Fix unit test

* Update comment
2018-08-13 11:27:18 +02:00
Jason Hu f58425dd3c Refactor data entry flow (#15883)
* Refactoring data_entry_flow and config_entry_flow

Move SOURCE_* to config_entries
Change data_entry_flow.FlowManager.async_init() source param default
 to None
Change this first step_id as source or init if source is None
_BaseFlowManagerView pass in SOURCE_USER as default source

* First step of data entry flow decided by _async_create_flow() now

* Lint

* Change helpers.config_entry_flow.DiscoveryFlowHandler default step

* Change FlowManager.async_init source param to context dict param
2018-08-09 13:24:14 +02:00
Paulus Schoutsen fa9b9105a8
Fix hue discovery popping up (#14614)
* Fix hue discovery popping up

* Fix result

* Fix tests
2018-05-24 14:24:14 -04:00
Paulus Schoutsen 5d3471269a Show a notification when a config entry is discovered (#14022)
* Show a notification when a config entry is discovered

* update comment

* Inline functions

* Lint
2018-04-22 21:00:24 +02:00
Paulus Schoutsen 4d44c0feff
Further untangle data entry flow (#13855)
* Further untangle data entry flow

* Fix test

* Remove helper class
2018-04-14 14:38:24 -04:00
Paulus Schoutsen 60508f7215
Extract config flow to own module (#13840)
* Extract config flow to own module

* Lint

* fix lint

* fix typo

* ConfigFlowHandler -> FlowHandler

* Rename to data_entry_flow
2018-04-13 10:14:53 -04:00