Commit Graph
125 Commits
Author SHA1 Message Date
J. Nick KostonandGitHub 1985a2ad8b Small speed up to creating flows (#117896)
Use a defaultdict instead of setdefault
2024-05-22 08:16:08 +02:00
Erik MontnemeryandGitHub b006aadeff Remove options from FlowResult (#117351) 2024-05-13 10:11:33 +02:00
SidandGitHub 2cc916db6d Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
1e72e9e0b2 Add workaround for data entry flow show progress (#116704)
Co-authored-by: epenet <[email protected]>
2024-05-04 13:17:21 -05:00
J. Nick KostonandGitHub a22c221722 Rename bus._async_fire to bus.async_fire_internal (#116027) 2024-04-23 22:28:31 +02:00
Marc MuellerandGitHub 1b24e78dd9 Improve FlowHandler menu_options typing (#115296) 2024-04-11 22:14:37 -04:00
SidandGitHub a5b609f081 Enable ruff TRY401 (#114395)
* Enable ruff TRY401

* fix tests
2024-03-29 07:20:36 +01:00
Marc MuellerandGitHub 24168dfba7 Update mypy-dev to 1.10.0a3 (#114289)
* Update mypy-dev to 1.10.0a3

* Allow TypedDict init from Type
2024-03-27 12:32:29 +01:00
Marc MuellerandGitHub 19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
Erik MontnemeryandGitHub 82efb3d35b Make FlowResult a generic type (#111952) 2024-03-07 12:41:14 +01:00
3d3e9900c3 Add TypeVar default for FlowResult (#112345)
Co-authored-by: Marc Mueller <[email protected]>
2024-03-05 22:52:11 +01:00
Erik MontnemeryandGitHub 3a5e0c14bf Remove config flow specifics from FlowResult (#111932)
* Remove config flow specifics from FlowResult

* Improve docstring

* Update pylint rules
2024-03-01 13:07:13 +01:00
Erik MontnemeryandGitHub 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
Erik MontnemeryandGitHub fc4b18b907 Return FlowResultType.ABORT when violating single_config_entry (#111637)
* Return FlowResultType.ABORT when violating single_config_entry

* Fix translations

* Fix tests
2024-02-27 18:28:19 +01:00
Robert ReschandGitHub 6fdad44941 Improve invalid error messages in the config flows (#108075) 2024-01-30 12:24:19 +01:00
Erik MontnemeryandGitHub e90b42d3d0 Fix FlowHandler show progress (#108586) 2024-01-21 22:40:48 +01:00
Erik MontnemeryandGitHub 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 MontnemeryandGitHub c3e8e931e6 Deprecate passing step_id to FlowHandler methods (#107944) 2024-01-15 09:37:57 +01:00
Erik MontnemeryandGitHub 24c23d7323 Warn if integrations call async_show_progress without passing a task (#107796) 2024-01-13 11:56:05 +01:00
Erik MontnemeryandGitHub 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 MontnemeryandGitHub 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 KostonandGitHub 7d18ad6fe7 Reduce discovery flow matching overhead (#107709) 2024-01-10 07:14:18 -10:00
Erik MontnemeryandGitHub c805ea7b4f Include deprecated constants in wildcard imports (#107114) 2024-01-05 11:46:45 +01:00
Robert ReschandGitHub 060172fc24 Deprecate deprecated data entry flow constants (#106229) 2023-12-23 11:25:39 +01:00
J. Nick KostonandGitHub 0d9a583f4d Small speed up to data entry flow steps (#105713)
Instead of checking if the flow is completed with
a linear tuple search each time, use a constant
set
2023-12-14 17:32:14 +01:00
Erik MontnemeryandGitHub 6908497c3d Add minor version to config entries (#105479) 2023-12-12 08:44:35 +01:00
Erik MontnemeryandGitHub 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
Marc MuellerandGitHub 0b2b486754 Update mypy to 1.6.0 (#101780) 2023-10-11 13:25:11 +02:00
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 <[email protected]>
2023-10-02 14:15:54 +02:00
J. Nick KostonandGitHub d675825b5a Avoid double lookups with data_entry_flow indices (#100627) 2023-09-20 11:55:51 +02:00
Erik MontnemeryandGitHub d282ba6bac Use a single WS command for group preview (#98903)
* Use a single WS command for group preview

* Fix tests
2023-08-24 11:59:24 +02:00
Erik MontnemeryandGitHub b885dfa5a8 Add preview to sensor group config and option flows (#83638) 2023-08-22 10:29:16 +02:00
Franck NijhofandGitHub 30058297cf Migrate backported StrEnum to built-in StrEnum (#97101) 2023-07-23 23:19:24 +02:00
Marc MuellerandGitHub 77f38e33e5 Import names from typing instead of typing_extensions [3.11] (#97065) 2023-07-22 17:03:44 -05:00
J. Nick KostonandGitHub 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
J. Nick KostonandGitHub 0cc9b2e803 Use slots for discovery dataclasses (#90751) 2023-04-04 12:44:59 +02:00
J. Nick KostonandGitHub 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
Erik MontnemeryandGitHub 3cd6bd87a7 Remove config entry specifics from FlowManager (#85565) 2023-01-17 15:26:17 +01:00
epenetandGitHub 13cfd60019 Allow None in add_suggested_values_to_schema (#85763) 2023-01-16 11:36:21 +01:00
Franck NijhofandGitHub 64c2340fab Core code styling improvements (#85963) 2023-01-15 23:00:51 +01:00
Franck NijhofandGitHub bcf32f8331 Mark required fields in FlowResult typedict (#84811)
* Mark required fields in FlowResult typedict

* Remove unneeded asserts from tests
2022-12-30 12:01:45 +01:00
b0cee0bc46 String formatting and max line length - Part 1 (#84390)
Co-authored-by: Erik Montnemery <[email protected]>
2022-12-22 10:12:50 +01:00
Erik MontnemeryandGitHub bf4c399b19 Improve data entry flow typing (#84030) 2022-12-15 12:41:20 +01:00
Erik MontnemeryandGitHub 033a16b67e Improve data entry flow typing (#83901) 2022-12-15 08:45:54 +01:00
Erik MontnemeryandGitHub cc132bfad6 Make it optional to provide a title when finishing a FlowHandler (#83534)
* Make it optional to provide a title when finishing a FlowHandler

* Make ConfigEntry.title a str

* Revert changes in ConfigFlow

* Adjust tests
2022-12-09 10:24:08 +01:00
epenetandGitHub 724a79a8e8 Add suggested_value helper for FlowHandler (#82491)
* Add suggested_value helper for ConfigFlow

* Move helper function to FlowHandler

* Rename and adjust docstring

* Fix rebase
2022-11-29 10:16:01 +01:00
Paulus SchoutsenandGitHub 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
puddlyandGitHub 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
Marc MuellerandGitHub 563ec67d39 Add strict typing for auth (#75586) 2022-08-16 10:10:37 -04:00
epenetandGitHub 67b0354632 Adjust FlowResult construction in data entry flow (#72884) 2022-06-16 12:57:41 +02:00